com.sun.grizzly.http
Class SelectorThreadKeyHandler

java.lang.Object
  extended by com.sun.grizzly.BaseSelectionKeyHandler
      extended by com.sun.grizzly.DefaultSelectionKeyHandler
          extended by com.sun.grizzly.http.SelectorThreadKeyHandler
All Implemented Interfaces:
Handler, SelectionKeyHandler, Copyable

public class SelectorThreadKeyHandler
extends DefaultSelectionKeyHandler

Default HTTP SelectionKeyHandler implementation

Author:
Jean-Francois Arcand, Alexey Stashok

Field Summary
protected  ConcurrentLinkedQueue<SelectionKey> bannedKeys
          Banned SelectionKey registration.
 
Fields inherited from class com.sun.grizzly.DefaultSelectionKeyHandler
nextKeysExpiration, timeout
 
Fields inherited from class com.sun.grizzly.BaseSelectionKeyHandler
logger, selectorHandler
 
Constructor Summary
SelectorThreadKeyHandler()
           
SelectorThreadKeyHandler(SelectorThread selectorThread)
           
 
Method Summary
 void addBannedSelectionKey(SelectionKey key)
          Add a SelectionKey to the banned list of SelectionKeys.
 void cancel(SelectionKey key)
          Cancel a SelectionKey and close its associated Channel.
 void copyTo(Copyable copy)
          Copies current object content to copy object
 void doRegisterKey(SelectionKey key, int ops, long currentTime)
          Registers SelectionKey to handle certain operations
 void expire(Iterator<SelectionKey> keys)
          Expire a 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.
 
Methods inherited from class com.sun.grizzly.DefaultSelectionKeyHandler
clearKeyAttachment, expire, getTimeout, postProcess, process, register, register, register, register, setTimeout
 
Methods inherited from class com.sun.grizzly.BaseSelectionKeyHandler
cancelKey, close, closeChannel, closeChannel, doRegisterKey, getLogger, getSelectorHandler, keyIsValid, setLogger, setSelectorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bannedKeys

protected ConcurrentLinkedQueue<SelectionKey> bannedKeys
Banned SelectionKey registration.

Constructor Detail

SelectorThreadKeyHandler

public SelectorThreadKeyHandler()

SelectorThreadKeyHandler

public SelectorThreadKeyHandler(SelectorThread selectorThread)
Method Detail

copyTo

public void copyTo(Copyable copy)
Description copied from class: DefaultSelectionKeyHandler
Copies current object content to copy object

Specified by:
copyTo in interface Copyable
Overrides:
copyTo in class DefaultSelectionKeyHandler
Parameters:
copy - represents target object, where current object's content will be copied

doRegisterKey

public void doRegisterKey(SelectionKey key,
                          int ops,
                          long currentTime)
Description copied from class: DefaultSelectionKeyHandler
Registers SelectionKey to handle certain operations

Overrides:
doRegisterKey in class DefaultSelectionKeyHandler

expire

public void expire(Iterator<SelectionKey> keys)
Description copied from class: DefaultSelectionKeyHandler
Expire a 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.

Specified by:
expire in interface SelectionKeyHandler
Overrides:
expire in class DefaultSelectionKeyHandler
Parameters:
keys - Iterator of SelectionKeys to expire

cancel

public void cancel(SelectionKey key)
Description copied from class: BaseSelectionKeyHandler
Cancel a SelectionKey and close its associated Channel.

Specified by:
cancel in interface SelectionKeyHandler
Overrides:
cancel in class BaseSelectionKeyHandler
Parameters:
key - SelectionKey to cancel

addBannedSelectionKey

public void addBannedSelectionKey(SelectionKey key)
Add a SelectionKey to the banned list of SelectionKeys. A SelectionKey is banned when new registration aren't allowed on the Selector.



Copyright © 2009 SUN Microsystems. All Rights Reserved.