Class GridNioFilterChain<T>
- java.lang.Object
-
- org.apache.ignite.internal.util.nio.GridNioFilterAdapter
-
- org.apache.ignite.internal.util.nio.GridNioFilterChain<T>
-
- All Implemented Interfaces:
GridNioFilter
public class GridNioFilterChain<T> extends GridNioFilterAdapter
Filter chain implementation for nio server filters.
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.util.nio.GridNioFilterAdapter
nextFilter, prevFilter
-
-
Constructor Summary
Constructors Constructor Description GridNioFilterChain(IgniteLogger log, GridNioServerListener<T> lsnr, GridNioFilter head, GridNioFilter... filters)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonExceptionCaught(GridNioSession ses, IgniteCheckedException e)Starts chain notification from head to tail.voidonMessageReceived(GridNioSession ses, Object msg)Starts chain notification from head to tail.GridNioFuture<?>onPauseReads(GridNioSession ses)Starts chain notification from tail to head.GridNioFuture<?>onResumeReads(GridNioSession ses)Starts chain notification from tail to head.GridNioFuture<Boolean>onSessionClose(GridNioSession ses)Starts chain notification from tail to head.voidonSessionClosed(GridNioSession ses)Starts chain notification from head to tail.voidonSessionIdleTimeout(GridNioSession ses)Called when session is idle for longer time that is allowed by NIO server.voidonSessionOpened(GridNioSession ses)Starts chain notification from head to tail.GridNioFuture<?>onSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC)Starts chain notification from tail to head.voidonSessionWriteTimeout(GridNioSession ses)Called when session has not empty write buffer that has not been fully flushed during max timeout allowed by NIO server.voidstart()Starts all filters in order from application layer to the network layer.voidstop()Stops all filters in order from network layer to the application layer.StringtoString()-
Methods inherited from class org.apache.ignite.internal.util.nio.GridNioFilterAdapter
nextFilter, nextFilter, previousFilter, previousFilter, proceedExceptionCaught, proceedMessageReceived, proceedPauseReads, proceedResumeReads, proceedSessionClose, proceedSessionClosed, proceedSessionIdleTimeout, proceedSessionOpened, proceedSessionWrite, proceedSessionWriteTimeout
-
-
-
-
Constructor Detail
-
GridNioFilterChain
public GridNioFilterChain(IgniteLogger log, GridNioServerListener<T> lsnr, GridNioFilter head, GridNioFilter... filters)
Constructor.- Parameters:
log- Logger instance.lsnr- Listener for events passed through chain.head- First filter in chain, it expected to be connected to actual endpoint.filters- Filters applied between listener and head. Will be inserted in the same order, so chain will look like (lsnr) -> (filters[0]) -> ... -> (filters[n]) -> (head).
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classGridNioFilterAdapter
-
start
public void start()
Starts all filters in order from application layer to the network layer.- Specified by:
startin interfaceGridNioFilter- Overrides:
startin classGridNioFilterAdapter
-
stop
public void stop()
Stops all filters in order from network layer to the application layer.- Specified by:
stopin interfaceGridNioFilter- Overrides:
stopin classGridNioFilterAdapter
-
onSessionOpened
public void onSessionOpened(GridNioSession ses) throws IgniteCheckedException
Starts chain notification from head to tail.- Parameters:
ses- Session that was created.- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionClosed
public void onSessionClosed(GridNioSession ses) throws IgniteCheckedException
Starts chain notification from head to tail.- Parameters:
ses- Session that was closed.- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onExceptionCaught
public void onExceptionCaught(GridNioSession ses, IgniteCheckedException e)
Starts chain notification from head to tail.- Parameters:
ses- Session in which GridNioException was caught.e- IgniteCheckedException instance.
-
onMessageReceived
public void onMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException
Starts chain notification from head to tail.- Parameters:
ses- Session in which message was received.msg- Received message.- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionWrite
public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException
Starts chain notification from tail to head.- Parameters:
ses- Session to which message should be written.msg- Message to write.fut-Trueif write future should be created.ackC- Closure invoked when message ACK is received.- Returns:
- Send future.
- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionClose
public GridNioFuture<Boolean> onSessionClose(GridNioSession ses) throws IgniteCheckedException
Starts chain notification from tail to head.- Parameters:
ses- Session to close.- Returns:
- Close future.
- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionIdleTimeout
public void onSessionIdleTimeout(GridNioSession ses) throws IgniteCheckedException
Called when session is idle for longer time that is allowed by NIO server.- Parameters:
ses- Session that is idle.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
onSessionWriteTimeout
public void onSessionWriteTimeout(GridNioSession ses) throws IgniteCheckedException
Called when session has not empty write buffer that has not been fully flushed during max timeout allowed by NIO server.- Parameters:
ses- Session that has timed out writes.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
onPauseReads
public GridNioFuture<?> onPauseReads(GridNioSession ses) throws IgniteCheckedException
Starts chain notification from tail to head.- Specified by:
onPauseReadsin interfaceGridNioFilter- Overrides:
onPauseReadsin classGridNioFilterAdapter- Parameters:
ses- Session to pause reads.- Returns:
- Future.
- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onResumeReads
public GridNioFuture<?> onResumeReads(GridNioSession ses) throws IgniteCheckedException
Starts chain notification from tail to head.- Specified by:
onResumeReadsin interfaceGridNioFilter- Overrides:
onResumeReadsin classGridNioFilterAdapter- Parameters:
ses- Session to resume reads.- Returns:
- Future.
- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
-