rabbit.io
Interface HandlerRegistration

All Known Implementing Classes:
MultiHandlerRegistration, SimpleHandlerRegistration

public interface HandlerRegistration

A class to hold information about when an operation was attached to the selector. Needed for timeout options.


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.
 void unregister(SelectionKey sk, SocketHandler sh, String reason)
          unregister the given handler.
 

Method Detail

isExpired

boolean isExpired(long now,
                  long timeout)
Check if this registration is expired.


getHandler

SocketHandler getHandler(SelectionKey sk)
Get the handler for the key.


register

void register(int currentOps,
              int newOps,
              SelectionKey sk,
              SocketHandler sh,
              long when)
Registers a new handler to the given selection key.

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

void unregister(SelectionKey sk,
                SocketHandler sh,
                String reason)
unregister the given handler.

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

timeout

void timeout()
This handler has timed out.


getDescription

String getDescription()
Get a text description