|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.indi.reactor.SimpleEventHandler
public class SimpleEventHandler
A minimal implementation of the EventHandler interface.
| Field Summary | |
|---|---|
protected java.nio.channels.SelectableChannel |
channel
The channel the handler is associated with |
protected Reactor |
reactor
the reactor the handler is registered with |
protected int |
registeredOperations
bitmask of the operation the handler is registered for |
| Constructor Summary | |
|---|---|
SimpleEventHandler(Reactor r,
java.nio.channels.SelectableChannel ch)
class constructor |
|
| Method Summary | |
|---|---|
java.nio.channels.SelectableChannel |
channel()
|
void |
onAccept()
Called by the reactor whenever a new connection is ready to be accepted (passive connection establishment) |
void |
onClose()
Called by the reactor when the handler is removed |
void |
onConnect()
Called by the reactor whenever a new Connection is ready to be estabished (active connection establishment) |
void |
onRead()
Called by the reactor whenever data is ready for reading. |
void |
onWrite()
Called by the reactor whenever a connection is ready for writing |
void |
register(int ops)
Register the handler with the reactor for certain IO events |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.nio.channels.SelectableChannel channel
protected Reactor reactor
protected int registeredOperations
| Constructor Detail |
|---|
public SimpleEventHandler(Reactor r,
java.nio.channels.SelectableChannel ch)
r - the reactor to register withch - the channel to use| Method Detail |
|---|
public void register(int ops)
EventHandler
register in interface EventHandlerops - Bitmask descibing the events the handler is to be
registered forEventHandler.register(int)public java.nio.channels.SelectableChannel channel()
channel in interface EventHandlerEventHandler.channel()
public void onRead()
throws java.io.IOException
EventHandler
onRead in interface EventHandlerjava.io.IOExceptionEventHandler.onRead()
public void onAccept()
throws java.io.IOException,
java.nio.channels.ClosedChannelException
EventHandler
onAccept in interface EventHandlerjava.io.IOException
java.nio.channels.ClosedChannelExceptionEventHandler.onAccept()
public void onConnect()
throws java.io.IOException
EventHandler
onConnect in interface EventHandlerjava.io.IOExceptionEventHandler.onConnect()
public void onWrite()
throws java.io.IOException
EventHandler
onWrite in interface EventHandlerjava.io.IOExceptionEventHandler.onWrite()public void onClose()
EventHandler
onClose in interface EventHandlerEventHandler.onClose()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||