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

public Class UDPNIOConnectorHandler

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

UDP NIO transport client side ConnectorHandler implementation
Author
Alexey Stashok

Nested and Inner Type Summary

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

Field Summary

Modifier and TypeField and Description
protected volatile long
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 UDPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler, final Throwable failure)

public static UDPNIOConnectorHandler.Builder

Returns:

the UDPNIOConnectorHandler builder.
builder
(final UDPNIOTransport transport)

Return the UDPNIOConnectorHandler builder.

public GrizzlyFuture<Connection<L>>

Returns:

non-connected UDP Connection.
connect
()

Creates non-connected UDP Connection.

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(final SocketAddress remoteAddress, final SocketAddress localAddress, final CompletionHandler<Connection<L>> completionHandler)

public long
public boolean
public boolean
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
isReuseAddressback to summary
protected boolean isReuseAddress
isReusePortback to summary
protected boolean isReusePort
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

UDPNIOConnectorHandlerback to summary
protected UDPNIOConnectorHandler(UDPNIOTransport transport)

Method Detail

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

Return the UDPNIOConnectorHandler builder.

Parameters
transport:UDPNIOTransport

UDPNIOTransport.

Returns:UDPNIOConnectorHandler.Builder

the UDPNIOConnectorHandler builder.

connectback to summary
public GrizzlyFuture<Connection<L>> connect()

Creates non-connected UDP Connection.

Returns:GrizzlyFuture<Connection<L>>

non-connected UDP Connection.

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(final SocketAddress remoteAddress, final SocketAddress localAddress, final 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()
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 UDPNIOConnectorHandler.Builder

extends AbstractSocketConnectorHandler.Builder<UDPNIOConnectorHandler.Builder>
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

public UDPNIOConnectorHandler.Builder
setReusePort(final boolean reusePort)

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

public UDPNIOConnectorHandler.Builder
setTransport(final UDPNIOTransport 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 UDPNIOTransport transport

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public UDPNIOConnectorHandler 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 UDPNIOConnectorHandler.Builder setReuseAddress(final boolean reuseAddress)
setReusePortback to summary
public UDPNIOConnectorHandler.Builder setReusePort(final boolean reusePort)
setSyncConnectTimeoutback to summary
public UDPNIOConnectorHandler.Builder setSyncConnectTimeout(final long timeout, final TimeUnit timeunit)
setTransportback to summary
public UDPNIOConnectorHandler.Builder setTransport(final UDPNIOTransport transport)
org.glassfish.grizzly.nio.transport back to summary

private final Class UDPNIOConnectorHandler.ConnectHandler

extends EmptyCompletionHandler<RegisterChannelResult>
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
private
ConnectHandler(final UDPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler)

Method Summary

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

Field Detail

completionHandlerback to summary
private final CompletionHandler<Connection<L>> completionHandler
connectionback to summary
private final UDPNIOConnection connection

Constructor Detail

ConnectHandlerback to summary
private ConnectHandler(final UDPNIOConnection connection, final CompletionHandler<Connection<L>> completionHandler)

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
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
org.glassfish.grizzly.nio.transport back to summary

private Class UDPNIOConnectorHandler.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