|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.AbstractConnectorHandler<UDPSelectorHandler,CallbackHandler>
com.sun.grizzly.UDPConnectorHandler
public class UDPConnectorHandler
Client side interface used to implement non blocking client operation. Implementation of this class must make sure the following methods are invoked in that order:
(1) connect()
(2) read() or write().
| Field Summary | |
|---|---|
protected java.util.concurrent.CountDownLatch |
isConnectedLatch
IsConnected Latch related |
| Fields inherited from class com.sun.grizzly.AbstractConnectorHandler |
|---|
callbackHandler, controller, inputStream, isConnected, protocol, selectorHandler, underlyingChannel |
| Constructor Summary | |
|---|---|
UDPConnectorHandler()
|
|
| Method Summary | |
|---|---|
void |
close()
Close the underlying connection. |
void |
connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connect to hostname:port. |
void |
connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
CallbackHandler callbackHandler,
UDPSelectorHandler selectorHandler)
Connect to hostname:port. |
void |
finishConnect(java.nio.channels.SelectionKey key)
Finish handling the OP_CONNECT interest ops. |
Controller.Protocol |
protocol()
A token decribing the protocol supported by an implementation of this interface |
long |
read(java.nio.ByteBuffer byteBuffer,
boolean blocking)
Read bytes. |
java.net.SocketAddress |
receive(java.nio.ByteBuffer byteBuffer)
Receive bytes. |
long |
send(java.nio.ByteBuffer byteBuffer,
java.net.SocketAddress socketAddress)
Receive bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected volatile java.util.concurrent.CountDownLatch isConnectedLatch
| Constructor Detail |
|---|
public UDPConnectorHandler()
| Method Detail |
|---|
public void connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
CallbackHandler callbackHandler,
UDPSelectorHandler selectorHandler)
throws java.io.IOException
Controller will invoke
the CallBackHandler.
remoteAddress - remote address to connectlocalAddress - local address to bincallbackHandler - the handler invoked by its associated SelectorHandler when
a non blocking operation is ready to be handled. When null, all
read and write operation will be delegated to the default
ProtocolChain and its list of ProtocolFilter
. When null, this ConnectorHandler will create an instance of DefaultCallbackHandler.selectorHandler - an instance of SelectorHandler.
java.io.IOException
public void connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
throws java.io.IOException
remoteAddress - remote address to connectlocalAddress - local address to bin
java.io.IOException
public long read(java.nio.ByteBuffer byteBuffer,
boolean blocking)
throws java.io.IOException
Selector will be used to read bytes.
read in interface ConnectorHandler<UDPSelectorHandler,CallbackHandler>read in class AbstractConnectorHandler<UDPSelectorHandler,CallbackHandler>byteBuffer - The byteBuffer to store bytes.blocking - true if a a pool of temporary Selector
is required to handle a blocking read.
java.io.IOException
public long send(java.nio.ByteBuffer byteBuffer,
java.net.SocketAddress socketAddress)
throws java.io.IOException
byteBuffer - The byteBuffer to store bytes.socketAddress -
java.io.IOException
public java.net.SocketAddress receive(java.nio.ByteBuffer byteBuffer)
throws java.io.IOException
byteBuffer - The byteBuffer to store bytes.
SocketAddress
java.io.IOException
public void close()
throws java.io.IOException
java.io.IOException
public void finishConnect(java.nio.channels.SelectionKey key)
throws java.io.IOException
key - SelectionKey
java.io.IOExceptionpublic Controller.Protocol protocol()
protocol in interface ConnectorHandler<UDPSelectorHandler,CallbackHandler>protocol in class AbstractConnectorHandler<UDPSelectorHandler,CallbackHandler>Controller.Protocol.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||