internal ConnectionPool(
     IConnection connection,
     Queue <IPooledConnection> availableConnections        = null,
     Dictionary <Guid, IPooledConnection> inUseConnections = null,
     ILogger logger = null,
     ConnectionPoolSettings settings = null)
     : this(null, null, null, settings ?? new ConnectionPoolSettings(Config.DefaultConfig.MaxIdleSessionPoolSize), logger)
 {
     _fakeConnection       = connection;
     _availableConnections = availableConnections ?? new Queue <IPooledConnection>();
     _inUseConnections     = inUseConnections ?? new Dictionary <Guid, IPooledConnection>();
 }
示例#2
0
 internal ConnectionPool(
     IConnection connection,
     ConcurrentQueue <IPooledConnection> availableConnections = null,
     ConcurrentSet <IPooledConnection> inUseConnections       = null,
     ILogger logger = null,
     ConnectionPoolSettings settings = null)
     : this(null, null, settings ?? new ConnectionPoolSettings(Config.DefaultConfig),
            logger)
 {
     _fakeConnection       = connection;
     _availableConnections = availableConnections ?? new ConcurrentQueue <IPooledConnection>();
     _inUseConnections     = inUseConnections ?? new ConcurrentSet <IPooledConnection>();
 }
示例#3
0
        public ConnectionPool(
            Uri uri,
            IAuthToken authToken,
            EncryptionManager encryptionManager,
            ConnectionPoolSettings connectionPoolSettings,
            ILogger logger,
            IConnectionErrorHandler exteralErrorHandler = null)
            : base(logger)
        {
            _uri       = uri;
            _authToken = authToken;

            _encryptionManager   = encryptionManager;
            _idleSessionPoolSize = connectionPoolSettings.MaxIdleSessionPoolSize;

            _externalErrorHandler = exteralErrorHandler;
            _logger = logger;
        }
示例#4
0
        public ConnectionPool(
            Uri uri,
            ConnectionSettings connectionSettings,
            ConnectionPoolSettings connectionPoolSettings,
            ILogger logger)
            : base(logger)
        {
            _uri = uri;
            _connectionSettings    = connectionSettings;
            _connectionIdleTimeout = connectionPoolSettings.ConnectionIdleTimeout;
            _idlePoolSize          = connectionPoolSettings.MaxIdleConnectionPoolSize;

            _logger = logger;

            var statisticsCollector = connectionPoolSettings.StatisticsCollector;

            if (statisticsCollector != null)
            {
                _statistics = new ConnectionPoolStatistics(this);
                statisticsCollector.Register(_statistics);
            }
        }
        internal DirectDriver(Uri uri, IAuthToken authToken, EncryptionManager encryptionManager, ConnectionPoolSettings connectionPoolSettings, ILogger logger)
        {
            Throw.ArgumentNullException.IfNull(uri, nameof(uri));
            Throw.ArgumentNullException.IfNull(authToken, nameof(authToken));
            Throw.ArgumentNullException.IfNull(encryptionManager, nameof(encryptionManager));
            Throw.ArgumentNullException.IfNull(connectionPoolSettings, nameof(connectionPoolSettings));

            Uri             = uri;
            _logger         = logger;
            _connectionPool = new ConnectionPool(uri, authToken, encryptionManager, connectionPoolSettings, _logger);
        }
示例#6
0
        internal Driver(Uri uri, IAuthToken authToken, EncryptionManager encryptionManager, ConnectionPoolSettings connectionPoolSettings, ILogger logger)
        {
            Throw.ArgumentNullException.IfNull(uri, nameof(uri));
            Throw.ArgumentNullException.IfNull(authToken, nameof(authToken));
            Throw.ArgumentNullException.IfNull(encryptionManager, nameof(encryptionManager));
            Throw.ArgumentNullException.IfNull(connectionPoolSettings, nameof(connectionPoolSettings));

            if (uri.Port == -1)
            {
                var builder = new UriBuilder(uri.Scheme, uri.Host, 7687);
                uri = builder.Uri;
            }

            Uri             = uri;
            _logger         = logger;
            _connectionPool = new ConnectionPool(uri, authToken, encryptionManager, connectionPoolSettings, _logger);
        }