public abstract class AbstractHandler extends Object implements SelectionHandler, MigratableHandler
Modifier and Type | Field and Description |
---|---|
protected SocketConnection |
connection |
protected SwCounter |
eventCount |
protected NonBlockingIOThread |
ioThread |
protected ILogger |
logger |
protected SelectionKey |
selectionKey |
protected SocketChannelWrapper |
socketChannel |
Constructor and Description |
---|
AbstractHandler(SocketConnection connection,
NonBlockingIOThread ioThread,
int initialOps,
ILogger logger,
IOBalancer ioBalancer) |
Modifier and Type | Method and Description |
---|---|
long |
getEventCount()
Get number of events recorded by the current handler.
|
NonBlockingIOThread |
getOwner()
Get NonBlockingIOThread currently owning this handler.
|
protected SelectionKey |
getSelectionKey() |
SocketChannelWrapper |
getSocketChannel() |
void |
onFailure(Throwable e)
Is called when the
SelectionHandler.handle() throws an exception. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handle
requestMigration
protected final SwCounter eventCount
protected final ILogger logger
protected final SocketChannelWrapper socketChannel
protected final SocketConnection connection
protected NonBlockingIOThread ioThread
protected SelectionKey selectionKey
public AbstractHandler(SocketConnection connection, NonBlockingIOThread ioThread, int initialOps, ILogger logger, IOBalancer ioBalancer)
public SocketChannelWrapper getSocketChannel()
public long getEventCount()
MigratableHandler
NonBlockingIOThread
getEventCount
in interface MigratableHandler
public NonBlockingIOThread getOwner()
MigratableHandler
IOBalancer
can decide to migrate
a handler to another owner.getOwner
in interface MigratableHandler
protected SelectionKey getSelectionKey() throws IOException
IOException
public void onFailure(Throwable e)
SelectionHandler
SelectionHandler.handle()
throws an exception.
The idiom to use a handler is:
try{
handler.handle();
} catch(Throwable t) {
handler.onFailure(t);
}
onFailure
in interface SelectionHandler
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.