rice.pastry.wire
Class SelectorManager

public class SelectorManager
This class is the class which handles the selector, and listens for activity. When activity occurs, it figures out who is interested in what has happened, and hands off to that object.
Version:
$Id: SelectorManager.java,v 1.8 2002/09/13 15:58:43 amislove Exp $
Author:
Alan Mislove
Constructor Detail

SelectorManager

public SelectorManager(rice.pastry.wire.WirePastryNode node)
Constructor.
Parameters:
node - The pastry node this SocketManager is serving
port - The port number this Datagram Manager should run on

Method Detail

getSelector

public java.nio.channels.Selector getSelector()
Returns the selector used by this SelectorManager. NOTE: All operations using the selector which change the Selector's keySet MUST synchronize on the Selector itself. (i.e.: synchronized (selector) { channel.register(selector, ...); } ).
Returns:
The Selector used by this object.

run

public void run()
This method starts the datagram manager listening for incoming datagrams. It is designed to be started when this thread's start() method is invoked. In this method, the DatagramManager blocks while waiting for activity. It listens on its specified port for incoming datagrams, and processes any write() requests from pastry node handles.

kill

public void kill()
To be used for testing purposes only - kills the socket client by shutting down all outgoing sockets and stopping the client thread.