org.indi.reactor
Interface EventHandler

All Known Implementing Classes:
Acceptor, Connector, OutputQueue, SimpleEventHandler

public interface EventHandler

Basic Handler class for IO events.

Author:
Dirk Hünniger

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
 

Method Detail

channel

java.nio.channels.SelectableChannel channel()
Returns:
the SelectableChannel for which this Handler is to be listening

onRead

void onRead()
            throws java.io.IOException
Called by the reactor whenever data is ready for reading.

Throws:
java.io.IOException

onAccept

void onAccept()
              throws java.io.IOException,
                     java.nio.channels.ClosedChannelException
Called by the reactor whenever a new connection is ready to be accepted (passive connection establishment)

Throws:
java.io.IOException
java.nio.channels.ClosedChannelException

onConnect

void onConnect()
               throws java.io.IOException
Called by the reactor whenever a new Connection is ready to be estabished (active connection establishment)

Throws:
java.io.IOException

onWrite

void onWrite()
             throws java.io.IOException
Called by the reactor whenever a connection is ready for writing

Throws:
java.io.IOException

onClose

void onClose()
Called by the reactor when the handler is removed


register

void register(int ops)
              throws java.nio.channels.ClosedChannelException,
                     java.io.IOException
Register the handler with the reactor for certain IO events

Parameters:
ops - Bitmask descibing the events the handler is to be registered for
Throws:
java.nio.channels.ClosedChannelException
java.io.IOException


Copyright © 2008. All Rights Reserved.