Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.nio.transport

public final Class UDPNIOTransport

extends NIOTransport
implements FilterChainEnabledTransport
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.filterchain.FilterChainEnabledTransport
Imports
java.io.IOException, java.net.DatagramSocket, .InetSocketAddress, .SocketAddress, .StandardSocketOptions, java.nio.ByteBuffer, java.nio.channels.DatagramChannel, .SelectableChannel, .SelectionKey, java.util.Collection, .HashSet, java.util.concurrent.ConcurrentLinkedQueue, .TimeUnit, java.util.concurrent.locks.Lock, java.util.logging.Level, .Logger, org.glassfish.grizzly.Buffer, .Closeable, .CompletionHandler, .Connection, .Context, .EmptyCompletionHandler, .FileChunk, .GracefulShutdownListener, .Grizzly, .GrizzlyFuture, .IOEvent, .IOEventLifeCycleListener, .PortRange, .Processor, .ProcessorExecutor, .ProcessorSelector, .ReadResult, .Reader, .StandaloneProcessor, .StandaloneProcessorSelector, .WriteResult, .Writer, org.glassfish.grizzly.asyncqueue.AsyncQueueIO, .AsyncQueueReader, .AsyncQueueWriter, .WritableMessage, org.glassfish.grizzly.filterchain.Filter, .FilterChainEnabledTransport, org.glassfish.grizzly.impl.FutureImpl, org.glassfish.grizzly.localization.LogMessages, org.glassfish.grizzly.memory.ByteBufferArray, org.glassfish.grizzly.monitoring.MonitoringUtils, org.glassfish.grizzly.nio.ChannelConfigurator, .DirectByteBufferRecord, .NIOConnection, .NIOTransport, .RegisterChannelResult, .SelectorRunner, org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorIO, org.glassfish.grizzly.utils.Futures

UDP NIO transport implementation
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
protected class
protected class

Field Summary

Modifier and TypeField and Description
protected final AsyncQueueIO<SocketAddress>
asyncQueueIO

Transport AsyncQueueIO

private final UDPNIOBindingHandler
private final UDPNIOConnectorHandler
public static final ChannelConfigurator
DEFAULT_CHANNEL_CONFIGURATOR

Default ChannelConfigurator used to configure client and server side channels.

private static final String
pack-priv static final Logger
protected final UDPNIOTransport.RegisterChannelCompletionHandler
protected final Collection<UDPNIOServerConnection>
serverConnections

The Server connections.

private final Filter
transportFilter

Server socket backlog.

Inherited from org.glassfish.grizzly.nio.NIOTransport:
channelConfiguratorDEFAULT_CLIENT_SOCKET_SO_TIMEOUTDEFAULT_CONNECTION_TIMEOUTDEFAULT_OPTIMIZED_FOR_MULTIPLEXINGDEFAULT_REUSE_ADDRESSDEFAULT_REUSE_PORTDEFAULT_SELECTOR_RUNNER_COUNTDEFAULT_SERVER_SOCKET_SO_TIMEOUTnioChannelDistributorselectionKeyHandlerselectorHandlerselectorProviderselectorRunnersshutdownFutureshutdownListenersshutdownServicetemporarySelectorIO

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public synchronized boolean
addShutdownListener(GracefulShutdownListener shutdownListener)

Overrides org.glassfish.grizzly.nio.NIOTransport.addShutdownListener.

Implements org.glassfish.grizzly.Transport.addShutdownListener.

Adds a GracefulShutdownListener which will be called when shutdown() is called to enable graceful shutdown of transports.

public UDPNIOServerConnection
bind(int port)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific port on localhost.

public UDPNIOServerConnection
bind(String host, int port)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific host and port.

public UDPNIOServerConnection
bind(String host, int port, int backlog)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific host and port.

public UDPNIOServerConnection
bind(SocketAddress socketAddress)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific SocketAddress.

public UDPNIOServerConnection
bind(SocketAddress socketAddress, int backlog)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific SocketAddress.

public UDPNIOServerConnection
bind(final String host, final PortRange portRange, final int backlog)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific host, and port within a PortRange.

public UDPNIOServerConnection
bind(final String host, final PortRange portRange, final boolean randomStartPort, final int backlog)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific host, and port within a PortRange.

public Connection<?>
bindToInherited()

Implements org.glassfish.grizzly.SocketBinder.bindToInherited.

Binds the Transport to the channel inherited from the entity that created this Java virtual machine.

protected void
closeConnection(final Connection<L> connection)

Implements abstract org.glassfish.grizzly.nio.NIOTransport.closeConnection.

Close the connection, managed by Transport

public synchronized void
public GrizzlyFuture<Connection<L>>

Returns:

non-connected UDP Connection.
connect
()

Creates non-connected UDP Connection.

public GrizzlyFuture<Connection<L>>

Returns:

GrizzlyFuture of connect operation, which could be used to get resulting Connection.
connect
(String
remote host to connect to.
host
,
int
remote port to connect to.
port
)

Implements org.glassfish.grizzly.SocketConnectorHandler.connect.

Creates, initializes and connects socket to the specific remote host and port and returns Connection, representing socket.

public GrizzlyFuture<Connection<L>>

Returns:

GrizzlyFuture of connect operation, which could be used to get resulting Connection.
connect
(SocketAddress
remote address to connect to.
remoteAddress
)

Implements org.glassfish.grizzly.ConnectorHandler.connect.

Creates, initializes and connects socket to the specific SocketAddress and returns Connection, representing socket.

public void
connect(SocketAddress
remote address to connect to.
remoteAddress
,
CompletionHandler<Connection<L>> completionHandler)

Implements org.glassfish.grizzly.ConnectorHandler.connect, org.glassfish.grizzly.ConnectorHandler.connect.

Creates, initializes and connects socket to the specific SocketAddress and returns Connection, representing socket.

public GrizzlyFuture<Connection<L>>

Returns:

GrizzlyFuture of connect operation, which could be used to get resulting Connection.
connect
(SocketAddress
remote address to connect to.
remoteAddress
,
SocketAddress
local address to bind socket to.
localAddress
)

Implements org.glassfish.grizzly.ConnectorHandler.connect.

Creates, initializes socket, binds it to the specific local and remote SocketAddress and returns Connection, representing socket.

public void
connect(SocketAddress
remote address to connect to.
remoteAddress
,
SocketAddress
local address to bind socket to.
localAddress
,
CompletionHandler<Connection<L>> completionHandler)

Implements org.glassfish.grizzly.ConnectorHandler.connect.

Creates, initializes socket, binds it to the specific local and remote SocketAddress and returns Connection, representing socket.

protected Object
createJmxManagementObject()

Implements abstract org.glassfish.grizzly.AbstractTransport.createJmxManagementObject.

Create the Transport JMX management object.

protected TemporarySelectorIO
public void
fireIOEvent(final IOEvent ioEvent, final Connection<L> connection, final IOEventLifeCycleListener listener)

Implements org.glassfish.grizzly.Transport.fireIOEvent.

Fires specific IOEvent on the Connection

public AsyncQueueIO<L>
public ChannelConfigurator
public Reader<L>
getReader(final Connection<L> connection)

Implements org.glassfish.grizzly.Transport.getReader.

Get the Reader to read data from the Connection.

public Reader<L>
getReader(final boolean isBlocking)

Implements org.glassfish.grizzly.Transport.getReader.

Get the Reader implementation, depending on the requested mode.

public TemporarySelectorIO
public Filter
public Writer<L>
getWriter(final Connection<L> connection)

Implements org.glassfish.grizzly.Transport.getWriter.

Get the Writer to write data to the Connection.

public Writer<L>
getWriter(final boolean isBlocking)

Implements org.glassfish.grizzly.Transport.getWriter.

Get the Writer implementation, depending on the requested mode.

protected void
pack-priv UDPNIOConnection
pack-priv UDPNIOServerConnection
public int
read(final UDPNIOConnection connection, final Buffer buffer)

public int
read(final UDPNIOConnection connection, Buffer buffer, final ReadResult<Buffer, SocketAddress> currentResult)

private int
readConnected(final UDPNIOConnection connection, Buffer buffer, final ReadResult<Buffer, SocketAddress> currentResult)

private int
readNonConnected(final UDPNIOConnection connection, Buffer buffer, final ReadResult<Buffer, SocketAddress> currentResult)

public void
unbind(final Connection<L> connection)

Implements org.glassfish.grizzly.SocketBinder.unbind.

Unbinds bound Transport connection.

public void
public long
write(final UDPNIOConnection connection, final SocketAddress dstAddress, final WritableMessage message)

public long
write(final UDPNIOConnection connection, final SocketAddress dstAddress, final WritableMessage message, final WriteResult<WritableMessage, SocketAddress> currentResult)

Inherited from org.glassfish.grizzly.nio.NIOTransport:
configureNIOConnectioncreateShutdownExecutorServicefinalizeShutdowngetClientSocketSoTimeoutgetConnectionTimeoutgetDefaultSelectorRunnersCountgetNIOChannelDistributorgetSelectionKeyHandlergetSelectorHandlergetSelectorProvidergetSelectorRunnersgetSelectorRunnersCountgetServerSocketSoTimeoutisOptimizedForMultiplexingisReuseAddressisReusePortisReusePortAvailablenotifyProbesErrornotifyProbesPausenotifyProbesResumenotifyProbesStartnotifyProbesStopnotifyTransportErrorpauseresumesetChannelConfiguratorsetClientSocketSoTimeoutsetConnectionTimeoutsetNIOChannelDistributorsetOptimizedForMultiplexingsetReuseAddresssetReusePortsetSelectionKeyHandlersetSelectorHandlersetSelectorProvidersetSelectorRunnersCountsetServerSocketSoTimeoutshutdownshutdownshutdownNowstartstartSelectorRunnersstopSelectorRunners