java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.utils.ActivityCheckFilter
- All Implemented Interfaces:
Filter
The Filter is responsible for tracking
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.- Author:
- Alexey Stashok
- See Also:
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionActivityCheckFilter
(DelayedExecutor executor, long timeout, TimeUnit timeoutUnit) ActivityCheckFilter
(DelayedExecutor executor, long timeout, TimeUnit timeoutUnit, ActivityCheckFilter.TimeoutHandler handler) protected
ActivityCheckFilter
(DelayedExecutor executor, DelayedExecutor.Worker<Connection> worker, long timeout, TimeUnit timeoutUnit) -
Method Summary
Modifier and TypeMethodDescriptionstatic DelayedExecutor
static DelayedExecutor
createDefaultIdleDelayedExecutor
(long checkInterval, TimeUnit checkIntervalUnit) long
getTimeout
(TimeUnit timeunit) Execute a unit of processing work to be performed, when server channel has accepted the client connection.Execute a unit of processing work to be performed, when connection has been closed.Execute a unit of processing work to be performed, when channel gets connected.Execute a unit of processing work to be performed, when channel will become available for reading.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, handleEvent, onAdded, onFilterChainChanged, onRemoved, toString
-
Field Details
-
ACTIVE_ATTRIBUTE_NAME
- See Also:
-
-
Constructor Details
-
ActivityCheckFilter
-
ActivityCheckFilter
public ActivityCheckFilter(DelayedExecutor executor, long timeout, TimeUnit timeoutUnit, ActivityCheckFilter.TimeoutHandler handler) -
ActivityCheckFilter
protected ActivityCheckFilter(DelayedExecutor executor, DelayedExecutor.Worker<Connection> worker, long timeout, TimeUnit timeoutUnit)
-
-
Method Details
-
handleAccept
Description copied from class:BaseFilter
Execute a unit of processing work to be performed, when server channel has accepted the client connection. ThisFilter
may either complete the required processing and return false, or delegate remaining processing to the nextFilter
in aFilterChain
containing thisFilter
by returning true.- Specified by:
handleAccept
in interfaceFilter
- Overrides:
handleAccept
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleConnect
Description copied from class:BaseFilter
Execute a unit of processing work to be performed, when channel gets connected. ThisFilter
may either complete the required processing and return false, or delegate remaining processing to the nextFilter
in aFilterChain
containing thisFilter
by returning true.- Specified by:
handleConnect
in interfaceFilter
- Overrides:
handleConnect
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleRead
Description copied from class:BaseFilter
Execute a unit of processing work to be performed, when channel will become available for reading. ThisFilter
may either complete the required processing and return false, or delegate remaining processing to the nextFilter
in aFilterChain
containing thisFilter
by returning true.- Specified by:
handleRead
in interfaceFilter
- Overrides:
handleRead
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleWrite
Description copied from class:BaseFilter
Execute a unit of processing work to be performed, when some data should be written on channel. ThisFilter
may either complete the required processing and return false, or delegate remaining processing to the nextFilter
in aFilterChain
containing thisFilter
by returning true.- Specified by:
handleWrite
in interfaceFilter
- Overrides:
handleWrite
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
handleClose
Description copied from class:BaseFilter
Execute a unit of processing work to be performed, when connection has been closed. ThisFilter
may either complete the required processing and return false, or delegate remaining processing to the nextFilter
in aFilterChain
containing thisFilter
by returning true.- Specified by:
handleClose
in interfaceFilter
- Overrides:
handleClose
in classBaseFilter
- Parameters:
ctx
-FilterChainContext
- Returns:
NextAction
instruction forFilterChain
, how it should continue the execution- Throws:
IOException
-
createDefaultIdleDelayedExecutor
-
createDefaultIdleDelayedExecutor
public static DelayedExecutor createDefaultIdleDelayedExecutor(long checkInterval, TimeUnit checkIntervalUnit) -
getTimeout
-