Class QuicheTripConnectionPool
- All Implemented Interfaces:
Pool<Connection>
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default connect timeout in seconds, applied if the URI does not specifyconnecttimeout. -
Constructor Summary
ConstructorsConstructorDescriptionQuicheTripConnectionPool(QuicheTripTransport transport, Dictionary dictionary) Creates a QUIC connection pool. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCloses the QUIC connection if there is one.
Closing is best effort: the connection may be gone already.protected voidconnect()Establishes the QUIC connection all pooled connections are multiplexed over.
A previously established connection is closed first.protected PoolSlot<Connection> createSlot(int slotNumber) Creates a new slot.voidshutdown()Shuts down the pool.Methods inherited from class AbstractConnectionPool
createException, createException, getDictionary, getTransportMethods inherited from class AbstractPool
createSlots, get, getIdleMinutes, getIncrementSize, getInitialSize, getMaximumSize, getMinimumSize, getName, getShutdownTimeout, getSize, getUsageMinutes, isShutdown, isSlotRemovable, monitor, put, removePoolable, removeSlotIndex, setIdleMinutes, setIncrementSize, setMaximumSize, setMinimumSize, setShutdownTimeout, setUsageMinutes, toString, unusePoolable
-
Field Details
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUTThe default connect timeout in seconds, applied if the URI does not specifyconnecttimeout.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
Creates a QUIC connection pool.- Parameters:
transport- the transport associated with this pooldictionary- 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:
shutdownin interfacePool<Connection>- Overrides:
shutdownin classAbstractPool<Connection>
-
createSlot
Description copied from class:AbstractPoolCreates a new slot.- Specified by:
createSlotin classAbstractPool<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.
-