Class QuicheTripConnectionPool

All Implemented Interfaces:
Pool<Connection>

public class QuicheTripConnectionPool extends AbstractConnectionPool
The QUIC client connection pool.

All pooled connections are streams multiplexed over a single QUIC connection. Since that connection is discarded silently by both peers as soon as it stays idle for longer than the QUIC max idle timeout (see QuicheTripTransport.getMaxIdleSeconds()), which is way shorter than the pool's idle timeout, it is kept alive by sending ack-eliciting packets. Otherwise, the pool would hand out connections belonging to a QUIC connection that is long gone.

Because each pooled connection holds one of the streams the peer allows for the whole time it is in the pool, the pool's maximum size defaults to QuicheTripTransport.getMaxStreams() instead of being unlimited.

  • Field Details

    • DEFAULT_CONNECT_TIMEOUT

      public static final int DEFAULT_CONNECT_TIMEOUT
      The default connect timeout in seconds, applied if the URI does not specify connecttimeout.

      This is the timeout for establishing the QUIC connection, i.e., the handshake with the server, not for the individual streams created per pool slot.

      See Also:
  • Constructor Details

    • QuicheTripConnectionPool

      public QuicheTripConnectionPool(QuicheTripTransport transport, Dictionary dictionary)
      Creates a QUIC connection pool.
      Parameters:
      transport - the transport associated with this pool
      dictionary - the dictionary associated with this pool
  • Method Details

    • shutdown

      public void shutdown()
      Shuts down the pool.

      Deliberately not synchronized: AbstractPool.shutdown() closes the pooled connections without holding the pool's monitor, on purpose, since it waits for each of them. Only accessing the QUIC connection needs the monitor.

      Specified by:
      shutdown in interface Pool<Connection>
      Overrides:
      shutdown in class AbstractPool<Connection>
    • createSlot

      protected PoolSlot<Connection> createSlot(int slotNumber)
      Description copied from class: AbstractPool
      Creates a new slot.
      Specified by:
      createSlot in class AbstractPool<Connection>
      Parameters:
      slotNumber - the slot number, starting at 0
      Returns:
      the slot
    • connect

      protected void connect()
      Establishes the QUIC connection all pooled connections are multiplexed over.
      A previously established connection is closed first.
    • closeConnection

      protected void closeConnection()
      Closes the QUIC connection if there is one.
      Closing is best effort: the connection may be gone already.