Class DatagramServerConnector
- All Implemented Interfaces:
 Closeable, AutoCloseable, Connector, NetworkConnector, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, Graceful, LifeCycle
- Direct Known Subclasses:
 QuicheServerConnector
- 
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.DumpableContainer, Dumpable.DumpAppendableNested 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
ConstructorsConstructorDescriptionDatagramServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, ConnectionFactory... factories) DatagramServerConnector(Server server, ConnectionFactory... factories)  - 
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.intGet 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)protected ConnectionnewConnection(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.Methods inherited from class AbstractNetworkConnector
getHost, getPort, handleAcceptFailure, setHost, setPort, shutdown, 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
- 
DatagramServerConnector
 - 
DatagramServerConnector
public DatagramServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, ConnectionFactory... factories)  
 - 
 - 
Method Details
- 
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.
 
 - 
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
 - 
getTransport
 - 
accept
protected void accept(int acceptorID) - Specified by:
 acceptin classAbstractConnector
 - 
newEndPoint
protected EndPoint newEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey selectionKey)  - 
newConnection
 
 -