rabbit.io
Class MultiHandlerRegistration

java.lang.Object
  extended by rabbit.io.MultiHandlerRegistration
All Implemented Interfaces:
HandlerRegistration

public class MultiHandlerRegistration
extends Object
implements HandlerRegistration

A multiplexing handler registration.

Author:
Robert Olofsson

Constructor Summary
MultiHandlerRegistration(SocketHandler reader, long readWhen, SocketHandler writer, long writeWhen)
           
 
Method Summary
 String getDescription()
          Get a text description
 SocketHandler getHandler(SelectionKey sk)
          Get the handler for the key.
 boolean isExpired(long now, long timeout)
          Check if this registration is expired.
 void register(int currentOps, int newOps, SelectionKey sk, SocketHandler sh, long when)
          Registers a new handler to the given selection key.
 void timeout()
          This handler has timed out.
 String toString()
           
 void unregister(SelectionKey sk, SocketHandler sh, String reason)
          unregister the given handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiHandlerRegistration

public MultiHandlerRegistration(SocketHandler reader,
                                long readWhen,
                                SocketHandler writer,
                                long writeWhen)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getDescription

public String getDescription()
Description copied from interface: HandlerRegistration
Get a text description

Specified by:
getDescription in interface HandlerRegistration

isExpired

public boolean isExpired(long now,
                         long timeout)
Description copied from interface: HandlerRegistration
Check if this registration is expired.

Specified by:
isExpired in interface HandlerRegistration

getHandler

public SocketHandler getHandler(SelectionKey sk)
Description copied from interface: HandlerRegistration
Get the handler for the key.

Specified by:
getHandler in interface HandlerRegistration

register

public void register(int currentOps,
                     int newOps,
                     SelectionKey sk,
                     SocketHandler sh,
                     long when)
Description copied from interface: HandlerRegistration
Registers a new handler to the given selection key.

Specified by:
register in interface HandlerRegistration
Parameters:
currentOps - the current interest ops
newOps - the ops to handle
sk - the current channel key.
sh - the new handler to register.
when - the new timeout timing

unregister

public void unregister(SelectionKey sk,
                       SocketHandler sh,
                       String reason)
Description copied from interface: HandlerRegistration
unregister the given handler.

Specified by:
unregister in interface HandlerRegistration
Parameters:
sk - the current channel key.
sh - the handler to unregister.
reason - a text message saying why the unregistration happened.

timeout

public void timeout()
Description copied from interface: HandlerRegistration
This handler has timed out.

Specified by:
timeout in interface HandlerRegistration