com.sun.grizzly.util
Class SelectionKeyAttachment

java.lang.Object
  extended by com.sun.grizzly.util.SelectionKeyAttachment
Direct Known Subclasses:
Response.ResponseAttachment, SelectedKeyAttachmentLogic, SelectionKeyActionAttachment

public abstract class SelectionKeyAttachment
extends Object

Basic class for all SelectionKey attachments. Custom attachments should be inherited from it.

Author:
Alexey Stashok

Field Summary
static long DEREGISTERED
           
protected  long timeout
           
static long UNLIMITED_TIMEOUT
           
 
Constructor Summary
SelectionKeyAttachment()
           
 
Method Summary
static Object getAttachment(SelectionKey key)
           
 long getIdleTimeoutDelay()
          returns the idle timeout delay.
 long getTimeout()
           
 void release(SelectionKey selectionKey)
           
 void setIdleTimeoutDelay(long idletimeoutdelay)
          Subclass need to override this method for it to work.
 void setTimeout(long timeout)
           
 boolean timedOut(SelectionKey Key)
          called when idle timeout detected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNLIMITED_TIMEOUT

public static final long UNLIMITED_TIMEOUT
See Also:
Constant Field Values

DEREGISTERED

public static final long DEREGISTERED
See Also:
Constant Field Values

timeout

protected long timeout
Constructor Detail

SelectionKeyAttachment

public SelectionKeyAttachment()
Method Detail

getAttachment

public static Object getAttachment(SelectionKey key)

getIdleTimeoutDelay

public long getIdleTimeoutDelay()
returns the idle timeout delay. default it returns Long.MIN_VALUE , meaning null. -1 means no timeout. Subclass need to override it.

Returns:

setIdleTimeoutDelay

public void setIdleTimeoutDelay(long idletimeoutdelay)
Subclass need to override this method for it to work. Long.MIN_VALUE means null , and default value will be used. -1 means no timeout.

Parameters:
idletimeoutdelay -

getTimeout

public long getTimeout()

setTimeout

public void setTimeout(long timeout)

timedOut

public boolean timedOut(SelectionKey Key)
called when idle timeout detected. return true if key should be canceled.

Parameters:
Key -
Returns:

release

public void release(SelectionKey selectionKey)


Copyright © 2009 SUN Microsystems. All Rights Reserved.