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

public final Class TCPNIOTransport

extends NIOTransport
implements AsyncQueueEnabledTransport, FilterChainEnabledTransport, TemporarySelectorsEnabledTransport
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorsEnabledTransport, org.glassfish.grizzly.filterchain.FilterChainEnabledTransport, org.glassfish.grizzly.asyncqueue.AsyncQueueEnabledTransport
Imports
java.io.EOFException, .IOException, java.net.InetSocketAddress, .ServerSocket, .Socket, .SocketAddress, .SocketException, .StandardSocketOptions, java.nio.channels.ClosedByInterruptException, .SelectableChannel, .SelectionKey, .ServerSocketChannel, .SocketChannel, java.util.Collection, java.util.concurrent.ConcurrentLinkedQueue, .TimeUnit, java.util.concurrent.locks.Lock, java.util.logging.Level, .Logger, org.glassfish.grizzly.Buffer, .CloseReason, .CloseType, .CompletionHandler, .Connection, .Context, .EmptyCompletionHandler, .FileChunk, .Grizzly, .GrizzlyFuture, .IOEvent, .IOEventLifeCycleListener, .PortRange, .Processor, .ProcessorExecutor, .ProcessorSelector, .Reader, .StandaloneProcessor, .StandaloneProcessorSelector, .WriteResult, .Writer, org.glassfish.grizzly.asyncqueue.AsyncQueueEnabledTransport, .AsyncQueueIO, .AsyncQueueReader, .AsyncQueueWriter, .WritableMessage, org.glassfish.grizzly.filterchain.Filter, .FilterChainEnabledTransport, org.glassfish.grizzly.localization.LogMessages, org.glassfish.grizzly.memory.CompositeBuffer, org.glassfish.grizzly.monitoring.MonitoringUtils, org.glassfish.grizzly.nio.ChannelConfigurator, .NIOConnection, .NIOTransport, .RegisterChannelResult, .SelectorRunner, org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorIO, .TemporarySelectorsEnabledTransport

TCP Transport NIO implementation
Authors
Alexey Stashok, Jean-Francois Arcand

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final AsyncQueueIO<SocketAddress>
asyncQueueIO

Transport AsyncQueueIO

private final TCPNIOBindingHandler
private final TCPNIOConnectorHandler
public static final ChannelConfigurator
DEFAULT_CHANNEL_CONFIGURATOR

Default ChannelConfigurator used to configure client and server side channels.

public static final boolean
public static final int
public static final int
public static final boolean
private static final String
private final Filter
pack-priv boolean
isKeepAlive

The socket keepAlive mode.

pack-priv int
linger

The socket linger.

pack-priv static final Logger
public static final int
public static final int
pack-priv final TCPNIOTransport.RegisterChannelCompletionHandler
pack-priv int
serverConnectionBackLog

The default server connection backlog size

pack-priv final Collection<TCPNIOServerConnection>
serverConnections

The Server connections.

pack-priv boolean
tcpNoDelay

The socket tcpDelay.

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
pack-priv
TCPNIOTransport(final String name)

Method Summary

Modifier and TypeMethod and Description
public TCPNIOServerConnection
bind(final int port)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific port on localhost.

public TCPNIOServerConnection
bind(final String host, final int port)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific host and port.

public TCPNIOServerConnection
bind(final String host, final int port, final int backlog)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific host and port.

public TCPNIOServerConnection
bind(final SocketAddress socketAddress)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific SocketAddress.

public TCPNIOServerConnection
bind(final SocketAddress socketAddress, final int backlog)

Implements org.glassfish.grizzly.SocketBinder.bind.

Binds Transport to the specific SocketAddress.

public TCPNIOServerConnection
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 TCPNIOServerConnection
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 TCPNIOServerConnection
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:

GrizzlyFuture of connect operation, which could be used to get resulting Connection.
connect
(final String
remote host to connect to.
host
,
final 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
(final 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(final SocketAddress
remote address to connect to.
remoteAddress
,
final 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
(final SocketAddress
remote address to connect to.
remoteAddress
,
final 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(final SocketAddress
remote address to connect to.
remoteAddress
,
final SocketAddress
local address to bind socket to.
localAddress
,
final 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
private static void
failProcessingHandler(final IOEvent ioEvent, final Connection<L> connection, final IOEventLifeCycleListener processingHandler, final IOException e)

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<SocketAddress>
public ChannelConfigurator
protected int
public int
public Reader<SocketAddress>
getReader(final Connection<L> connection)

Implements org.glassfish.grizzly.Transport.getReader.

Get the Reader to read data from the Connection.

public Reader<SocketAddress>
getReader(final boolean isBlocking)

Implements org.glassfish.grizzly.Transport.getReader.

Get the Reader implementation, depending on the requested mode.

public int

Returns:

the default server connection backlog size.
getServerConnectionBackLog
()

Get the default server connection backlog size.

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

Implements org.glassfish.grizzly.Transport.getWriter.

Get the Writer to write data to the Connection.

public Writer<SocketAddress>
getWriter(final boolean isBlocking)

Implements org.glassfish.grizzly.Transport.getWriter.

Get the Writer implementation, depending on the requested mode.

public boolean
public boolean
protected void
pack-priv void
pack-priv TCPNIOConnection
pack-priv TCPNIOServerConnection
public Buffer
read(final Connection<L> connection, Buffer buffer)

private void
rebindAddress(final Connection<L> connection)

public void
setKeepAlive(final boolean isKeepAlive)

public void
setLinger(final int linger)

public void
setServerConnectionBackLog(final int
the default server connection backlog size.
serverConnectionBackLog
)

Set the default server connection backlog size.

public void
setTcpNoDelay(final boolean tcpNoDelay)

public void
unbind(Connection<L> connection)

Implements org.glassfish.grizzly.SocketBinder.unbind.

Unbinds bound Transport connection.

public void
public int
write(final TCPNIOConnection connection, final WritableMessage message)

public int
write(final TCPNIOConnection connection, final WritableMessage message, final WriteResult<K, L> currentResult)

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