org.apache.ignite.internal.util.nio

## Class GridNioAsyncNotifyFilter

- java.lang.Object
- - org.apache.ignite.internal.util.nio.GridNioFilterAdapter
  - - org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter

All Implemented Interfaces:
  GridNioFilter

    public class GridNioAsyncNotifyFilter
    extends GridNioFilterAdapter

Enables multithreaded notification of session opened, message received and session closed events.

### Field Summary

### Fields inherited from class org.apache.ignite.internal.util.nio.GridNioFilterAdapter

`nextFilter, prevFilter`

### Constructor Summary

Constructors
Constructor and Description
`GridNioAsyncNotifyFilter(String gridName, Executor exec, IgniteLogger log)` Assigns filter name to a filter.

### Method Summary

Methods
`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<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.
`void` `stop()` End of a filter lifecycle, invoked on server stop.

### Methods inherited from class org.apache.ignite.internal.util.nio.GridNioFilterAdapter

`nextFilter, nextFilter, onPauseReads, onResumeReads, previousFilter, previousFilter, proceedExceptionCaught, proceedMessageReceived, proceedPauseReads, proceedResumeReads, proceedSessionClose, proceedSessionClosed, proceedSessionIdleTimeout, proceedSessionOpened, proceedSessionWrite, proceedSessionWriteTimeout, start, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### GridNioAsyncNotifyFilter

    public GridNioAsyncNotifyFilter(String gridName,
                            Executor exec,
                            IgniteLogger log)

Assigns filter name to a filter.

Parameters:
  `gridName` - Grid name.
  `exec` - Executor.
  `log` - Logger.

### Method Detail

#### stop

    public 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.

Specified by:
  `stop` in interface `GridNioFilter`
Overrides:
  `stop` in class `GridNioFilterAdapter`

#### onSessionOpened

    public 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

    public void onSessionClosed(GridNioSession ses)
                         throws IgniteCheckedException

Invoked after session get closed.

Parameters:
  `ses` - Closed session.
Throws:
  `IgniteCheckedException` - If GridNioException occurred while handling event.

#### onMessageReceived

    public 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.

#### onExceptionCaught

    public 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

    public 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`

#### onSessionClose

    public 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

    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.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015