|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rice.pastry.dist.DistPastryNodeFactory | +--rice.pastry.socket.SocketPastryNodeFactory
A direct mimic to WirePastryNodeFactory class. An abstraction of the nodeId factory for distributed nodes. In order to obtain a nodeId factory, a client should use the getFactory method, passing in either PROTOCOL_TCP or PROTOCOL_UDP as the protocol, and the port number the factory should use.
Field Summary | |
protected EventFactory |
_factory
|
protected java.net.InetSocketAddress |
_laddr
|
protected rice.pastry.NodeIdFactory |
_nidFactory
|
protected int |
_port
|
protected int |
_protocol
|
protected rice.pastry.wire.messaging.socket.NodeIdResponseMessage |
_response
|
protected boolean |
_serialize
|
protected Transport |
_transport
|
static int |
leafSetMaintFreq
|
static int |
lSetSize
|
static int |
maxOpenSockets
|
static int |
PROTOCOL_TCP
|
static int |
PROTOCOL_UDP
|
static int |
routeSetMaintFreq
|
static int |
rtMax
|
Fields inherited from class rice.pastry.dist.DistPastryNodeFactory |
PROTOCOL_RMI, PROTOCOL_WIRE |
Constructor Summary | |
SocketPastryNodeFactory(boolean serialize,
rice.pastry.NodeIdFactory nf,
int proto,
int startPort)
|
Method Summary | |
void |
connectionClosed(Address peer)
Called when an connection closed. |
void |
connectionOpened(Address peer)
Called when an connection opened. |
void |
dataReceived(Adu adu,
Header header)
Called when new data is received. |
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. |
static rice.pastry.dist.DistPastryNodeFactory |
getFactory(boolean serialize,
rice.pastry.NodeIdFactory nf,
int protocol,
int port)
Static method which is designed to be used by clients needing a distrubuted pastry node factory. |
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 |
public static int PROTOCOL_TCP
public static int PROTOCOL_UDP
public static final int rtMax
public static final int lSetSize
public static final int maxOpenSockets
public static final int leafSetMaintFreq
public static final int routeSetMaintFreq
protected rice.pastry.NodeIdFactory _nidFactory
protected int _protocol
protected int _port
protected boolean _serialize
protected Transport _transport
protected EventFactory _factory
protected java.net.InetSocketAddress _laddr
protected rice.pastry.wire.messaging.socket.NodeIdResponseMessage _response
Constructor Detail |
public SocketPastryNodeFactory(boolean serialize, rice.pastry.NodeIdFactory nf, int proto, int startPort)
Method Detail |
public void dataReceived(Adu adu, Header header)
TransportListener
dataReceived
in interface TransportListener
public void connectionOpened(Address peer)
TransportListener
connectionOpened
in interface TransportListener
public void connectionClosed(Address peer)
TransportListener
connectionClosed
in interface TransportListener
public rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
generateNodeHandle
in class rice.pastry.dist.DistPastryNodeFactory
address
- The address of the remote node.
public rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap)
newNode
in interface rice.pastry.PastryNodeFactory
newNode
in class rice.pastry.dist.DistPastryNodeFactory
bootstrap
- Node handle to bootstrap from.
public rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap, rice.pastry.NodeId nodeId)
newNode
in interface rice.pastry.PastryNodeFactory
newNode
in class rice.pastry.dist.DistPastryNodeFactory
bootstrap
- Node handle to bootstrap from.
private java.net.InetSocketAddress getAddress(int portNumber)
portNumber
- The port number to create the address at.
private void debug(java.lang.String s)
public static rice.pastry.dist.DistPastryNodeFactory getFactory(boolean serialize, rice.pastry.NodeIdFactory nf, int protocol, int port)
protocol
- The protocol to use (PROTOCOL_TCP or PROTOCOL_UDP)port
- The starting port.
java.lang.IllegalArgumentException
- If protocol is an unsupported port.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |