org.apache.ignite.internal.util.nio

## Class GridNioFilterAdapter

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

All Implemented Interfaces:
  GridNioFilter

Direct Known Subclasses:
  GridConnectionBytesVerifyFilter, GridNioAsyncNotifyFilter, GridNioCodecFilter, GridNioFilterChain, GridNioSslFilter

    public abstract class GridNioFilterAdapter
    extends Object
    implements GridNioFilter

Class that defines the piece for application-to-network and vice-versa data conversions (protocol transformations, encryption, etc.)

### Field Summary

Fields
`protected GridNioFilter` `nextFilter` Next filter in filter chain.
`protected GridNioFilter` `prevFilter` Previous filter in filter chain.

### Constructor Summary

Constructors
`protected` `GridNioFilterAdapter(String name)` Assigns filter name to a filter.

### Method Summary

Methods
`GridNioFilter` `nextFilter()` Gets next filter in filter chain.
`void` `nextFilter(GridNioFilter filter)` Sets next filter in filter chain.
`GridNioFuture<?>` `onPauseReads(GridNioSession ses)` Pauses reads for session.
`GridNioFuture<?>` `onResumeReads(GridNioSession ses)` Resumes reads for session.
`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.
`String` `toString()`

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

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

### Methods inherited from interface org.apache.ignite.internal.util.nio.GridNioFilter

`onExceptionCaught, onMessageReceived, onSessionClose, onSessionClosed, onSessionIdleTimeout, onSessionOpened, onSessionWrite, onSessionWriteTimeout`

### Field Detail

#### nextFilter

    protected GridNioFilter nextFilter

Next filter in filter chain.

#### prevFilter

    protected GridNioFilter prevFilter

Previous filter in filter chain.

### Constructor Detail

#### GridNioFilterAdapter

    protected GridNioFilterAdapter(String name)

Assigns filter name to a filter.

Parameters:
  `name` - Filter name. Used in filter chain.

### Method Detail

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### start

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

Specified by:
  `start` in interface `GridNioFilter`

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

#### nextFilter

    public GridNioFilter nextFilter()

Gets next filter in filter chain.

Specified by:
  `nextFilter` in interface `GridNioFilter`
Returns:
  Next filter (in order from application to network layer).

#### previousFilter

    public GridNioFilter previousFilter()

Gets previous filter in filter chain.

Specified by:
  `previousFilter` in interface `GridNioFilter`
Returns:
  Previous filter (in order from application to network layer).

#### nextFilter

    public void nextFilter(GridNioFilter filter)

Sets next filter in filter chain. In filter chain next filter would be more close to the network layer.

Specified by:
  `nextFilter` in interface `GridNioFilter`
Parameters:
  `filter` - Next filter in filter chain.

#### previousFilter

    public void previousFilter(GridNioFilter filter)

Sets previous filter in filter chain. In filter chain previous filter would be more close to application layer.

Specified by:
  `previousFilter` in interface `GridNioFilter`
Parameters:
  `filter` - Previous filter in filter chain.

#### proceedSessionOpened

    public void proceedSessionOpened(GridNioSession ses)
                              throws IgniteCheckedException

Forwards session opened event to the next logical filter in filter chain.

Specified by:
  `proceedSessionOpened` in interface `GridNioFilter`
Parameters:
  `ses` - Opened session.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedSessionClosed

    public void proceedSessionClosed(GridNioSession ses)
                              throws IgniteCheckedException

Forwards session closed event to the next logical filter in filter chain.

Specified by:
  `proceedSessionClosed` in interface `GridNioFilter`
Parameters:
  `ses` - Closed session.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedExceptionCaught

    public void proceedExceptionCaught(GridNioSession ses,
                              IgniteCheckedException e)
                                throws IgniteCheckedException

Forwards GridNioException event to the next logical filter in filter chain.

Specified by:
  `proceedExceptionCaught` in interface `GridNioFilter`
Parameters:
  `ses` - Session instance.
  `e` - GridNioException instance.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedMessageReceived

    public void proceedMessageReceived(GridNioSession ses,
                              Object msg)
                                throws IgniteCheckedException

Forwards received message to the next logical filter in filter chain.

Specified by:
  `proceedMessageReceived` in interface `GridNioFilter`
Parameters:
  `ses` - Session instance.
  `msg` - Received message.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedSessionWrite

    public GridNioFuture<?> proceedSessionWrite(GridNioSession ses,
                                       Object msg)
                                         throws IgniteCheckedException

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

Specified by:
  `proceedSessionWrite` in interface `GridNioFilter`
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

    public GridNioFuture<Boolean> proceedSessionClose(GridNioSession ses)
                                               throws IgniteCheckedException

Forwards session close request to the next logical filter in filter chain.

Specified by:
  `proceedSessionClose` in interface `GridNioFilter`
Parameters:
  `ses` - Session instance.
Returns:
  Close future.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedSessionIdleTimeout

    public void proceedSessionIdleTimeout(GridNioSession ses)
                                   throws IgniteCheckedException

Forwards session idle notification to the next logical filter in filter chain.

Specified by:
  `proceedSessionIdleTimeout` in interface `GridNioFilter`
Parameters:
  `ses` - Session instance.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedSessionWriteTimeout

    public void proceedSessionWriteTimeout(GridNioSession ses)
                                    throws IgniteCheckedException

Forwards session write timeout notification to the next logical filter in filter chain.

Specified by:
  `proceedSessionWriteTimeout` in interface `GridNioFilter`
Parameters:
  `ses` - Session instance.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedPauseReads

    public GridNioFuture<?> proceedPauseReads(GridNioSession ses)
                                       throws IgniteCheckedException

Pauses reads for session.

Specified by:
  `proceedPauseReads` in interface `GridNioFilter`
Parameters:
  `ses` - Session.
Returns:
  Future for operation.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### proceedResumeReads

    public GridNioFuture<?> proceedResumeReads(GridNioSession ses)
                                        throws IgniteCheckedException

Resumes reads for session.

Specified by:
  `proceedResumeReads` in interface `GridNioFilter`
Parameters:
  `ses` - Session.
Returns:
  Future for operation.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### onPauseReads

    public GridNioFuture<?> onPauseReads(GridNioSession ses)
                                  throws IgniteCheckedException

Pauses reads for session.

Specified by:
  `onPauseReads` in interface `GridNioFilter`
Parameters:
  `ses` - Session.
Returns:
  Future for operation.
Throws:
  `IgniteCheckedException` - If filter is not in chain or GridNioException occurred in the underlying filter.

#### onResumeReads

    public GridNioFuture<?> onResumeReads(GridNioSession ses)
                                   throws IgniteCheckedException

Resumes reads for session.

Specified by:
  `onResumeReads` in interface `GridNioFilter`
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
Release Date | : March 31 2015