Interface GridNioFilter
-
- All Known Implementing Classes:
GridConnectionBytesVerifyFilter,GridNioAsyncNotifyFilter,GridNioCodecFilter,GridNioFilterAdapter,GridNioFilterChain,GridNioSslFilter,GridNioTracerFilter
public interface GridNioFilterThis interface defines the general element in transformation chain between the nio server and application.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GridNioFilternextFilter()Gets next filter in filter chain.voidnextFilter(GridNioFilter filter)Sets next filter in filter chain.voidonExceptionCaught(GridNioSession ses, IgniteCheckedException ex)Invoked when exception is caught in filter processing.voidonMessageReceived(GridNioSession ses, Object msg)Invoked when a new messages received.GridNioFuture<?>onPauseReads(GridNioSession ses)Pauses reads for session.GridNioFuture<?>onResumeReads(GridNioSession ses)Resumes reads for session.GridNioFuture<Boolean>onSessionClose(GridNioSession ses)Invoked when a session close request is performed on session.voidonSessionClosed(GridNioSession ses)Invoked after session get closed.voidonSessionIdleTimeout(GridNioSession ses)Called when session is idle for longer time that is allowed by NIO server.voidonSessionOpened(GridNioSession ses)Invoked when a new session was created.GridNioFuture<?>onSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC)Invoked when a write request is performed on a session.voidonSessionWriteTimeout(GridNioSession ses)Called when session has not empty write buffer that has not been fully flushed during max timeout allowed by NIO server.GridNioFilterpreviousFilter()Gets previous filter in filter chain.voidpreviousFilter(GridNioFilter filter)Sets previous filter in filter chain.voidproceedExceptionCaught(GridNioSession ses, IgniteCheckedException e)Forwards GridNioException event to the next logical filter in filter chain.voidproceedMessageReceived(GridNioSession ses, Object msg)Forwards received message to the next logical filter in filter chain.GridNioFuture<?>proceedPauseReads(GridNioSession ses)Pauses reads for session.GridNioFuture<?>proceedResumeReads(GridNioSession ses)Resumes reads for session.GridNioFuture<Boolean>proceedSessionClose(GridNioSession ses)Forwards session close request to the next logical filter in filter chain.voidproceedSessionClosed(GridNioSession ses)Forwards session closed event to the next logical filter in filter chain.voidproceedSessionIdleTimeout(GridNioSession ses)Forwards session idle notification to the next logical filter in filter chain.voidproceedSessionOpened(GridNioSession ses)Forwards session opened event to the next logical filter in filter chain.GridNioFuture<?>proceedSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC)Forwards write request to the next logical filter in filter chain.voidproceedSessionWriteTimeout(GridNioSession ses)Forwards session write timeout notification to the next logical filter in filter chain.voidstart()Beginning of a filter lifecycle, invoked on server start.voidstop()End of a filter lifecycle, invoked on server stop.
-
-
-
Method Detail
-
start
void start()
Beginning of a filter lifecycle, invoked on server start. It is guaranteed that this method will be invoked prior to any of the event-related methods.
-
stop
void stop()
End of a filter lifecycle, invoked on server stop. It is guaranteed that this method will be invoked after all events are processed, no more event-related methods will be invoked after this method called.
-
nextFilter
GridNioFilter nextFilter()
Gets next filter in filter chain.- Returns:
- Next filter (in order from application to network layer).
-
previousFilter
GridNioFilter previousFilter()
Gets previous filter in filter chain.- Returns:
- Previous filter (in order from application to network layer).
-
nextFilter
void nextFilter(GridNioFilter filter)
Sets next filter in filter chain. In filter chain next filter would be more close to the network layer.- Parameters:
filter- Next filter in filter chain.
-
previousFilter
void previousFilter(GridNioFilter filter)
Sets previous filter in filter chain. In filter chain previous filter would be more close to application layer.- Parameters:
filter- Previous filter in filter chain.
-
proceedSessionOpened
void proceedSessionOpened(GridNioSession ses) throws IgniteCheckedException
Forwards session opened event to the next logical filter in filter chain.- Parameters:
ses- Opened session.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedSessionClosed
void proceedSessionClosed(GridNioSession ses) throws IgniteCheckedException
Forwards session closed event to the next logical filter in filter chain.- Parameters:
ses- Closed session.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedExceptionCaught
void proceedExceptionCaught(GridNioSession ses, IgniteCheckedException e) throws IgniteCheckedException
Forwards GridNioException event to the next logical filter in filter chain.- Parameters:
ses- Session instance.e- GridNioException instance.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedMessageReceived
void proceedMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException
Forwards received message to the next logical filter in filter chain.- Parameters:
ses- Session instance.msg- Received message.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedSessionWrite
GridNioFuture<?> proceedSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException
Forwards write request to the next logical filter in filter chain.- Parameters:
ses- Session instance.msg- Message to send.fut-Trueif write future should be created.ackC- Closure invoked when message ACK is received.- Returns:
- Write future or
null. - Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedSessionClose
GridNioFuture<Boolean> proceedSessionClose(GridNioSession ses) throws IgniteCheckedException
Forwards session close request to the next logical filter in filter chain.- Parameters:
ses- Session instance.- Returns:
- Close future.
- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
onSessionOpened
void onSessionOpened(GridNioSession ses) throws IgniteCheckedException
Invoked when a new session was created.- Parameters:
ses- Opened session.- Throws:
IgniteCheckedException- If GridNioException occurred while handling event.
-
onSessionClosed
void onSessionClosed(GridNioSession ses) throws IgniteCheckedException
Invoked after session get closed.- Parameters:
ses- Closed session.- Throws:
IgniteCheckedException- If GridNioException occurred while handling event.
-
onExceptionCaught
void onExceptionCaught(GridNioSession ses, IgniteCheckedException ex) throws IgniteCheckedException
Invoked when exception is caught in filter processing.- Parameters:
ses- Session that caused IgniteCheckedException.ex- GridNioException instance.- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionWrite
GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg, boolean fut, IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException
Invoked when a write request is performed on a session.- Parameters:
ses- Session on which message should be written.msg- Message being written.fut-Trueif write future should be created.ackC- Closure invoked when message ACK is received.- Returns:
- Write future or
null. - Throws:
GridNioException- If GridNioException occurred while handling event.IgniteCheckedException
-
onMessageReceived
void onMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException
Invoked when a new messages received.- Parameters:
ses- Session on which message was received.msg- Received message.- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionClose
GridNioFuture<Boolean> onSessionClose(GridNioSession ses) throws IgniteCheckedException
Invoked when a session close request is performed on session.- Parameters:
ses- Session to close.- Returns:
- Close future.
- Throws:
IgniteCheckedException- If IgniteCheckedException occurred while handling event.
-
onSessionIdleTimeout
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.
-
proceedSessionIdleTimeout
void proceedSessionIdleTimeout(GridNioSession ses) throws IgniteCheckedException
Forwards session idle notification to the next logical filter in filter chain.- Parameters:
ses- Session instance.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
onSessionWriteTimeout
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.
-
proceedSessionWriteTimeout
void proceedSessionWriteTimeout(GridNioSession ses) throws IgniteCheckedException
Forwards session write timeout notification to the next logical filter in filter chain.- Parameters:
ses- Session instance.- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedPauseReads
GridNioFuture<?> proceedPauseReads(GridNioSession ses) throws IgniteCheckedException
Pauses reads for session.- Parameters:
ses- Session.- Returns:
- Future for operation.
- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
onPauseReads
GridNioFuture<?> onPauseReads(GridNioSession ses) throws IgniteCheckedException
Pauses reads for session.- Parameters:
ses- Session.- Returns:
- Future for operation.
- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
proceedResumeReads
GridNioFuture<?> proceedResumeReads(GridNioSession ses) throws IgniteCheckedException
Resumes reads for session.- Parameters:
ses- Session.- Returns:
- Future for operation.
- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
onResumeReads
GridNioFuture<?> onResumeReads(GridNioSession ses) throws IgniteCheckedException
Resumes reads for session.- Parameters:
ses- Session.- Returns:
- Future for operation.
- Throws:
IgniteCheckedException- If filter is not in chain or GridNioException occurred in the underlying filter.
-
-