|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ConnectorHandler<E extends SelectorHandler,P extends CallbackHandler>
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().
| Method Summary | |
|---|---|
void |
close()
Close the underlying connection. |
void |
connect(java.net.SocketAddress remoteAddress)
Connect to hostname:port. |
void |
connect(java.net.SocketAddress remoteAddress,
P callbackHandler)
Connect to hostname:port. |
void |
connect(java.net.SocketAddress remoteAddress,
P callbackHandler,
E e)
Connect to hostname:port. |
void |
connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connect to hostname:port. |
void |
connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
P callbackHandler)
Connect to hostname:port. |
void |
connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
P callbackHandler,
E e)
Connect to hostname:port. |
void |
finishConnect(java.nio.channels.SelectionKey key)
Decide how the OP_CONNECT final steps are handled. |
P |
getCallbackHandler()
Returns ConnectorHandler's callback handler instance,
which is used to process occuring events |
Controller |
getController()
Return the Controller |
E |
getSelectorHandler()
Method returns SelectorHandler, which manages this
ConnectorHandler |
java.nio.channels.SelectableChannel |
getUnderlyingChannel()
Method returns ConnectorHandler's underlying channel |
boolean |
isConnected()
Is the underlying channel connected. |
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. |
void |
setCallbackHandler(P callbackHandler)
Sets ConnectorHandler's callback handler instance,
which is used to process occuring events |
void |
setController(Controller controller)
Set the Controller associated with this instance. |
long |
write(java.nio.ByteBuffer byteBuffer,
boolean blocking)
Writes bytes. |
| Methods inherited from interface com.sun.grizzly.async.AsyncQueueWritable |
|---|
writeToAsyncQueue, writeToAsyncQueue, writeToAsyncQueue, writeToAsyncQueue, writeToAsyncQueue, writeToAsyncQueue, writeToAsyncQueue, writeToAsyncQueue |
| Methods inherited from interface com.sun.grizzly.async.AsyncQueueReadable |
|---|
readFromAsyncQueue, readFromAsyncQueue, readFromAsyncQueue |
| Method Detail |
|---|
Controller.Protocol protocol()
Controller.Protocol
void connect(java.net.SocketAddress remoteAddress,
P callbackHandler,
E e)
throws java.io.IOException
Controller will invoke
the CallBackHandler.
remoteAddress - remote address to connectcallbackHandler - the handler invoked by the Controller when
an non blocking operation is ready to be handled.e - SelectorHandler
java.io.IOException
void connect(java.net.SocketAddress remoteAddress,
P callbackHandler)
throws java.io.IOException
Controller will invoke
the CallBackHandler.
remoteAddress - remote address to connectcallbackHandler - the handler invoked by the Controller when
an non blocking operation is ready to be handled.
java.io.IOException
void connect(java.net.SocketAddress remoteAddress)
throws java.io.IOException
remoteAddress - remote address to connect
java.io.IOException
void connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
P callbackHandler,
E e)
throws java.io.IOException
Controller will invoke
the CallBackHandler.
remoteAddress - remote address to connectlocalAddress - local address to bindcallbackHandler - the handler invoked by the Controller when
an non blocking operation is ready to be handled.e - SelectorHandler
java.io.IOException
void connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress,
P callbackHandler)
throws java.io.IOException
Controller will invoke
the CallBackHandler.
remoteAddress - remote address to connectlocalAddress - local address to bindcallbackHandler - the handler invoked by the Controller when
an non blocking operation is ready to be handled.
java.io.IOException
void connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
throws java.io.IOException
remoteAddress - remote address to connectlocalAddress - local address to bind
java.io.IOException
long read(java.nio.ByteBuffer byteBuffer,
boolean blocking)
throws java.io.IOException
Selector will be used to read bytes.
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
long write(java.nio.ByteBuffer byteBuffer,
boolean blocking)
throws java.io.IOException
Selector will be used to writes bytes.
byteBuffer - The byteBuffer to write.blocking - true if a a pool of temporary Selector
is required to handle a blocking write.
java.io.IOException
void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
void finishConnect(java.nio.channels.SelectionKey key)
throws java.io.IOException
key - SelectionKey
java.io.IOExceptionvoid setController(Controller controller)
Controller associated with this instance.
controller - ControllerController getController()
Controller
E getSelectorHandler()
SelectorHandler, which manages this
ConnectorHandler
SelectorHandlerjava.nio.channels.SelectableChannel getUnderlyingChannel()
ConnectorHandler's underlying channel
P getCallbackHandler()
ConnectorHandler's callback handler instance,
which is used to process occuring events
void setCallbackHandler(P callbackHandler)
ConnectorHandler's callback handler instance,
which is used to process occuring events
callbackHandler - handlerboolean isConnected()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||