com.hazelcast.nio.tcp
Class AbstractSelectionHandler

java.lang.Object
  extended by com.hazelcast.nio.tcp.AbstractSelectionHandler
All Implemented Interfaces:
MigratableHandler, SelectionHandler
Direct Known Subclasses:
ReadHandler, WriteHandler

public abstract class AbstractSelectionHandler
extends Object
implements MigratableHandler


Field Summary
protected  TcpIpConnection connection
           
protected  TcpIpConnectionManager connectionManager
           
protected  IOSelector ioSelector
           
protected  ILogger logger
           
protected  Selector selector
           
protected  SocketChannelWrapper socketChannel
           
 
Constructor Summary
AbstractSelectionHandler(TcpIpConnection connection, IOSelector ioSelector, int initialOps)
           
 
Method Summary
 IOSelector getOwner()
          Get IOSelector currently owning this handler.
protected  SelectionKey getSelectionKey()
           
 void migrate(IOSelector newOwner)
          Migrates this handler to a new IOSelector thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hazelcast.nio.tcp.MigratableHandler
getEventCount
 
Methods inherited from interface com.hazelcast.nio.tcp.SelectionHandler
handle
 

Field Detail

logger

protected final ILogger logger

socketChannel

protected final SocketChannelWrapper socketChannel

connection

protected final TcpIpConnection connection

connectionManager

protected final TcpIpConnectionManager connectionManager

selector

protected Selector selector

ioSelector

protected IOSelector ioSelector
Constructor Detail

AbstractSelectionHandler

public AbstractSelectionHandler(TcpIpConnection connection,
                                IOSelector ioSelector,
                                int initialOps)
Method Detail

migrate

public void migrate(IOSelector newOwner)
Migrates this handler to a new IOSelector thread. The migration logic is rather simple:

Specified by:
migrate in interface MigratableHandler
Parameters:
newOwner - target IOSelector this handler migrates to

getSelectionKey

protected SelectionKey getSelectionKey()

getOwner

public IOSelector getOwner()
Get IOSelector currently owning this handler. Handler owner is a thread running this handler. IOBalancer can decide to migrate a handler to another owner.

Specified by:
getOwner in interface MigratableHandler
Returns:
current owner


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.