public final class UDPNIOTransport extends NIOTransport implements FilterChainEnabledTransport
| Modifier and Type | Class and Description |
|---|---|
protected class |
UDPNIOTransport.RegisterChannelCompletionHandler |
protected class |
UDPNIOTransport.TransportConnectorHandler
Transport default
UDPNIOConnectorHandler. |
Transport.State| Modifier and Type | Field and Description |
|---|---|
protected AsyncQueueIO<SocketAddress> |
asyncQueueIO
Transport AsyncQueueIO
|
static ChannelConfigurator |
DEFAULT_CHANNEL_CONFIGURATOR
Default
ChannelConfigurator used to configure client and server side
channels. |
protected UDPNIOTransport.RegisterChannelCompletionHandler |
registerChannelCompletionHandler |
protected Collection<UDPNIOServerConnection> |
serverConnections
The Server connections.
|
channelConfigurator, DEFAULT_CLIENT_SOCKET_SO_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_OPTIMIZED_FOR_MULTIPLEXING, DEFAULT_REUSE_ADDRESS, DEFAULT_SELECTOR_RUNNER_COUNT, DEFAULT_SERVER_SOCKET_SO_TIMEOUT, nioChannelDistributor, selectionKeyHandler, selectorHandler, selectorProvider, selectorRunners, shutdownFuture, shutdownListeners, shutdownService, temporarySelectorIOattributeBuilder, connectionMonitoringConfig, isBlocking, isStandalone, kernelPool, kernelPoolConfig, managedWorkerPool, memoryManager, name, processor, processorSelector, readBufferSize, readTimeout, state, strategy, threadPoolMonitoringConfig, transportMonitoringConfig, workerPoolConfig, workerThreadPool, writeBufferSize, writeTimeoutDEFAULT_READ_BUFFER_SIZE, DEFAULT_READ_TIMEOUT, DEFAULT_WRITE_BUFFER_SIZE, DEFAULT_WRITE_TIMEOUT| Constructor and Description |
|---|
UDPNIOTransport() |
UDPNIOTransport(String name) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addShutdownListener(GracefulShutdownListener shutdownListener)
Adds a
GracefulShutdownListener which will be called when Transport.shutdown()
is called to enable graceful shutdown of transports. |
UDPNIOServerConnection |
bind(int port)
Binds Transport to the specific port on localhost.
|
UDPNIOServerConnection |
bind(SocketAddress socketAddress)
Binds Transport to the specific SocketAddress.
|
UDPNIOServerConnection |
bind(SocketAddress socketAddress,
int backlog)
Binds Transport to the specific SocketAddress.
|
UDPNIOServerConnection |
bind(String host,
int port)
Binds Transport to the specific host and port.
|
UDPNIOServerConnection |
bind(String host,
int port,
int backlog)
Binds Transport to the specific host and port.
|
UDPNIOServerConnection |
bind(String host,
PortRange portRange,
int backlog)
Binds Transport to the specific host, and port within a
PortRange. |
Connection |
bindToInherited()
Binds the Transport to the channel inherited from the entity that
created this Java virtual machine.
|
protected void |
closeConnection(Connection connection)
Close the connection, managed by Transport
|
void |
configureStandalone(boolean isStandalone) |
GrizzlyFuture<Connection> |
connect()
Creates non-connected UDP
Connection. |
GrizzlyFuture<Connection> |
connect(SocketAddress remoteAddress)
Creates, initializes and connects socket to the specific
SocketAddress and returns Connection, representing socket. |
void |
connect(SocketAddress remoteAddress,
CompletionHandler<Connection> completionHandler)
Creates, initializes and connects socket to the specific
SocketAddress and returns Connection, representing socket. |
GrizzlyFuture<Connection> |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Creates, initializes socket, binds it to the specific local and remote
SocketAddress and returns Connection, representing socket. |
void |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
CompletionHandler<Connection> completionHandler)
Creates, initializes socket, binds it to the specific local and remote
SocketAddress and returns Connection, representing socket. |
GrizzlyFuture<Connection> |
connect(String host,
int port)
Creates, initializes and connects socket to the specific remote host
and port and returns
Connection, representing socket. |
protected Object |
createJmxManagementObject()
Create the Transport JMX management object.
|
protected TemporarySelectorIO |
createTemporarySelectorIO() |
void |
fireIOEvent(IOEvent ioEvent,
Connection connection,
IOEventLifeCycleListener listener)
Fires specific
IOEvent on the Connection |
AsyncQueueIO |
getAsyncQueueIO()
Get asynchronous queue implementation.
|
ChannelConfigurator |
getChannelConfigurator() |
Reader |
getReader(boolean isBlocking)
Get the
Reader implementation, depending on the requested mode. |
Reader |
getReader(Connection connection)
Get the
Reader to read data from the Connection. |
TemporarySelectorIO |
getTemporarySelectorIO() |
Filter |
getTransportFilter()
Get transport
Filter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connection streams. |
Writer |
getWriter(boolean isBlocking)
Get the
Writer implementation, depending on the requested mode. |
Writer |
getWriter(Connection connection)
Get the
Writer to write data to the Connection. |
protected void |
listen() |
int |
read(UDPNIOConnection connection,
Buffer buffer) |
int |
read(UDPNIOConnection connection,
Buffer buffer,
ReadResult<Buffer,SocketAddress> currentResult) |
void |
unbind(Connection connection)
Unbinds bound
Transport connection. |
void |
unbindAll()
Unbinds all bound
Transport connections. |
long |
write(UDPNIOConnection connection,
SocketAddress dstAddress,
WritableMessage message) |
long |
write(UDPNIOConnection connection,
SocketAddress dstAddress,
WritableMessage message,
WriteResult<WritableMessage,SocketAddress> currentResult) |
configureNIOConnection, createShutdownExecutorService, finalizeShutdown, getClientSocketSoTimeout, getConnectionTimeout, getDefaultSelectorRunnersCount, getNIOChannelDistributor, getSelectionKeyHandler, getSelectorHandler, getSelectorProvider, getSelectorRunners, getSelectorRunnersCount, getServerSocketSoTimeout, isOptimizedForMultiplexing, isReuseAddress, notifyProbesError, notifyProbesPause, notifyProbesResume, notifyProbesStart, notifyProbesStop, notifyTransportError, pause, resume, setChannelConfigurator, setClientSocketSoTimeout, setConnectionTimeout, setNIOChannelDistributor, setOptimizedForMultiplexing, setReuseAddress, setSelectionKeyHandler, setSelectorHandler, setSelectorProvider, setSelectorRunnersCount, setServerSocketSoTimeout, shutdown, shutdown, shutdownNow, start, startSelectorRunners, stopSelectorRunnersconfigureBlocking, getAttributeBuilder, getConnectionMonitoringConfig, getIOStrategy, getKernelThreadPool, getKernelThreadPoolConfig, getMemoryManager, getMonitoringConfig, getName, getProcessor, getProcessorSelector, getReadBufferSize, getReadTimeout, getState, getThreadPoolMonitoringConfig, getWorkerThreadPool, getWorkerThreadPoolConfig, getWriteBufferSize, getWriteTimeout, isBlocking, isPaused, isStandalone, isStopped, notifyProbesBeforePause, notifyProbesBeforeResume, notifyProbesBeforeStart, notifyProbesBeforeStop, notifyProbesConfigChanged, notifyProbesPause, notifyProbesStop, obtainProcessor, setAttributeBuilder, setIOStrategy, setKernelPool0, setKernelThreadPool, setKernelThreadPoolConfig, setMemoryManager, setName, setProcessor, setProcessorSelector, setReadBufferSize, setReadTimeout, setWorkerThreadPool, setWorkerThreadPool0, setWorkerThreadPoolConfig, setWriteBufferSize, setWriteTimeout, stoppublic static final ChannelConfigurator DEFAULT_CHANNEL_CONFIGURATOR
ChannelConfigurator used to configure client and server side
channels.protected final Collection<UDPNIOServerConnection> serverConnections
protected final AsyncQueueIO<SocketAddress> asyncQueueIO
protected final UDPNIOTransport.RegisterChannelCompletionHandler registerChannelCompletionHandler
public UDPNIOTransport()
public UDPNIOTransport(String name)
protected TemporarySelectorIO createTemporarySelectorIO()
createTemporarySelectorIO in class NIOTransportprotected void listen()
listen in class NIOTransportpublic boolean addShutdownListener(GracefulShutdownListener shutdownListener)
TransportGracefulShutdownListener which will be called when Transport.shutdown()
is called to enable graceful shutdown of transports. This allows the
owner of the listener to signal that all shutdown tasks are complete and
that it's safe to finalize the termination of the transportaddShutdownListener in interface TransportaddShutdownListener in class NIOTransportshutdownListener - the GracefulShutdownListenertrue if the listener was successfully registered,
otherwise false. When this method returns false
it means one of two things: the transport is stopping or is stopped, or
the listener has already been registered.public UDPNIOServerConnection bind(int port) throws IOException
bind in interface SocketBinderConnectionIOExceptionpublic UDPNIOServerConnection bind(String host, int port) throws IOException
bind in interface SocketBinderhost - the local host the server will bind toConnectionIOExceptionpublic UDPNIOServerConnection bind(String host, int port, int backlog) throws IOException
bind in interface SocketBinderhost - the local host the server will bind tobacklog - the maximum length of the queueConnectionIOExceptionpublic UDPNIOServerConnection bind(SocketAddress socketAddress) throws IOException
bind in interface SocketBindersocketAddress - the local address the server will bind toConnectionIOExceptionpublic UDPNIOServerConnection bind(SocketAddress socketAddress, int backlog) throws IOException
bind in interface SocketBindersocketAddress - the local address the server will bind tobacklog - the maximum length of the queueConnectionIOExceptionpublic Connection bindToInherited() throws IOException
SocketBinderbindToInherited in interface SocketBinderConnectionIOExceptionpublic UDPNIOServerConnection bind(String host, PortRange portRange, int backlog) throws IOException
PortRange.bind in interface SocketBinderhost - the local host the server will bind toportRange - PortRange.backlog - the maximum length of the queueConnectionIOExceptionpublic void unbind(Connection connection)
Transport connection.unbind in interface SocketBinderconnection - Connectionpublic void unbindAll()
SocketBinderTransport connections.unbindAll in interface SocketBinderunbindAll in class NIOTransportpublic GrizzlyFuture<Connection> connect() throws IOException
Connection.Connection.IOExceptionpublic GrizzlyFuture<Connection> connect(String host, int port) throws IOException
Connection, representing socket.connect in interface SocketConnectorHandlerhost - remote host to connect to.port - remote port to connect to.GrizzlyFuture of connect operation, which could be used to get
resulting Connection.IOExceptionpublic GrizzlyFuture<Connection> connect(SocketAddress remoteAddress)
SocketAddress and returns Connection, representing socket.connect in interface ConnectorHandler<SocketAddress>remoteAddress - remote address to connect to.GrizzlyFuture of connect operation, which could be used to get
resulting Connection.IOExceptionpublic void connect(SocketAddress remoteAddress, CompletionHandler<Connection> completionHandler)
SocketAddress and returns Connection, representing socket.connect in interface ConnectorHandler<SocketAddress>remoteAddress - remote address to connect to.completionHandler - CompletionHandler.public GrizzlyFuture<Connection> connect(SocketAddress remoteAddress, SocketAddress localAddress)
SocketAddress and returns Connection, representing socket.connect in interface ConnectorHandler<SocketAddress>remoteAddress - remote address to connect to.localAddress - local address to bind socket to.GrizzlyFuture of connect operation, which could be used to get
resulting Connection.public void connect(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler)
SocketAddress and returns Connection, representing socket.connect in interface ConnectorHandler<SocketAddress>remoteAddress - remote address to connect to.localAddress - local address to bind socket to.completionHandler - CompletionHandler.protected void closeConnection(Connection connection) throws IOException
AbstractTransportcloseConnection in class NIOTransportIOExceptionpublic void configureStandalone(boolean isStandalone)
configureStandalone in interface Transportpublic Filter getTransportFilter()
FilterChainEnabledTransportFilter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connection streams.
Each Transport should provide transport Filter
implementation.getTransportFilter in interface FilterChainEnabledTransportFilter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connections.public AsyncQueueIO getAsyncQueueIO()
AsyncQueueEnabledTransportgetAsyncQueueIO in interface AsyncQueueEnabledTransportpublic TemporarySelectorIO getTemporarySelectorIO()
getTemporarySelectorIO in interface TemporarySelectorsEnabledTransportgetTemporarySelectorIO in class NIOTransportpublic void fireIOEvent(IOEvent ioEvent, Connection connection, IOEventLifeCycleListener listener)
TransportIOEvent on the ConnectionfireIOEvent in interface TransportioEvent - I/O eventconnection - Connection, on which we fire the event.listener - I/O event life-cycle listener.public Reader getReader(Connection connection)
Reader to read data from the Connection.
The Transport may decide to return blocking or non-blocking Reader
depending on the Connection settings.getReader in interface Transportconnection - Connection.Reader.public Reader getReader(boolean isBlocking)
Reader implementation, depending on the requested mode.public Writer getWriter(Connection connection)
Writer to write data to the Connection.
The Transport may decide to return blocking or non-blocking Writer
depending on the Connection settings.getWriter in interface Transportconnection - Connection.Writer.public Writer getWriter(boolean isBlocking)
Writer implementation, depending on the requested mode.public int read(UDPNIOConnection connection, Buffer buffer) throws IOException
IOExceptionpublic int read(UDPNIOConnection connection, Buffer buffer, ReadResult<Buffer,SocketAddress> currentResult) throws IOException
IOExceptionpublic long write(UDPNIOConnection connection, SocketAddress dstAddress, WritableMessage message) throws IOException
IOExceptionpublic long write(UDPNIOConnection connection, SocketAddress dstAddress, WritableMessage message, WriteResult<WritableMessage,SocketAddress> currentResult) throws IOException
IOExceptionpublic ChannelConfigurator getChannelConfigurator()
getChannelConfigurator in class NIOTransportSelectableChannel
configurationprotected Object createJmxManagementObject()
createJmxManagementObject in class AbstractTransportCopyright © 2012-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.