org.apache.ignite.internal.processors.rest.protocols.tcp

## Class GridTcpMemcachedNioListener

- java.lang.Object
- - org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter<GridMemcachedMessage>
  - - org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener

All Implemented Interfaces:
  EventListener, GridNioServerListener<GridMemcachedMessage>

    public class GridTcpMemcachedNioListener
    extends GridNioServerListenerAdapter<GridMemcachedMessage>

Handles memcache requests.

### Constructor Summary

Constructors
Constructor and Description
`GridTcpMemcachedNioListener(IgniteLogger log, GridRestProtocolHandler hnd)` Creates listener which will convert incoming tcp packets to rest requests and forward them to a given rest handler.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `onConnected(GridNioSession ses)` This method is called whenever a new client is connected and session is created.
`void` `onDisconnected(GridNioSession ses, @Nullable Exception e)` This method is called whenever client is disconnected due to correct connection close or due to `IOException` during network operations.
`void` `onMessage(GridNioSession ses, GridMemcachedMessage req)` This method is called whenever a `GridNioParser` returns non-null value.

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

`onFailure, onMessageSent, onSessionIdleTimeout, onSessionWriteTimeout`

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

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

### Constructor Detail

#### GridTcpMemcachedNioListener

    public GridTcpMemcachedNioListener(IgniteLogger log,
                                       GridRestProtocolHandler hnd)

Creates listener which will convert incoming tcp packets to rest requests and forward them to a given rest handler.

Parameters:
  `log` - Logger to use.
  `hnd` - Rest handler.

### Method Detail

#### onConnected

    public void onConnected(GridNioSession ses)

This method is called whenever a new client is connected and session is created.

Parameters:
  `ses` - Newly created session for remote client.

#### onDisconnected

    public void onDisconnected(GridNioSession ses,
                               @Nullable
                               @Nullable Exception e)

This method is called whenever client is disconnected due to correct connection close or due to `IOException` during network operations.

Parameters:
  `ses` - Closed session.
  `e` - Exception occurred, if any.

#### onMessage

    public void onMessage(GridNioSession ses,
                          GridMemcachedMessage req)

This method is called whenever a `GridNioParser` returns non-null value.

Parameters:
  `ses` - Session on which message was received.
  `req` - Parsed message.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021