java.lang.Object
net.i2p.client.streaming.impl.ConnectionManager.PooledConnection
Enclosing class:
ConnectionManager

private static class ConnectionManager.PooledConnectionextends Object
Wrapper for a pooled connection with metadata.
  • Field Details

    • connection

      final Connection connection
      The pooled connection.
    • pooledAt

      final long pooledAt
      When the connection entered the pool.
    • lastUsed

      final AtomicLong lastUsed
      When the connection was last used.
  • Constructor Details

    • PooledConnection

      PooledConnection(Connection con, long now)
      Puts one connection in the pool.
      Parameters:
      con - the connection to pool
      now - the current time
  • Method Details

    • isStale

      boolean isStale(long maxIdleMs, long now)
      Whether the pooled connection has exceeded max idle time.
      Parameters:
      maxIdleMs - the most time a connection may sit idle, in milliseconds
      now - the current time
      Returns:
      true when idle past the maximum
    • touch

      void touch(long now)
      Update the last-used timestamp.
      Parameters:
      now - the time to record