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, waithandlerequestMigrationprotected 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()
MigratableHandlerNonBlockingIOThreadgetEventCount in interface MigratableHandlerpublic NonBlockingIOThread getOwner()
MigratableHandlerIOBalancer can decide to migrate
a handler to another owner.getOwner in interface MigratableHandlerprotected SelectionKey getSelectionKey() throws IOException
IOExceptionpublic void onFailure(Throwable e)
SelectionHandlerSelectionHandler.handle() throws an exception.
The idiom to use a handler is:
try{
handler.handle();
} catch(Throwable t) {
handler.onFailure(t);
}
onFailure in interface SelectionHandlerCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.