예제 #1
0
 public void Dispose()
 {
     if (!_isDisposd)
     {
         _isDisposd = true;
         _pool.Return(this);
     }
 }
예제 #2
0
        private void DeactivateIcon(Minion minion)
        {
            MapIcon iconToDeactivate = activeIcons.FirstOrDefault(icon => icon.Target == minion);

            if (iconToDeactivate == default)
            {
                return;
            }

            mapIconPool.Return(iconToDeactivate);
            activeIcons.Remove(iconToDeactivate);
        }
예제 #3
0
 public void Recycle()
 {
     if (ownedByPool != null)
     {
         Native.grpcsharp_request_call_context_reset(this);
         ownedByPool.Return(this);
     }
     else
     {
         Dispose();
     }
 }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
 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);
 }
예제 #10
0
 public void Return(T instance)
 {
     objectPool.Return(instance.GetComponent <PoolObjectController>());
 }
예제 #11
0
 /// <summary>
 /// Returns this object to the pool for reuse
 /// </summary>
 public virtual void ReturnToPool()
 {
     ParentPool.Return(this);
 }
예제 #12
0
 public override void ReturnConnection(IObjectPool <DbConnection> pool, Object <DbConnection> conn, Exception ex)
 {
     pool.Return(conn);
 }
예제 #13
0
 public virtual void Return()
 {
     OnReturnToPool?.Invoke(GameObject);
     _pool.Return(GameObject);
 }
예제 #14
0
 void IDisposable.Dispose() => _pool.Return(_value);