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(); } }
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(); } }
public void PoolAcquiring(IListenerEvent listenerEvent) { Interlocked.Increment(ref _acquiring); listenerEvent.Start(); }
public void PoolAcquired(IListenerEvent listenerEvent) { Interlocked.Decrement(ref _acquiring); Interlocked.Increment(ref _acquired); _histogram.RecordValue(listenerEvent.GetElapsed()); }
public void ConnectionReleased(IListenerEvent connEvent) { _inUseTimeHistogram.RecordValue(connEvent.GetElapsed()); }
public void ConnectionAcquired(IListenerEvent connEvent) { connEvent.Start(); }
public void ConnectionConnected(IListenerEvent connEvent) { _connectionTimeHistogram.RecordValue(connEvent.GetElapsed()); }
public void ConnectionConnecting(IListenerEvent connEvent) { connEvent.Start(); }