|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.BaseSelectionKeyHandler
public class BaseSelectionKeyHandler
This class is an implementation of a SelectionKeyHandler which does not use the SelectionKey attachment, does not expire keys or utilize a keep-alive mechanism. However, this is currently not the SelectionKeyHandler provisioned by default with Grizzly's Controller. Hence for an application to use this SelectionKeyHandler, Grizzly's Controller must be explicitly configured to use this SelectionKeyHandler implementation.
| Field Summary | |
|---|---|
protected Logger |
logger
|
protected SelectorHandler |
selectorHandler
Associated SelectorHandler |
| Constructor Summary | |
|---|---|
BaseSelectionKeyHandler()
|
|
BaseSelectionKeyHandler(SelectorHandler selectorHandler)
|
|
| Method Summary | |
|---|---|
void |
cancel(SelectionKey key)
Cancel a SelectionKey and close its associated Channel. |
protected void |
cancelKey(SelectionKey key)
|
protected Object |
clearKeyAttachment(SelectionKey key)
|
void |
close(SelectionKey key)
Close the SelectionKey's channel input or output, but keep alive the SelectionKey. |
protected void |
closeChannel(SelectableChannel channel)
|
protected void |
closeChannel(SelectionKey key)
|
void |
copyTo(Copyable copy)
Copies current object content to copy object |
protected void |
doRegisterKey(SelectionKey key,
int selectionKeyOps)
Registers SelectionKey to handle certain operations |
void |
expire(Iterator<SelectionKey> keyIterator)
Expire a SelectionKey set. |
void |
expire(SelectionKey key,
long currentTime)
Deprecated. |
Logger |
getLogger()
|
SelectorHandler |
getSelectorHandler()
Get associated SelectorHandler |
protected boolean |
keyIsValid(SelectionKey key)
|
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 SelectionKeys. |
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)
Deprecated. |
void |
setLogger(Logger logger)
|
void |
setSelectorHandler(SelectorHandler selectorHandler)
Set associated SelectorHandler |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Logger logger
protected SelectorHandler selectorHandler
SelectorHandler
| Constructor Detail |
|---|
public BaseSelectionKeyHandler()
public BaseSelectionKeyHandler(SelectorHandler selectorHandler)
| Method Detail |
|---|
public SelectorHandler getSelectorHandler()
SelectorHandler
getSelectorHandler in interface SelectionKeyHandlerpublic void setSelectorHandler(SelectorHandler selectorHandler)
SelectorHandler
setSelectorHandler in interface SelectionKeyHandlerpublic void process(SelectionKey key)
SelectionKey process notification
process in interface SelectionKeyHandlerkey - SelectionKey to processpublic void postProcess(SelectionKey key)
SelectionKey post process notification
postProcess in interface SelectionKeyHandlerkey - SelectionKey to process
public void register(SelectionKey key,
long currentTime)
SelectionKeyHandler
register in interface SelectionKeyHandlerkey - SelectionKey to registercurrentTime - the System.currentTimeMillis
public void register(SelectionKey key,
int selectionKeyOps)
SelectionKey on Selector.
register in interface SelectionKeyHandlerkey - SelectionKeyselectionKeyOps - The interest set to apply when registering.
to register
protected void doRegisterKey(SelectionKey key,
int selectionKeyOps)
SelectionKey to handle certain operations
public void register(SelectableChannel channel,
int selectionKeyOps)
throws ClosedChannelException
SelectableChannel on Selector.
register in interface SelectionKeyHandlerchannel - SelectableChannelselectionKeyOps - The interest set to apply when registering.
to register
ClosedChannelException
public void register(Iterator<SelectionKey> keyIterator,
int selectionKeyOps)
SelectionKeys.
Note: After processing each SelectionKey it should be
removed from Iterator
register in interface SelectionKeyHandlerselectionKeyOps - The interest set to apply when registering.
to register
public void expire(SelectionKey key,
long currentTime)
SelectionKeyHandlerSelectionKey. If a SelectionKey is
inactive for certain time (timeout), the SelectionKey
will be cancelled and its associated Channel closed.
expire in interface SelectionKeyHandlerkey - SelectionKey to expirecurrentTime - the System.currentTimeMillispublic void 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.
expire in interface SelectionKeyHandlerkeyIterator - Iterator of SelectionKeys
to expirepublic void cancel(SelectionKey key)
cancel in interface SelectionKeyHandlerkey - SelectionKey to cancelpublic void close(SelectionKey key)
close in interface SelectionKeyHandlerkey - SelectionKey to closepublic void copyTo(Copyable copy)
copyTo in interface Copyablecopy - represents target object, where current object's content will be copiedpublic Logger getLogger()
public void setLogger(Logger logger)
protected void cancelKey(SelectionKey key)
protected boolean keyIsValid(SelectionKey key)
protected void closeChannel(SelectionKey key)
protected Object clearKeyAttachment(SelectionKey key)
protected void closeChannel(SelectableChannel channel)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||