|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.connectioncache.client.CacheableConnectorHandler
public class CacheableConnectorHandler
Extended implementation of the DefaultSelectionKeyHandler with ConnectionManagement integrated in it
Constructor Summary | |
---|---|
CacheableConnectorHandler(CacheableConnectorHandlerPool parentPool)
|
Method Summary | |
---|---|
void |
close()
Close the underlying connection. |
void |
connect(SocketAddress remoteAddress)
Connect to hostname:port. |
void |
connect(SocketAddress remoteAddress,
CallbackHandler callbackHandler)
Connect to hostname:port. |
void |
connect(SocketAddress remoteAddress,
CallbackHandler callbackHandler,
SelectorHandler selectorHandler)
Connect to hostname:port. |
void |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Connect to hostname:port. |
void |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
CallbackHandler callbackHandler)
Connect to hostname:port. |
void |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
CallbackHandler callbackHandler,
SelectorHandler selectorHandler)
Connect to hostname:port. |
ConnectorHandler |
createConnection()
Create a new Connection from this ContactInfo. |
boolean |
equals(Object o)
|
void |
finishConnect(SelectionKey key)
Decide how the OP_CONNECT final steps are handled. |
CallbackHandler |
getCallbackHandler()
Returns ConnectorHandler 's callback handler instance,
which is used to process occuring events |
Controller |
getController()
Return the Controller |
SelectorHandler |
getSelectorHandler()
Method returns SelectorHandler , which manages this
ConnectorHandler |
SelectableChannel |
getUnderlyingChannel()
Method returns ConnectorHandler 's underlying channel |
int |
hashCode()
|
void |
onConnect(IOEvent ioEvent)
This method is called when an non blocking OP_CONNECT is ready to get processed. |
void |
onRead(IOEvent ioEvent)
This method is called when an non blocking OP_READ is ready to get processed. |
void |
onWrite(IOEvent ioEvent)
This method is called when an non blocking OP_WRITE is ready to get processed. |
Controller.Protocol |
protocol()
A token decribing the protocol supported by an implementation of this interface |
long |
read(ByteBuffer byteBuffer,
boolean blocking)
Read bytes. |
void |
release(int expectedResponseCount)
Releases underlying connection, which means it could be reused for writing by other CacheableConnectorHandler , however this
CacheableConnectorHandler will be still interested in getting
expectedResponseCount responses on it. |
void |
responseReceived()
Notifies connection cache, that response was received. |
void |
setCallbackHandler(CallbackHandler 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. |
String |
toString()
|
long |
write(ByteBuffer byteBuffer,
boolean blocking)
Writes bytes. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CacheableConnectorHandler(CacheableConnectorHandlerPool parentPool)
Method Detail |
---|
public Controller.Protocol protocol()
ConnectorHandler
protocol
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
Controller.Protocol
public void connect(SocketAddress remoteAddress, CallbackHandler callbackHandler, SelectorHandler selectorHandler) throws IOException
ConnectorHandler
Controller
will invoke
the CallBackHandler.
connect
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
remoteAddress
- remote address to connectcallbackHandler
- the handler invoked by the Controller when
an non blocking operation is ready to be handled.selectorHandler
- SelectorHandler
IOException
public void connect(SocketAddress remoteAddress, CallbackHandler callbackHandler) throws IOException
ConnectorHandler
Controller
will invoke
the CallBackHandler.
connect
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
remoteAddress
- remote address to connectcallbackHandler
- the handler invoked by the Controller when
an non blocking operation is ready to be handled.
IOException
public void connect(SocketAddress remoteAddress) throws IOException
ConnectorHandler
connect
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
remoteAddress
- remote address to connect
IOException
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, CallbackHandler callbackHandler, SelectorHandler selectorHandler) throws IOException
ConnectorHandler
Controller
will invoke
the CallBackHandler.
connect
in interface ConnectorHandler<SelectorHandler,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.selectorHandler
- SelectorHandler
IOException
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, CallbackHandler callbackHandler) throws IOException
ConnectorHandler
Controller
will invoke
the CallBackHandler.
connect
in interface ConnectorHandler<SelectorHandler,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.
IOException
public void connect(SocketAddress remoteAddress, SocketAddress localAddress) throws IOException
ConnectorHandler
connect
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
remoteAddress
- remote address to connectlocalAddress
- local address to bind
IOException
public void release(int expectedResponseCount)
CacheableConnectorHandler
, however this
CacheableConnectorHandler
will be still interested in getting
expectedResponseCount responses on it.
expectedResponseCount
- number of reponses expected on the connectionpublic void responseReceived()
public void close() throws IOException
ConnectorHandler
close
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
close
in interface Closeable
IOException
public long read(ByteBuffer byteBuffer, boolean blocking) throws IOException
ConnectorHandler
Selector
will be used to read bytes.
read
in interface ConnectorHandler<SelectorHandler,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 write(ByteBuffer byteBuffer, boolean blocking) throws IOException
ConnectorHandler
Selector
will be used to writes bytes.
write
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
byteBuffer
- The byteBuffer to write.blocking
- true if a a pool of temporary Selector
is required to handle a blocking write.
IOException
public void finishConnect(SelectionKey key)
ConnectorHandler
finishConnect
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
key
- SelectionKey
public void setController(Controller controller)
ConnectorHandler
Controller
associated with this instance.
setController
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
controller
- Controller
public Controller getController()
ConnectorHandler
Controller
getController
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
public SelectableChannel getUnderlyingChannel()
ConnectorHandler
ConnectorHandler
's underlying channel
getUnderlyingChannel
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
public CallbackHandler getCallbackHandler()
ConnectorHandler
ConnectorHandler
's callback handler instance,
which is used to process occuring events
getCallbackHandler
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
public void setCallbackHandler(CallbackHandler callbackHandler)
ConnectorHandler
ConnectorHandler
's callback handler instance,
which is used to process occuring events
setCallbackHandler
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
callbackHandler
- handlerpublic SelectorHandler getSelectorHandler()
ConnectorHandler
SelectorHandler
, which manages this
ConnectorHandler
getSelectorHandler
in interface ConnectorHandler<SelectorHandler,CallbackHandler>
SelectorHandler
public ConnectorHandler createConnection() throws IOException
ContactInfo
createConnection
in interface ContactInfo<ConnectorHandler>
IOException
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public void onConnect(IOEvent ioEvent)
CallbackHandler
onConnect
in interface CallbackHandler
ioEvent
- an object containing information about the current
non blocking connection.public void onRead(IOEvent ioEvent)
CallbackHandler
onRead
in interface CallbackHandler
ioEvent
- an object containing information about the current
non blocking connection.public void onWrite(IOEvent ioEvent)
CallbackHandler
onWrite
in interface CallbackHandler
ioEvent
- an object containing information about the current
non blocking connection.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |