org.apache.ignite.internal.util.nio

## Interface GridNioFilter

All Known Implementing Classes:
  GridConnectionBytesVerifyFilter, GridNioAsyncNotifyFilter, GridNioCodecFilter, GridNioFilterAdapter, GridNioFilterChain, GridNioSslFilter

    public interface GridNioFilter

This interface defines the general element in transformation chain between the nio server and application.

### Method Summary

Methods
`GridNioFilter` `nextFilter()` Gets next filter in filter chain.
`void` `nextFilter(GridNioFilter filter)` Sets next filter in filter chain.
`void` `onExceptionCaught(GridNioSession ses, IgniteCheckedException ex)` Invoked when exception is caught in filter processing.
`void` `onMessageReceived(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.
`void` `onSessionClosed(GridNioSession ses)` Invoked after session get closed.
`void` `onSessionIdleTimeout(GridNioSession ses)` Called when session is idle for longer time that is allowed by NIO server.
`void` `onSessionOpened(GridNioSession ses)` Invoked when a new session was created.
`GridNioFuture<?>` `onSessionWrite(GridNioSession ses, Object msg)` Invoked when a write request is performed on a session.
`void` `onSessionWriteTimeout(GridNioSession ses)` Called when session has not empty write buffer that has not been fully flushed during max timeout allowed by NIO server.
`GridNioFilter` `previousFilter()` Gets previous filter in filter chain.
`void` `previousFilter(GridNioFilter filter)` Sets previous filter in filter chain.
`void` `proceedExceptionCaught(GridNioSession ses, IgniteCheckedException e)` Forwards GridNioException event to the next logical filter in filter chain.
`void` `proceedMessageReceived(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.
`void` `proceedSessionClosed(GridNioSession ses)` Forwards session closed event to the next logical filter in filter chain.
`void` `proceedSessionIdleTimeout(GridNioSession ses)` Forwards session idle notification to the next logical filter in filter chain.
`void` `proceedSessionOpened(GridNioSession ses)` Forwards session opened event to the next logical filter in filter chain.
`GridNioFuture<?>` `proceedSessionWrite(GridNioSession ses, Object msg)` Forwards write request to the next logical filter in filter chain.
`void` `proceedSessionWriteTimeout(GridNioSession ses)` Forwards session write timeout notification to the next logical filter in filter chain.
`void` `start()` Beginning of a filter lifecycle, invoked on server start.
`void` `stop()` 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)
                                         throws IgniteCheckedException

Forwards write request to the next logical filter in filter chain.

Parameters:
  `ses` - Session instance.
  `msg` - Message to send.
Returns:
  Write future.
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)
                                    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.
Returns:
  Write future.
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.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC3
Release Date | : March 24 2015