com.sun.grizzly.http
Class KeepAliveThreadAttachment

java.lang.Object
  extended by com.sun.grizzly.util.SelectionKeyAttachment
      extended by com.sun.grizzly.util.SelectionKeyActionAttachment
          extended by com.sun.grizzly.util.ThreadAttachment
              extended by com.sun.grizzly.http.KeepAliveThreadAttachment
All Implemented Interfaces:
AttributeHolder

public class KeepAliveThreadAttachment
extends ThreadAttachment

Add keep alive counting mechanism to the ThreadAttachment.

Author:
Jeanfrancois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.grizzly.util.ThreadAttachment
ThreadAttachment.Mode
 
Nested classes/interfaces inherited from class com.sun.grizzly.util.SelectionKeyAttachment
SelectionKeyAttachment.KeySelectionListener, SelectionKeyAttachment.TimeOutListener
 
Field Summary
protected static Logger logger
           
 
Fields inherited from class com.sun.grizzly.util.SelectionKeyAttachment
DEREGISTERED, idleTimeoutDelay, keySelectionListener, timeout, timeoutListener, UNLIMITED_TIMEOUT
 
Constructor Summary
KeepAliveThreadAttachment()
           
 
Method Summary
 int getKeepAliveCount()
           
 int increaseKeepAliveCount()
          Increase the keep alive count by one.
 void release(SelectionKey selectionKey)
           
 void resetKeepAliveCount()
          Reset the keep alive value to 0.
 void setKeepAliveStats(KeepAliveStats keepAliveStats)
          Set the KeepAliveStats instance used to collect request statistic.
 boolean timedOut(SelectionKey selectionKey)
          called when idle timeout detected.
 
Methods inherited from class com.sun.grizzly.util.ThreadAttachment
activeThread, associate, deassociate, getAttribute, getAttributes, getByteBuffer, getIdleTimeoutDelay, getInputBB, getMode, getOutputBB, getSSLEngine, getThreadId, getTransactionTimeout, isUnlimitedTimeout, postProcess, process, removeAttribute, reset, setAttribute, setAttributes, setByteBuffer, setIdleTimeoutDelay, setInputBB, setMode, setOutputBB, setSSLEngine, setThreadId, setTransactionTimeout, toString
 
Methods inherited from class com.sun.grizzly.util.SelectionKeyAttachment
getAttachment, getKeySelectionListener, getTimeout, getTimeoutListener, handleSelectedKey, setKeySelectionListener, setTimeout, setTimeoutListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
Constructor Detail

KeepAliveThreadAttachment

public KeepAliveThreadAttachment()
Method Detail

setKeepAliveStats

public void setKeepAliveStats(KeepAliveStats keepAliveStats)
Set the KeepAliveStats instance used to collect request statistic.

Parameters:
keepAliveStats - the KeepAliveStats instance used to collect request statistic.

increaseKeepAliveCount

public int increaseKeepAliveCount()
Increase the keep alive count by one.


resetKeepAliveCount

public void resetKeepAliveCount()
Reset the keep alive value to 0.


getKeepAliveCount

public int getKeepAliveCount()

release

public void release(SelectionKey selectionKey)
Overrides:
release in class ThreadAttachment

timedOut

public boolean timedOut(SelectionKey selectionKey)
Description copied from class: SelectionKeyAttachment
called when idle timeout detected. return true if key should be canceled.

Overrides:
timedOut in class SelectionKeyAttachment
Returns:


Copyright © 2012 Oracle Corporation. All Rights Reserved.