Rice Pastry API

rice.pastry.wire
Class SelectorManager

java.lang.Object
  |
  +--rice.pastry.wire.SelectorManager

public class SelectorManager
extends java.lang.Object

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.10 2003/06/05 21:32:04 amislove Exp $
Author:
Alan Mislove

Field Summary
 int SELECT_WAIT_TIME
           
 
Constructor Summary
SelectorManager(rice.pastry.wire.WirePastryNode node)
          Constructor.
 
Method Summary
 java.nio.channels.Selector getSelector()
          Returns the selector used by this SelectorManager.
 void kill()
          To be used for testing purposes only - kills the socket client by shutting down all outgoing sockets and stopping the client thread.
 void run()
          This method starts the datagram manager listening for incoming datagrams.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECT_WAIT_TIME

public int SELECT_WAIT_TIME
Constructor Detail

SelectorManager

public SelectorManager(rice.pastry.wire.WirePastryNode node)
Constructor.

Parameters:
node - The pastry node this SocketManager is serving
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.


Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection