public class ActivityCheckFilter extends BaseFilter
Connection activity and closing
Connection ones it becomes idle for certain amount of time.
Unlike IdleTimeoutFilter, this Filter assumes Connection
is idle, even if some event is being executed on it, so it really requires
some action to be executed on Connection to reset the timeout.IdleTimeoutFilter| Modifier and Type | Class and Description |
|---|---|
static interface |
ActivityCheckFilter.TimeoutHandler |
| Modifier and Type | Field and Description |
|---|---|
static String |
ACTIVE_ATTRIBUTE_NAME |
| Modifier | Constructor and Description |
|---|---|
protected |
ActivityCheckFilter(DelayedExecutor executor,
DelayedExecutor.Worker<Connection> worker,
long timeout,
TimeUnit timeoutUnit) |
|
ActivityCheckFilter(DelayedExecutor executor,
long timeout,
TimeUnit timeoutUnit) |
|
ActivityCheckFilter(DelayedExecutor executor,
long timeout,
TimeUnit timeoutUnit,
ActivityCheckFilter.TimeoutHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
static DelayedExecutor |
createDefaultIdleDelayedExecutor() |
static DelayedExecutor |
createDefaultIdleDelayedExecutor(long checkInterval,
TimeUnit checkIntervalUnit) |
long |
getTimeout(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 |
handleConnect(FilterChainContext ctx)
Execute a unit of processing work to be performed, when channel gets
connected.
|
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.
|
createContext, exceptionOccurred, handleEvent, onAdded, onFilterChainChanged, onRemovedpublic static final String ACTIVE_ATTRIBUTE_NAME
public ActivityCheckFilter(DelayedExecutor executor, long timeout, TimeUnit timeoutUnit)
public ActivityCheckFilter(DelayedExecutor executor, long timeout, TimeUnit timeoutUnit, ActivityCheckFilter.TimeoutHandler handler)
protected ActivityCheckFilter(DelayedExecutor executor, DelayedExecutor.Worker<Connection> worker, long timeout, TimeUnit timeoutUnit)
public NextAction handleAccept(FilterChainContext ctx) throws IOException
BaseFilterFilter 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.handleAccept in interface FilterhandleAccept in class BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it
should continue the executionIOExceptionpublic NextAction handleConnect(FilterChainContext ctx) throws IOException
BaseFilterFilter 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.handleConnect in interface FilterhandleConnect in class BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it
should continue the executionIOExceptionpublic NextAction handleRead(FilterChainContext ctx) throws IOException
BaseFilterFilter 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.handleRead in interface FilterhandleRead in class BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it
should continue the executionIOExceptionpublic NextAction handleWrite(FilterChainContext ctx) throws IOException
BaseFilterFilter 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.handleWrite in interface FilterhandleWrite in class BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it
should continue the executionIOExceptionpublic NextAction handleClose(FilterChainContext ctx) throws IOException
BaseFilterFilter 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.handleClose in interface FilterhandleClose in class BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it
should continue the executionIOExceptionpublic static DelayedExecutor createDefaultIdleDelayedExecutor()
public static DelayedExecutor createDefaultIdleDelayedExecutor(long checkInterval, TimeUnit checkIntervalUnit)
public long getTimeout(TimeUnit timeunit)
Copyright © 2014 Oracle Corporation. All Rights Reserved.