org.glassfish.grizzly.utils
Class SilentConnectionFilter

java.lang.Object
  extended by org.glassfish.grizzly.filterchain.BaseFilter
      extended by org.glassfish.grizzly.utils.SilentConnectionFilter
All Implemented Interfaces:
Filter

public final class SilentConnectionFilter
extends BaseFilter

Filter, which determines silent connections and closes them. The silent connection is a connection, which didn't send/receive any byte since it was accepted during specified period of time.

Author:
Alexey Stashok

Field Summary
static long UNLIMITED_TIMEOUT
           
static long UNSET_TIMEOUT
           
 
Constructor Summary
SilentConnectionFilter(DelayedExecutor executor, long timeout, java.util.concurrent.TimeUnit timeunit)
           
 
Method Summary
 long getTimeout(java.util.concurrent.TimeUnit timeunit)
           
 NextAction handleAccept(FilterChainContext ctx)
          Execute a unit of processing work to be performed, when server channel has accepted the client connection.
 NextAction handleClose(FilterChainContext ctx)
          Execute a unit of processing work to be performed, when connection has been closed.
 NextAction handleRead(FilterChainContext ctx)
          Execute a unit of processing work to be performed, when channel will become available for reading.
 NextAction handleWrite(FilterChainContext ctx)
          Execute a unit of processing work to be performed, when some data should be written on channel.
 
Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, getFilterChain, getIndex, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved
 
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

UNSET_TIMEOUT

public static final long UNSET_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

SilentConnectionFilter

public SilentConnectionFilter(DelayedExecutor executor,
                              long timeout,
                              java.util.concurrent.TimeUnit timeunit)
Method Detail

getTimeout

public long getTimeout(java.util.concurrent.TimeUnit timeunit)

handleAccept

public NextAction handleAccept(FilterChainContext ctx)
                        throws java.io.IOException
Description copied from class: BaseFilter
Execute a unit of processing work to be performed, when server channel has accepted the client connection. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleAccept in interface Filter
Overrides:
handleAccept in class BaseFilter
Parameters:
ctx - FilterChainContext
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
java.io.IOException

handleRead

public NextAction handleRead(FilterChainContext ctx)
                      throws java.io.IOException
Description copied from class: BaseFilter
Execute a unit of processing work to be performed, when channel will become available for reading. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleRead in interface Filter
Overrides:
handleRead in class BaseFilter
Parameters:
ctx - FilterChainContext
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
java.io.IOException

handleWrite

public NextAction handleWrite(FilterChainContext ctx)
                       throws java.io.IOException
Description copied from class: BaseFilter
Execute a unit of processing work to be performed, when some data should be written on channel. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleWrite in interface Filter
Overrides:
handleWrite in class BaseFilter
Parameters:
ctx - FilterChainContext
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
java.io.IOException

handleClose

public NextAction handleClose(FilterChainContext ctx)
                       throws java.io.IOException
Description copied from class: BaseFilter
Execute a unit of processing work to be performed, when connection has been closed. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleClose in interface Filter
Overrides:
handleClose in class BaseFilter
Parameters:
ctx - FilterChainContext
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
java.io.IOException


Copyright © 2012 Oracle Corporation. All Rights Reserved.