|
||||||||||
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 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(SocketAddress remoteAddress,
SocketAddress localAddress)
Connect to hostname:port. |
void |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
CallbackHandler callbackHandler,
UDPSelectorHandler selectorHandler)
Connect to hostname:port. |
void |
finishConnect(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(ByteBuffer byteBuffer,
boolean blocking)
Read bytes. |
SocketAddress |
receive(ByteBuffer byteBuffer)
Receive bytes. |
long |
send(ByteBuffer byteBuffer,
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 CountDownLatch isConnectedLatch
Constructor Detail |
---|
public UDPConnectorHandler()
Method Detail |
---|
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, CallbackHandler callbackHandler, UDPSelectorHandler selectorHandler) throws 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.
IOException
public void connect(SocketAddress remoteAddress, SocketAddress localAddress) throws IOException
remoteAddress
- remote address to connectlocalAddress
- local address to bin
IOException
public long read(ByteBuffer byteBuffer, boolean blocking) throws 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.
IOException
public long send(ByteBuffer byteBuffer, SocketAddress socketAddress) throws IOException
byteBuffer
- The byteBuffer to store bytes.socketAddress
-
IOException
public SocketAddress receive(ByteBuffer byteBuffer) throws IOException
byteBuffer
- The byteBuffer to store bytes.
SocketAddress
IOException
public void close() throws IOException
IOException
public void finishConnect(SelectionKey key) throws IOException
key
- SelectionKey
IOException
public 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 |