Package org.glassfish.grizzly.utils
Class SilentConnectionFilter
- java.lang.Object
-
- org.glassfish.grizzly.filterchain.BaseFilter
-
- 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
Fields Modifier and Type Field Description static longUNLIMITED_TIMEOUTstatic longUNSET_TIMEOUT
-
Constructor Summary
Constructors Constructor Description SilentConnectionFilter(DelayedExecutor executor, long timeout, TimeUnit timeunit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetTimeout(TimeUnit timeunit)NextActionhandleAccept(FilterChainContext ctx)Execute a unit of processing work to be performed, when server channel has accepted the client connection.NextActionhandleClose(FilterChainContext ctx)Execute a unit of processing work to be performed, when connection has been closed.NextActionhandleRead(FilterChainContext ctx)Execute a unit of processing work to be performed, when channel will become available for reading.NextActionhandleWrite(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, handleConnect, handleEvent, onAdded, onFilterChainChanged, onRemoved, toString
-
-
-
-
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, TimeUnit timeunit)
-
-
Method Detail
-
getTimeout
public long getTimeout(TimeUnit timeunit)
-
handleAccept
public NextAction handleAccept(FilterChainContext ctx) throws IOException
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
-
handleRead
public NextAction handleRead(FilterChainContext ctx) throws IOException
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
public NextAction handleWrite(FilterChainContext ctx) throws IOException
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
public NextAction handleClose(FilterChainContext ctx) throws IOException
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
-
-