Rice Pastry API

rice.selector
Class SelectionKeyHandler

java.lang.Object
  extended by rice.selector.SelectionKeyHandler
Direct Known Subclasses:
PingManager, SocketAppSocket, SocketCollectionManager, SocketCollectionManager.SocketAccepter, SocketCollectionManager.SourceRouteManager

public class SelectionKeyHandler
extends java.lang.Object

This interface is designed to be a callback mechanism from the SelectorManager. Once the manager has determines that something has happened, it informs the appropriate SelectionKeyHandler via this interface. The SelectionKeyHandler which is interested in being notified of events relating to the SelectionKey should attach itself to the SelectionKey via the attach() method. The SelectorManager will then call that SelectionKeyHandler's methods.

Version:
$Id: SelectionKeyHandler.java 3613 2007-02-15 14:45:14Z jstewart $
Author:
Alan Mislove

Constructor Summary
SelectionKeyHandler()
           
 
Method Summary
 void accept(java.nio.channels.SelectionKey key)
          Method which is called when the key becomes acceptable.
 void connect(java.nio.channels.SelectionKey key)
          Method which is called when the key becomes connectable.
 void modifyKey(java.nio.channels.SelectionKey key)
          Method which should change the interestOps of the handler's key.
 void read(java.nio.channels.SelectionKey key)
          Method which is called when the key becomes readable.
 void write(java.nio.channels.SelectionKey key)
          Method which is called when the key becomes writable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionKeyHandler

public SelectionKeyHandler()
Method Detail

modifyKey

public void modifyKey(java.nio.channels.SelectionKey key)
Method which should change the interestOps of the handler's key. This method should *ONLY* be called by the selection thread in the context of a select().

Parameters:
key - The key in question

accept

public void accept(java.nio.channels.SelectionKey key)
Method which is called when the key becomes acceptable.

Parameters:
key - The key which is acceptable.

connect

public void connect(java.nio.channels.SelectionKey key)
Method which is called when the key becomes connectable.

Parameters:
key - The key which is connectable.

read

public void read(java.nio.channels.SelectionKey key)
Method which is called when the key becomes readable.

Parameters:
key - The key which is readable.

write

public void write(java.nio.channels.SelectionKey key)
Method which is called when the key becomes writable.

Parameters:
key - The key which is writable.

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection