Class DatagramServerConnector
- All Implemented Interfaces:
Closeable, AutoCloseable, Connector, NetworkConnector, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Graceful, org.eclipse.jetty.util.component.LifeCycle
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Graceful
org.eclipse.jetty.util.component.Graceful.Shutdown, org.eclipse.jetty.util.component.Graceful.ThrowingRunnableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.ListenerNested classes/interfaces inherited from interface NetworkConnector
NetworkConnector.Listener -
Field Summary
Fields inherited from class AbstractConnector
LOGFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
LEGEND -
Constructor Summary
ConstructorsConstructorDescriptionDatagramServerConnector(Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.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()protected voiddoStop()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 org.eclipse.jetty.io.ConnectionnewConnection(org.eclipse.jetty.io.EndPoint endpoint) protected org.eclipse.jetty.io.EndPointnewEndPoint(DatagramChannel channel, org.eclipse.jetty.io.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 org.eclipse.jetty.util.component.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 org.eclipse.jetty.util.component.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 org.eclipse.jetty.util.component.Container
addBean, addBean, addEventListener, getBean, getBeans, getBeans, getCachedBeans, getContainedBeans, getEventListeners, isManaged, manage, removeBean, removeEventListener, unmanageMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dump, dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.util.component.Graceful
isShutdownMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
DatagramServerConnector
-
DatagramServerConnector
public DatagramServerConnector(Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.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
- Overrides:
doStartin classAbstractNetworkConnector- Throws:
Exception
-
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
- Overrides:
doStopin classAbstractNetworkConnector- Throws:
Exception
-
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 org.eclipse.jetty.io.EndPoint newEndPoint(DatagramChannel channel, org.eclipse.jetty.io.ManagedSelector selector, SelectionKey selectionKey) -
newConnection
protected org.eclipse.jetty.io.Connection newConnection(org.eclipse.jetty.io.EndPoint endpoint)
-