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

public Class TCPNIOConnectorHandler

extends AbstractSocketConnectorHandler
Class Inheritance
Known Direct Subclasses
org.glassfish.grizzly.nio.transport.TCPNIOTransport.TransportConnectorHandler
Imports
java.io.IOException, java.net.Socket, .SocketAddress, .StandardSocketOptions, java.nio.channels.SelectionKey, .SocketChannel, java.util.concurrent.TimeUnit, .TimeoutException, java.util.logging.Level, .Logger, org.glassfish.grizzly.AbstractSocketConnectorHandler, .CompletionHandler, .Connection, .Context, .EmptyCompletionHandler, .Grizzly, .IOEvent, .IOEventLifeCycleListener, org.glassfish.grizzly.impl.FutureImpl, .ReadyFutureImpl, org.glassfish.grizzly.localization.LogMessages, org.glassfish.grizzly.nio.NIOChannelDistributor, .RegisterChannelResult, .SelectionKeyHandler, org.glassfish.grizzly.utils.Exceptions, .Futures

TCP NIO transport client side ConnectorHandler implementation
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class
private class
private static class

Field Summary

Modifier and TypeField and Description
protected volatile long
protected static final int
private final TCPNIOConnectorHandler.InstantConnectHandler
protected boolean
protected boolean
private static final Logger
Inherited from org.glassfish.grizzly.AbstractSocketConnectorHandler:
probestransport

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private static void
abortConnection(final TCPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler, final Throwable failure)

public static TCPNIOConnectorHandler.Builder

Returns:

the TCPNIOConnectorHandler builder.
builder
(final TCPNIOTransport transport)

Return the TCPNIOConnectorHandler builder.

public void
connect(final SocketAddress remoteAddress, final SocketAddress localAddress, final CompletionHandler<Connection<L>> completionHandler)

Overrides org.glassfish.grizzly.AbstractSocketConnectorHandler.connect.

Implements org.glassfish.grizzly.ConnectorHandler.connect.

Creates, initializes Connection, binds it to the specific local and remote remoteAddress.

protected FutureImpl<Connection<L>>
connectAsync(final SocketAddress remoteAddress, final SocketAddress localAddress, final CompletionHandler<Connection<L>> completionHandler, final boolean needFuture)

Implements abstract org.glassfish.grizzly.AbstractSocketConnectorHandler.connectAsync.

protected void
connectSync(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection<L>> completionHandler)

public long
public boolean
public boolean
protected static void
onConnectedAsync(final TCPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler)

public void
setReuseAddress(boolean isReuseAddress)

public void
setReusePort(boolean isReusePort)

public void
setSyncConnectTimeout(final long timeout, final TimeUnit timeUnit)

protected void
waitNIOFuture(final FutureImpl<Connection<L>> future, final CompletionHandler<Connection<L>> completionHandler)

Inherited from org.glassfish.grizzly.AbstractSocketConnectorHandler:
addMonitoringProbeconnectconnectconnectconnectgetMonitoringProbesgetProcessorgetProcessorSelectormakeCancellableFuturepreConfigureremoveMonitoringProbesetProcessorsetProcessorSelector

Field Detail

connectionTimeoutMillisback to summary
protected volatile long connectionTimeoutMillis
DEFAULT_CONNECTION_TIMEOUTback to summary
protected static final int DEFAULT_CONNECTION_TIMEOUT

Hides org.glassfish.grizzly.SocketConnectorHandler.DEFAULT_CONNECTION_TIMEOUT.

instantConnectHandlerback to summary
private final TCPNIOConnectorHandler.InstantConnectHandler instantConnectHandler
isReuseAddressback to summary
protected boolean isReuseAddress
isReusePortback to summary
protected boolean isReusePort
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

TCPNIOConnectorHandlerback to summary
protected TCPNIOConnectorHandler(final TCPNIOTransport transport)

Method Detail

abortConnectionback to summary
private static void abortConnection(final TCPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler, final Throwable failure)
builderback to summary
public static TCPNIOConnectorHandler.Builder builder(final TCPNIOTransport transport)

Return the TCPNIOConnectorHandler builder.

Parameters
transport:TCPNIOTransport

TCPNIOTransport.

Returns:TCPNIOConnectorHandler.Builder

the TCPNIOConnectorHandler builder.

connectback to summary
public void connect(final SocketAddress remoteAddress, final SocketAddress localAddress, final CompletionHandler<Connection<L>> completionHandler)

Overrides org.glassfish.grizzly.AbstractSocketConnectorHandler.connect.

Implements org.glassfish.grizzly.ConnectorHandler.connect.

Doc from org.glassfish.grizzly.ConnectorHandler.connect.

Creates, initializes Connection, binds it to the specific local and remote remoteAddress.

Annotations
@Override
connectAsyncback to summary
protected FutureImpl<Connection<L>> connectAsync(final SocketAddress remoteAddress, final SocketAddress localAddress, final CompletionHandler<Connection<L>> completionHandler, final boolean needFuture)

Implements abstract org.glassfish.grizzly.AbstractSocketConnectorHandler.connectAsync.

Annotations
@Override
connectSyncback to summary
protected void connectSync(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection<L>> completionHandler)
getSyncConnectTimeoutback to summary
public long getSyncConnectTimeout(final TimeUnit timeUnit)
isReuseAddressback to summary
public boolean isReuseAddress()
isReusePortback to summary
public boolean isReusePort()
onConnectedAsyncback to summary
protected static void onConnectedAsync(final TCPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler) throws IOException
setReuseAddressback to summary
public void setReuseAddress(boolean isReuseAddress)
setReusePortback to summary
public void setReusePort(boolean isReusePort)
setSyncConnectTimeoutback to summary
public void setSyncConnectTimeout(final long timeout, final TimeUnit timeUnit)
waitNIOFutureback to summary
protected void waitNIOFuture(final FutureImpl<Connection<L>> future, final CompletionHandler<Connection<L>> completionHandler)
org.glassfish.grizzly.nio.transport back to summary

public Class TCPNIOConnectorHandler.Builder

extends AbstractSocketConnectorHandler.Builder<TCPNIOConnectorHandler.Builder>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Boolean
private Boolean
private Long
private TimeUnit
private TCPNIOTransport
Inherited from org.glassfish.grizzly.AbstractSocketConnectorHandler.Builder:
connectionProbeprocessorprocessorSelector

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public TCPNIOConnectorHandler
protected AbstractSocketConnectorHandler
public TCPNIOConnectorHandler.Builder
setReuseAddress(final boolean reuseAddress)

public TCPNIOConnectorHandler.Builder
setReusePort(final boolean reusePort)

public TCPNIOConnectorHandler.Builder
setSyncConnectTimeout(final long timeout, final TimeUnit timeunit)

public TCPNIOConnectorHandler.Builder
setTransport(final TCPNIOTransport transport)

Inherited from org.glassfish.grizzly.AbstractSocketConnectorHandler.Builder:
probeprocessorprocessorSelector

Field Detail

reuseAddressback to summary
private Boolean reuseAddress
reusePortback to summary
private Boolean reusePort
timeoutback to summary
private Long timeout
timeoutTimeunitback to summary
private TimeUnit timeoutTimeunit
transportback to summary
private TCPNIOTransport transport

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public TCPNIOConnectorHandler build()

Overrides org.glassfish.grizzly.AbstractSocketConnectorHandler.Builder.build.

Annotations
@Override
createback to summary
protected AbstractSocketConnectorHandler create()

Implements abstract org.glassfish.grizzly.AbstractSocketConnectorHandler.Builder.create.

Annotations
@Override
setReuseAddressback to summary
public TCPNIOConnectorHandler.Builder setReuseAddress(final boolean reuseAddress)
setReusePortback to summary
public TCPNIOConnectorHandler.Builder setReusePort(final boolean reusePort)
setSyncConnectTimeoutback to summary
public TCPNIOConnectorHandler.Builder setSyncConnectTimeout(final long timeout, final TimeUnit timeunit)
setTransportback to summary
public TCPNIOConnectorHandler.Builder setTransport(final TCPNIOTransport transport)
org.glassfish.grizzly.nio.transport back to summary

private final Class TCPNIOConnectorHandler.EnableReadHandler

extends Adapter
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final CompletionHandler<Connection<L>>

Constructor Summary

AccessConstructor and Description
private
EnableReadHandler(final CompletionHandler<Connection<L>> completionHandler)

Method Summary

Modifier and TypeMethod and Description
public void
public void
onError(final Context context, final Object description)

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onError.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onError.

Error occurred during IOEvent processing.

public void
public void
Inherited from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter:
onContextManualIOEventControlonContextResumeonContextSuspendonLeaveonRerunonTerminate

Field Detail

completionHandlerback to summary
private final CompletionHandler<Connection<L>> completionHandler

Constructor Detail

EnableReadHandlerback to summary
private EnableReadHandler(final CompletionHandler<Connection<L>> completionHandler)

Method Detail

onCompleteback to summary
public void onComplete(final Context context, final Object data) throws IOException

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onComplete.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onComplete.

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onComplete.

IOEvent processing completed.

Annotations
@Override
Exceptions
IOException:

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.onComplete.

on error

onErrorback to summary
public void onError(final Context context, final Object description) throws IOException

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onError.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onError.

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onError.

Error occurred during IOEvent processing.

Annotations
@Override
Exceptions
IOException:

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.onError.

on error

onNotRunback to summary
public void onNotRun(final Context context) throws IOException

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onNotRun.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onNotRun.

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onNotRun.

IOEvent wasn't processed.

Annotations
@Override
Exceptions
IOException:

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.onNotRun.

on error

onReregisterback to summary
public void onReregister(final Context context) throws IOException

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onReregister.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onReregister.

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onReregister.

Reregister IOEvent interest.

Annotations
@Override
Exceptions
IOException:

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.onReregister.

on error

org.glassfish.grizzly.nio.transport back to summary

private Class TCPNIOConnectorHandler.InstantConnectHandler

extends EmptyCompletionHandler<RegisterChannelResult>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from org.glassfish.grizzly.EmptyCompletionHandler:
cancelledfailedupdated

Constructor Detail

InstantConnectHandlerback to summary
private InstantConnectHandler()

Method Detail

completedback to summary
public void completed(RegisterChannelResult result)

Overrides org.glassfish.grizzly.EmptyCompletionHandler.completed.

Implements org.glassfish.grizzly.CompletionHandler.completed.

Doc from org.glassfish.grizzly.EmptyCompletionHandler.completed.

The operation was completed.

Annotations
@Override
org.glassfish.grizzly.nio.transport back to summary

private Class TCPNIOConnectorHandler.RegisterChannelCompletionHandler

extends EmptyCompletionHandler<RegisterChannelResult>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final TCPNIOConnection

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
Inherited from org.glassfish.grizzly.EmptyCompletionHandler:
cancelledupdated

Field Detail

connectionback to summary
private final TCPNIOConnection connection

Constructor Detail

RegisterChannelCompletionHandlerback to summary
public RegisterChannelCompletionHandler(TCPNIOConnection connection)

Method Detail

completedback to summary
public void completed(final RegisterChannelResult result)

Overrides org.glassfish.grizzly.EmptyCompletionHandler.completed.

Implements org.glassfish.grizzly.CompletionHandler.completed.

Doc from org.glassfish.grizzly.EmptyCompletionHandler.completed.

The operation was completed.

Annotations
@Override
failedback to summary
public void failed(final Throwable throwable)

Overrides org.glassfish.grizzly.EmptyCompletionHandler.failed.

Implements org.glassfish.grizzly.CompletionHandler.failed.

Doc from org.glassfish.grizzly.EmptyCompletionHandler.failed.

The operation was failed.

Annotations
@Override