Class QuicServerConnector
- All Implemented Interfaces:
Closeable, AutoCloseable, Connector, NetworkConnector, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, Graceful, LifeCycle
- Direct Known Subclasses:
HTTP3ServerConnector
A server side network connector that uses a DatagramChannel to listen on a network port for QUIC traffic.
This connector uses ConnectionFactorys to configure the protocols to be transported by QUIC.
The protocol is negotiated during the connection establishment by QuicSession, and for each QUIC stream
managed by a QuicSession a ConnectionFactory is used to create a Connection for the
correspondent QuicStreamEndPoint.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface Graceful
Graceful.Shutdown, Graceful.ThrowingRunnableNested classes/interfaces inherited from interface LifeCycle
LifeCycle.ListenerNested classes/interfaces inherited from interface NetworkConnector
NetworkConnector.Listener -
Field Summary
Fields inherited from class AbstractConnector
LOG -
Constructor Summary
ConstructorsConstructorDescriptionQuicServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, ServerQuicConfiguration quicConfiguration, ConnectionFactory... factories) QuicServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) Deprecated, for removal: This API element is subject to removal in a future version.QuicServerConnector(Server server, ServerQuicConfiguration quicConfiguration, ConnectionFactory... factories) QuicServerConnector(Server server, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(int acceptorID) voidclose()Performs the activities needed to close the network communication (for example, to stop accepting network connections).protected voiddoStart()Starts the managed lifecycle beans in the order they were added.protected voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.intintintGet the underlying socket, channel, buffer etc. for the connector..booleanisOpen()A Connector may be opened and not started (to reserve a port) or closed and running (to allow graceful shutdown of existing connections)booleanbooleanprotected ServerQuicConnectionnewConnection(EndPoint endpoint) protected EndPointnewEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey selectionKey) voidopen()Performs the activities needed to open the network communication (for example, to start accepting incoming network connections).protected DatagramChannelvoidsetIdleTimeout(long idleTimeout) Sets the maximum Idle time for a connection, which roughly translates to theSocket.setSoTimeout(int)call, although with NIO implementations other mechanisms may be used to implement the timeout.voidsetInputBufferSize(int inputBufferSize) voidsetOutputBufferSize(int outputBufferSize) voidsetUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) voidsetUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) shutdown()Shutdown the component.Methods inherited from class AbstractNetworkConnector
getHost, getPort, handleAcceptFailure, setHost, setPort, toStringMethods inherited from class AbstractConnector
addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, getShutdownIdleTimeout, interruptAcceptors, isAccepting, isShutdown, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAccepting, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setName, setShutdownIdleTimeoutMethods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Connector
getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServerMethods inherited from interface Container
addBean, addBean, addEventListener, getBean, getBeans, getBeans, getCachedBeans, getContainedBeans, getEventListeners, isManaged, manage, removeBean, removeEventListener, unmanageMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Graceful
isShutdownMethods inherited from interface LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
QuicServerConnector
@Deprecated(since="12.0.7", forRemoval=true) public QuicServerConnector(Server server, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
server- theServersslContextFactory- theSslContextFactory.Serverfactories- theConnectionFactorys of the protocols transported by QUIC
-
QuicServerConnector
public QuicServerConnector(Server server, ServerQuicConfiguration quicConfiguration, ConnectionFactory... factories) -
QuicServerConnector
@Deprecated(since="12.0.7", forRemoval=true) public QuicServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
server- theServerexecutor- theExecutorscheduler- theSchedulerbufferPool- theByteBufferPoolsslContextFactory- theSslContextFactory.Serverfactories- theConnectionFactorys of the protocols transported by QUIC
-
QuicServerConnector
public QuicServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, ServerQuicConfiguration quicConfiguration, ConnectionFactory... factories)
-
-
Method Details
-
getQuicConfiguration
-
getLocalPort
public int getLocalPort()- Specified by:
getLocalPortin interfaceNetworkConnector- Overrides:
getLocalPortin classAbstractNetworkConnector- Returns:
- The actual port the connector is listening on, or -1 if it has not been opened, or -2 if it has been closed.
-
getInputBufferSize
public int getInputBufferSize() -
setInputBufferSize
public void setInputBufferSize(int inputBufferSize) -
getOutputBufferSize
public int getOutputBufferSize() -
setOutputBufferSize
public void setOutputBufferSize(int outputBufferSize) -
isUseInputDirectByteBuffers
public boolean isUseInputDirectByteBuffers() -
setUseInputDirectByteBuffers
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) -
isUseOutputDirectByteBuffers
public boolean isUseOutputDirectByteBuffers() -
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
isOpen
public boolean isOpen()Description copied from interface:NetworkConnectorA Connector may be opened and not started (to reserve a port) or closed and running (to allow graceful shutdown of existing connections)- Returns:
- True if the connector is Open.
-
doStart
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classAbstractNetworkConnector- Throws:
Exception- If there was a problem starting. Will cause a transition to FAILED state
-
open
Description copied from interface:NetworkConnectorPerforms the activities needed to open the network communication (for example, to start accepting incoming network connections).
Implementation must be idempotent.
- Specified by:
openin interfaceNetworkConnector- Overrides:
openin classAbstractNetworkConnector- Throws:
IOException- if this connector cannot be opened- See Also:
-
openDatagramChannel
- Throws:
IOException
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout) Description copied from class:AbstractConnectorSets the maximum Idle time for a connection, which roughly translates to the
Socket.setSoTimeout(int)call, although with NIO implementations other mechanisms may be used to implement the timeout.The max idle time is applied:
- When waiting for a new message to be received on a connection
- When waiting for a new message to be sent on a connection
This value is interpreted as the maximum time between some progress being made on the connection. So if a single byte is read or written, then the timeout is reset.
- Overrides:
setIdleTimeoutin classAbstractConnector- Parameters:
idleTimeout- the idle timeout
-
doStop
Description copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin classAbstractNetworkConnector- Throws:
Exception- If there was a problem stopping. Will cause a transition to FAILED state
-
close
public void close()Description copied from interface:NetworkConnectorPerforms the activities needed to close the network communication (for example, to stop accepting network connections).
Once a connector has been closed, it cannot be opened again without first calling
LifeCycle.stop()and it will not be active again until a subsequent call toLifeCycle.start().Implementation must be idempotent.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceNetworkConnector- Overrides:
closein classAbstractNetworkConnector
-
shutdown
Description copied from interface:GracefulShutdown the component. When this method returns, the component should not accept any new load.- Specified by:
shutdownin interfaceGraceful- Overrides:
shutdownin classAbstractNetworkConnector- Returns:
- A future that is completed once all load on the component is completed
-
getTransport
-
accept
protected void accept(int acceptorID) - Specified by:
acceptin classAbstractConnector
-
newEndPoint
protected EndPoint newEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey selectionKey) -
newConnection
-
QuicServerConnector(Server, Executor, Scheduler, ByteBufferPool, ServerQuicConfiguration, ConnectionFactory...)instead