java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.utils.IdleTimeoutFilter
- All Implemented Interfaces:
Filter
The Filter is responsible for tracking
Connection activity and closing Connection once it becomes
idle for certain amount of time. Unlike ActivityCheckFilter, this Filter assumes Connection is idle,
when no event is being executed on it. But if some event processing was suspended - this Filter still assumes
Connection is active.- Author:
- Alexey Stashok
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionIdleTimeoutFilter(DelayedExecutor executor, long timeout, TimeUnit timeoutUnit) IdleTimeoutFilter(DelayedExecutor executor, long timeout, TimeUnit timeUnit, IdleTimeoutFilter.TimeoutHandler handler) protectedIdleTimeoutFilter(DelayedExecutor executor, DelayedExecutor.Worker<Connection> worker, IdleTimeoutFilter.TimeoutResolver timeoutResolver) IdleTimeoutFilter(DelayedExecutor executor, IdleTimeoutFilter.TimeoutResolver timeoutResolver) IdleTimeoutFilter(DelayedExecutor executor, IdleTimeoutFilter.TimeoutResolver timeoutResolver, IdleTimeoutFilter.TimeoutHandler handler) -
Method Summary
Modifier and TypeMethodDescriptionstatic DelayedExecutorstatic DelayedExecutorcreateDefaultIdleDelayedExecutor(long checkInterval, TimeUnit checkIntervalUnit) 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.protected voidstatic voidsetCustomTimeout(Connection connection, long timeout, TimeUnit timeunit) Provides an override mechanism for the default timeout.Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, handleEvent, onAdded, onFilterChainChanged, onRemoved, toString
-
Field Details
-
FOREVER
-
FOREVER_SPECIAL
-
IDLE_ATTRIBUTE_NAME
- See Also:
-
-
Constructor Details
-
IdleTimeoutFilter
-
IdleTimeoutFilter
public IdleTimeoutFilter(DelayedExecutor executor, IdleTimeoutFilter.TimeoutResolver timeoutResolver) -
IdleTimeoutFilter
public IdleTimeoutFilter(DelayedExecutor executor, long timeout, TimeUnit timeUnit, IdleTimeoutFilter.TimeoutHandler handler) -
IdleTimeoutFilter
public IdleTimeoutFilter(DelayedExecutor executor, IdleTimeoutFilter.TimeoutResolver timeoutResolver, IdleTimeoutFilter.TimeoutHandler handler) -
IdleTimeoutFilter
protected IdleTimeoutFilter(DelayedExecutor executor, DelayedExecutor.Worker<Connection> worker, IdleTimeoutFilter.TimeoutResolver timeoutResolver)
-
-
Method Details
-
handleAccept
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when server channel has accepted the client connection. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleAcceptin interfaceFilter- Overrides:
handleAcceptin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleConnect
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when channel gets connected. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleConnectin interfaceFilter- Overrides:
handleConnectin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleRead
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when channel will become available for reading. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleReadin interfaceFilter- Overrides:
handleReadin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleWrite
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when some data should be written on channel. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleWritein interfaceFilter- Overrides:
handleWritein classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleClose
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when connection has been closed. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleClosein interfaceFilter- Overrides:
handleClosein classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
getResolver
-
createDefaultIdleDelayedExecutor
-
createDefaultIdleDelayedExecutor
public static DelayedExecutor createDefaultIdleDelayedExecutor(long checkInterval, TimeUnit checkIntervalUnit) -
setCustomTimeout
Provides an override mechanism for the default timeout.- Parameters:
connection- TheConnectionwhich is having the idle detection adjusted.timeout- the new idle timeout.timeunit-TimeUnit.
-
queueAction
-