rice.pastry.wire
Class TcpPastryNodeFactory

java.lang.Object
  |
  +--rice.pastry.dist.DistPastryNodeFactory
        |
        +--rice.pastry.wire.WirePastryNodeFactory
              |
              +--rice.pastry.wire.TcpPastryNodeFactory
All Implemented Interfaces:
rice.pastry.PastryNodeFactory

public class TcpPastryNodeFactory
extends rice.pastry.wire.WirePastryNodeFactory

A pastry node factory producing TcpNodeHandle, everything else is same to WirePastryNodeFactory.

Version:
$Id: TcpPastryNodeFactory.java,v 1.2 2003/09/20 21:35:53 glchen Exp $
Author:
Guanling Chen

Field Summary
protected  rice.pastry.NodeIdFactory _nidFactory
           
protected  int _port
           
private static int leafSetMaintFreq
           
private static int lSetSize
           
private static int maxOpenSockets
           
private static int routeSetMaintFreq
           
private static int rtMax
           
 
Fields inherited from class rice.pastry.wire.WirePastryNodeFactory
 
Fields inherited from class rice.pastry.dist.DistPastryNodeFactory
PROTOCOL_RMI, PROTOCOL_WIRE
 
Constructor Summary
TcpPastryNodeFactory(rice.pastry.NodeIdFactory nf, int startPort)
           
 
Method Summary
private  void debug(java.lang.String s)
           
 rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
          Method which contructs a node handle (using the wire protocol) for the node at address NodeHandle.
private  java.net.InetSocketAddress getAddress(int portNumber)
          Method which constructs an InetSocketAddres for the local host with the specifed port number.
 rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap)
          Method which creates a Pastry node from the next port with a randomly generated NodeId.
 rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap, rice.pastry.NodeId nodeId)
          Method which creates a Pastry node from the next port with a randomly generated NodeId.
 
Methods inherited from class rice.pastry.dist.DistPastryNodeFactory
getFactory, getNodeHandle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_nidFactory

protected rice.pastry.NodeIdFactory _nidFactory

_port

protected int _port

rtMax

private static final int rtMax
See Also:
Constant Field Values

lSetSize

private static final int lSetSize
See Also:
Constant Field Values

maxOpenSockets

private static final int maxOpenSockets
See Also:
Constant Field Values

leafSetMaintFreq

private static final int leafSetMaintFreq
See Also:
Constant Field Values

routeSetMaintFreq

private static final int routeSetMaintFreq
See Also:
Constant Field Values
Constructor Detail

TcpPastryNodeFactory

public TcpPastryNodeFactory(rice.pastry.NodeIdFactory nf,
                            int startPort)
Method Detail

generateNodeHandle

public rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
Method which contructs a node handle (using the wire protocol) for the node at address NodeHandle.

Overrides:
generateNodeHandle in class rice.pastry.wire.WirePastryNodeFactory
Parameters:
address - The address of the remote node.
Returns:
A NodeHandle cooresponding to that address

newNode

public rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap)
Method which creates a Pastry node from the next port with a randomly generated NodeId.

Specified by:
newNode in interface rice.pastry.PastryNodeFactory
Overrides:
newNode in class rice.pastry.wire.WirePastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.
Returns:
A node with a random ID and next port number.

newNode

public rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap,
                                      rice.pastry.NodeId nodeId)
Method which creates a Pastry node from the next port with a randomly generated NodeId.

Specified by:
newNode in interface rice.pastry.PastryNodeFactory
Overrides:
newNode in class rice.pastry.wire.WirePastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.
Returns:
A node with a random ID and next port number.

getAddress

private java.net.InetSocketAddress getAddress(int portNumber)
Method which constructs an InetSocketAddres for the local host with the specifed port number.

Parameters:
portNumber - The port number to create the address at.
Returns:
An InetSocketAddress at the localhost with port portNumber.

debug

private void debug(java.lang.String s)