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, onRemoved
public 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
BaseFilter
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.handleAccept
in interface Filter
handleAccept
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleConnect(FilterChainContext ctx) throws IOException
BaseFilter
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.handleConnect
in interface Filter
handleConnect
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleRead(FilterChainContext ctx) throws IOException
BaseFilter
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.handleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleWrite(FilterChainContext ctx) throws IOException
BaseFilter
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.handleWrite
in interface Filter
handleWrite
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleClose(FilterChainContext ctx) throws IOException
BaseFilter
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.handleClose
in interface Filter
handleClose
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public static DelayedExecutor createDefaultIdleDelayedExecutor()
public static DelayedExecutor createDefaultIdleDelayedExecutor(long checkInterval, TimeUnit checkIntervalUnit)
public long getTimeout(TimeUnit timeunit)
Copyright © 2014 Oracle Corporation. All rights reserved.