Rice Pastry API

rice.pastry.socket
Class SocketPastryNode

java.lang.Object
  extended byjava.util.Observable
      extended byrice.pastry.PastryNode
          extended byrice.pastry.dist.DistPastryNode
              extended byrice.pastry.socket.SocketPastryNode
All Implemented Interfaces:
Destructable, Node, NodeHandleFactory

public class SocketPastryNode
extends DistPastryNode

An Socket-based Pastry node, which has two threads - one thread for performing route set and leaf set maintainance, and another thread for listening on the sockets and performing all non-blocking I/O.

Version:
$Id: SocketPastryNode.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Alan Mislove

Field Summary
 
Fields inherited from class rice.pastry.dist.DistPastryNode
leafSetMaintFreq, leafSetRoutineMaintenance, routeSetMaintFreq, routeSetRoutineMaintenance, timer
 
Fields inherited from class rice.pastry.PastryNode
apps, localhandle, logger, myNodeId
 
Constructor Summary
SocketPastryNode(Id id, Environment e)
          Constructor
 
Method Summary
 void acceptAppSocket(rice.pastry.socket.SocketAppSocket socket, int appId)
          DESCRIBE THE METHOD
 NodeHandle coalesce(NodeHandle newHandle)
          DESCRIBE THE METHOD
 void connect(NodeHandle handle, AppSocketReceiver receiver, PastryAppl appl, int timeout)
          DESCRIBE THE METHOD
 void destroy()
          Makes this node resign from the network.
 void doneNode(NodeHandle bootstrap)
          Called after the node is initialized.
 SocketSourceRouteManager getSocketSourceRouteManager()
          Returns the SocketSourceRouteManager for this pastry node.
 NodeHandle readNodeHandle(InputBuffer buf)
          DESCRIBE THE METHOD
 void send(NodeHandle handle, Message message)
          DESCRIBE THE METHOD
 void setSocketElements(EpochInetSocketAddress address, int lsmf, int rsmf)
          Helper method which allows the WirePastryNodeFactory to initialize a number of the pastry node's elements.
 void setSocketSourceRouteManager(SocketSourceRouteManager srManager)
          Sets the SocketSourceRouteManager attribute of the SocketPastryNode object
 java.lang.String toString()
          Prints out a String representation of this node
 
Methods inherited from class rice.pastry.dist.DistPastryNode
addNetworkListener, broadcastChannelClosed, broadcastChannelOpened, broadcastReceivedListeners, broadcastSentListeners, getNetworkListeners, getTimer, initiateJoin, nodeIsReady, process, scheduleMsg, scheduleMsg, scheduleMsgAtFixedRate, scheduleMsgExpBackoff
 
Methods inherited from class rice.pastry.PastryNode
addLeafSetListener, addLeafSetObserver, addRouteSetListener, addRouteSetObserver, buildEndpoint, deleteLeafSetListener, deleteLeafSetObserver, deleteRouteSetObserver, getEnvironment, getId, getIdFactory, getLeafSet, getLocalHandle, getLocalNodeHandle, getMessageDispatch, getNodeId, getRoutingTable, isClosest, isReady, nodeIsReady, receiveMessage, receiveMessage, registerApp, registerApplication, registerReceiver, removeRouteSetListener, setElements, setMessageDispatch, setReady, setReady
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketPastryNode

public SocketPastryNode(Id id,
                        Environment e)
Constructor

Parameters:
id - The NodeId of this Pastry node.
e - DESCRIBE THE PARAMETER
Method Detail

getSocketSourceRouteManager

public SocketSourceRouteManager getSocketSourceRouteManager()
Returns the SocketSourceRouteManager for this pastry node.

Returns:
The SocketSourceRouteManager for this pastry node.

setSocketElements

public void setSocketElements(EpochInetSocketAddress address,
                              int lsmf,
                              int rsmf)
Helper method which allows the WirePastryNodeFactory to initialize a number of the pastry node's elements.

Parameters:
address - The address of this pastry node.
lsmf - Leaf set maintenance frequency. 0 means never.
rsmf - Route set maintenance frequency. 0 means never.

setSocketSourceRouteManager

public void setSocketSourceRouteManager(SocketSourceRouteManager srManager)
Sets the SocketSourceRouteManager attribute of the SocketPastryNode object

Parameters:
srManager - The new SocketSourceRouteManager value

doneNode

public void doneNode(NodeHandle bootstrap)
Called after the node is initialized.

Overrides:
doneNode in class DistPastryNode
Parameters:
bootstrap - The node which this node should boot off of.

toString

public java.lang.String toString()
Prints out a String representation of this node

Overrides:
toString in class PastryNode
Returns:
a String

destroy

public void destroy()
Makes this node resign from the network. Is designed to be used for debugging and testing. If run on the SelectorThread, then destroys now. Other threads cause a task to be placed on the selector, and destroyed asap. Make sure to call super.destroy() !!!

Specified by:
destroy in interface Destructable
Overrides:
destroy in class DistPastryNode

coalesce

public NodeHandle coalesce(NodeHandle newHandle)
DESCRIBE THE METHOD

Specified by:
coalesce in class PastryNode
Parameters:
newHandle - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

send

public void send(NodeHandle handle,
                 Message message)
DESCRIBE THE METHOD

Specified by:
send in class PastryNode
Parameters:
handle - DESCRIBE THE PARAMETER
message - DESCRIBE THE PARAMETER

connect

public void connect(NodeHandle handle,
                    AppSocketReceiver receiver,
                    PastryAppl appl,
                    int timeout)
DESCRIBE THE METHOD

Specified by:
connect in class PastryNode
Parameters:
handle - DESCRIBE THE PARAMETER
receiver - DESCRIBE THE PARAMETER
appl - DESCRIBE THE PARAMETER
timeout - DESCRIBE THE PARAMETER

acceptAppSocket

public void acceptAppSocket(rice.pastry.socket.SocketAppSocket socket,
                            int appId)
                     throws AppSocketException
DESCRIBE THE METHOD

Parameters:
socket - DESCRIBE THE PARAMETER
appId - DESCRIBE THE PARAMETER
Throws:
AppSocketException - DESCRIBE THE EXCEPTION

readNodeHandle

public NodeHandle readNodeHandle(InputBuffer buf)
                          throws java.io.IOException
DESCRIBE THE METHOD

Parameters:
buf - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection