|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SelectionKeyHandler
A SelectionKeyHandler is used to handle the life cycle of a SelectionKey. Operations like cancelling, registering or closing are handled by SelectionKeyHandler.
Method Summary | |
---|---|
void |
cancel(SelectionKey key)
Cancel a SelectionKey and close its Channel. |
void |
close(SelectionKey key)
Close the SelectionKey's channel input or output, but keep alive the SelectionKey. |
void |
expire(Iterator<SelectionKey> keyIterator)
Expire a SelectionKey set. |
void |
expire(SelectionKey key,
long currentTime)
Deprecated. |
SelectorHandler |
getSelectorHandler()
Get associated SelectorHandler |
void |
postProcess(SelectionKey key)
SelectionKey post process notification |
void |
process(SelectionKey key)
SelectionKey process notification |
void |
register(Iterator<SelectionKey> keyIterator,
int selectionKeyOps)
Register a set of SelectionKey s. |
void |
register(SelectableChannel channel,
int selectionKeyOps)
Register a SelectableChannel on Selector . |
void |
register(SelectionKey key,
int selectionKeyOps)
Register a SelectionKey on Selector . |
void |
register(SelectionKey key,
long currentTime)
Attach a times out to the SelectionKey used to cancel idle connection. |
void |
setSelectorHandler(SelectorHandler selectorHandler)
Set associated SelectorHandler |
Methods inherited from interface com.sun.grizzly.util.Copyable |
---|
copyTo |
Method Detail |
---|
SelectorHandler getSelectorHandler()
SelectorHandler
void setSelectorHandler(SelectorHandler selectorHandler)
SelectorHandler
void process(SelectionKey key)
SelectionKey
process notification
key
- SelectionKey
to processvoid postProcess(SelectionKey key)
SelectionKey
post process notification
key
- SelectionKey
to processvoid register(SelectionKey key, long currentTime)
key
- SelectionKey
to registercurrentTime
- the System.currentTimeMillisvoid register(SelectionKey key, int selectionKeyOps)
SelectionKey
on Selector
.
key
- SelectionKey
selectionKeyOps
- The interest set to apply when registering.
to registervoid register(SelectableChannel channel, int selectionKeyOps) throws ClosedChannelException
SelectableChannel
on Selector
.
channel
- SelectableChannel
selectionKeyOps
- The interest set to apply when registering.
to register
ClosedChannelException
void register(Iterator<SelectionKey> keyIterator, int selectionKeyOps)
SelectionKey
s.
Note: After processing each SelectionKey
it should be
removed from Iterator
selectionKeySet
- Iterator
of SelectionKey
sselectionKeyOps
- The interest set to apply when registering.
to registervoid expire(SelectionKey key, long currentTime)
SelectionKey
. If a SelectionKey
is
inactive for certain time (timeout), the SelectionKey
will be cancelled and its associated Channel closed.
key
- SelectionKey
to expirecurrentTime
- the System.currentTimeMillisvoid expire(Iterator<SelectionKey> keyIterator)
SelectionKey
set. Method checks
each SelectionKey
from the Set
. And if
a SelectionKey
is inactive for certain time (timeout),
the SelectionKey
will be cancelled and its associated Channel closed.
keyIterator
- Iterator
of SelectionKey
s
to expirevoid cancel(SelectionKey key)
key
- SelectionKey
to cancelvoid close(SelectionKey key)
key
- SelectionKey
to close
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |