public void Dispose() { if (!_isDisposd) { _isDisposd = true; _pool.Return(this); } }
private void DeactivateIcon(Minion minion) { MapIcon iconToDeactivate = activeIcons.FirstOrDefault(icon => icon.Target == minion); if (iconToDeactivate == default) { return; } mapIconPool.Return(iconToDeactivate); activeIcons.Remove(iconToDeactivate); }
public void Recycle() { if (ownedByPool != null) { Native.grpcsharp_request_call_context_reset(this); ownedByPool.Return(this); } else { Dispose(); } }
public override void ReturnConnection(IObjectPool <DbConnection> pool, Object <DbConnection> conn, Exception ex) { var rawPool = pool as MySqlConnectionPool; if (rawPool != null) { rawPool.Return(conn, ex); } else { pool.Return(conn); } }
protected override void ReturnConnection(IObjectPool <DbConnection> pool, Object <DbConnection> conn, Exception ex) { var rawPool = pool as OdbcPostgreSQLConnectionPool; if (rawPool != null) { rawPool.Return(conn, ex); } else { pool.Return(conn); } }
public void Publish(string topic, IRemoteEventData remoteEventData) { var connection = _connectionPool.Acquire(); try { var channel = connection.CreateModel(); channel.ExchangeDeclare(_exchangeTopic, "topic", true); var body = Encoding.UTF8.GetBytes(_remoteEventSerializer.Serialize(remoteEventData)); var properties = channel.CreateBasicProperties(); properties.Persistent = true; channel.BasicPublish(_exchangeTopic, topic, properties, body); } finally { _connectionPool.Return(connection); } }
public void Publish(IRemoteEventData remoteEventData) { var routingKey = remoteEventData.GetType().FullName; var connection = _connectionPool.Acquire(); try { var channel = connection.CreateModel(); channel.ExchangeDeclare(_rabbitMqEventBusOptions.ExchangeName, "direct", true); var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(remoteEventData)); var properties = channel.CreateBasicProperties(); properties.Persistent = true; channel.BasicPublish(_rabbitMqEventBusOptions.ExchangeName, routingKey, properties, body); } finally { _connectionPool.Return(connection); } }
private void Update() { _disableSourceBuffer.Clear(); foreach (var activeSource in _activeSources) { if (activeSource.status != CriAtomSource.Status.PlayEnd) { continue; } _sourcePool.Return(activeSource); _disableSourceBuffer.Add(activeSource); } foreach (var source in _disableSourceBuffer) { _activeSources.Remove(source); } }
protected override void ReturnConnection(IObjectPool<DbConnection> pool, Object<DbConnection> conn, Exception ex) { var rawPool = pool as OdbcOracleConnectionPool; if (rawPool != null) rawPool.Return(conn, ex); else pool.Return(conn); }
public void Return(T instance) { objectPool.Return(instance.GetComponent <PoolObjectController>()); }
/// <summary> /// Returns this object to the pool for reuse /// </summary> public virtual void ReturnToPool() { ParentPool.Return(this); }
public override void ReturnConnection(IObjectPool <DbConnection> pool, Object <DbConnection> conn, Exception ex) { pool.Return(conn); }
public virtual void Return() { OnReturnToPool?.Invoke(GameObject); _pool.Return(GameObject); }
void IDisposable.Dispose() => _pool.Return(_value);