コード例 #1
0
        public SocketClient(Uri uri, SocketSettings socketSettings, BufferSettings bufferSettings,
                            IConnectionListener connMetricsListener = null, ILogger logger = null, ITcpSocketClient socketClient = null)
        {
            _uri             = uri;
            _logger          = logger;
            _bufferSettings  = bufferSettings;
            _tcpSocketClient = socketClient ?? new TcpSocketClient(socketSettings, _logger);

            _connMetricsListener = connMetricsListener;
            if (_connMetricsListener != null)
            {
                _connEvent = new SimpleTimerEvent();
            }
        }
コード例 #2
0
        public PooledConnection(IConnection conn, IConnectionReleaseManager releaseManager = null,
                                IConnectionListener connMetricsListener = null)
            : base(conn)
        {
            _releaseManager = releaseManager;
            // IdleTimer starts to count when the connection is put back to the pool.
            IdleTimer = new StopwatchBasedTimer();
            // LifetimeTimer starts to count once the connection is created.
            LifetimeTimer = new StopwatchBasedTimer();
            LifetimeTimer.Start();

            _connMetricsListener = connMetricsListener;
            if (_connMetricsListener != null)
            {
                _connEvent = new SimpleTimerEvent();
            }
        }
コード例 #3
0
 public void PoolAcquiring(IListenerEvent listenerEvent)
 {
     Interlocked.Increment(ref _acquiring);
     listenerEvent.Start();
 }
コード例 #4
0
 public void PoolAcquired(IListenerEvent listenerEvent)
 {
     Interlocked.Decrement(ref _acquiring);
     Interlocked.Increment(ref _acquired);
     _histogram.RecordValue(listenerEvent.GetElapsed());
 }
コード例 #5
0
 public void ConnectionReleased(IListenerEvent connEvent)
 {
     _inUseTimeHistogram.RecordValue(connEvent.GetElapsed());
 }
コード例 #6
0
 public void ConnectionAcquired(IListenerEvent connEvent)
 {
     connEvent.Start();
 }
コード例 #7
0
 public void ConnectionConnected(IListenerEvent connEvent)
 {
     _connectionTimeHistogram.RecordValue(connEvent.GetElapsed());
 }
コード例 #8
0
 public void ConnectionConnecting(IListenerEvent connEvent)
 {
     connEvent.Start();
 }