|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable rice.pastry.PastryNode
public abstract class PastryNode
A Pastry node is single entity in the pastry network.
Field Summary | |
---|---|
protected java.util.Vector |
apps
|
protected NodeHandle |
localhandle
|
protected Logger |
logger
|
protected NodeId |
myNodeId
|
Constructor Summary | |
---|---|
protected |
PastryNode(NodeId id,
Environment e)
Constructor, with NodeId. |
Method Summary | |
---|---|
void |
addLeafSetListener(NodeSetListener listener)
|
void |
addLeafSetObserver(java.util.Observer o)
Deprecated. use addLeafSetListener |
void |
addRouteSetListener(NodeSetListener listener)
|
void |
addRouteSetObserver(java.util.Observer o)
Deprecated. use addRouteSetListener |
abstract NodeHandle |
coalesce(NodeHandle newHandle)
|
void |
deleteLeafSetListener(NodeSetListener listener)
|
void |
deleteLeafSetObserver(java.util.Observer o)
Deprecated. use deleteLeafSetListener |
void |
deleteRouteSetObserver(java.util.Observer o)
Deprecated. use deleteRouteSetListener |
void |
destroy()
Method which kills a PastryNode. |
Environment |
getEnvironment()
Returns the environment. |
Id |
getId()
Returns the Id of this node |
IdFactory |
getIdFactory()
Returns a factory for Ids specific to this node's protocol. |
LeafSet |
getLeafSet()
|
NodeHandle |
getLocalHandle()
|
NodeHandle |
getLocalNodeHandle()
Returns a handle to the local node. |
MessageDispatch |
getMessageDispatch()
FOR TESTING ONLY - DO NOT USE! |
NodeId |
getNodeId()
|
RoutingTable |
getRoutingTable()
|
abstract void |
initiateJoin(NodeHandle bootstrap)
Overridden by derived classes to initiate the join process |
boolean |
isClosest(NodeId key)
Called by the layered Pastry application to check if the local pastry node is the one that is currently closest to the object key id. |
boolean |
isReady()
|
abstract void |
nodeIsReady()
Overridden by derived classes, and invoked when the node has joined successfully. |
void |
nodeIsReady(boolean state)
Overridden by derived classes, and invoked when the node has joined successfully. |
void |
process(Executable task,
Continuation command)
Schedules a job for processing on the dedicated processing thread, should one exist. |
void |
receiveMessage(Message msg)
message receiver interface. |
void |
registerApp(PastryAppl app)
Registers an application with this pastry node. |
Endpoint |
registerApplication(Application application,
int port)
This returns a Endpoint specific to the given application and instance name to the application, which the application can then use in order to send an receive messages. |
Endpoint |
registerApplication(Application application,
java.lang.String instance)
This returns a VirtualizedNode specific to the given application and instance name to the application, which the application can then use in order to send an receive messages. |
void |
registerReceiver(Credentials cred,
Address address,
MessageReceiver receiver)
Registers a message receiver with this Pastry node. |
void |
removeRouteSetListener(NodeSetListener listener)
|
abstract ScheduledMessage |
scheduleMsg(Message msg,
long delay)
Schedule the specified message to be sent to the local node after a specified delay. |
abstract ScheduledMessage |
scheduleMsg(Message msg,
long delay,
long period)
Schedule the specified message for repeated fixed-delay delivery to the local node, beginning after the specified delay. |
abstract ScheduledMessage |
scheduleMsgAtFixedRate(Message msg,
long delay,
long period)
Schedule the specified message for repeated fixed-rate delivery to the local node, beginning after the specified delay. |
abstract void |
send(NodeHandle handle,
Message message)
|
void |
setElements(NodeHandle lh,
PastrySecurityManager sm,
MessageDispatch md,
LeafSet ls,
RoutingTable rt)
Combined accessor method for various members of PastryNode. |
void |
setMessageDispatch(MessageDispatch md)
|
void |
setReady()
|
void |
setReady(boolean r)
|
java.lang.String |
toString()
|
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 |
Field Detail |
---|
protected NodeId myNodeId
protected NodeHandle localhandle
protected java.util.Vector apps
protected Logger logger
Constructor Detail |
---|
protected PastryNode(NodeId id, Environment e)
Method Detail |
---|
public abstract NodeHandle coalesce(NodeHandle newHandle)
public void setElements(NodeHandle lh, PastrySecurityManager sm, MessageDispatch md, LeafSet ls, RoutingTable rt)
lh
- Node handle corresponding to this node.sm
- Security manager.md
- Message dispatcher.ls
- Leaf set.rt
- Routing table.public NodeHandle getLocalNodeHandle()
Node
getLocalNodeHandle
in interface Node
public Environment getEnvironment()
Node
getEnvironment
in interface Node
public NodeHandle getLocalHandle()
public NodeId getNodeId()
public boolean isReady()
public MessageDispatch getMessageDispatch()
public void setMessageDispatch(MessageDispatch md)
public abstract void nodeIsReady()
public void nodeIsReady(boolean state)
state
- true when the node is ready, false when notpublic abstract void initiateJoin(NodeHandle bootstrap)
bootstrap
- Node handle to bootstrap with.public void setReady()
public void setReady(boolean r)
public boolean isClosest(NodeId key)
key
- the object key id
public LeafSet getLeafSet()
public RoutingTable getRoutingTable()
public void addLeafSetObserver(java.util.Observer o)
o
- the observer.public void deleteLeafSetObserver(java.util.Observer o)
o
- the observer.public void addLeafSetListener(NodeSetListener listener)
public void deleteLeafSetListener(NodeSetListener listener)
public void addRouteSetObserver(java.util.Observer o)
o
- the observer.public void deleteRouteSetObserver(java.util.Observer o)
o
- the observer.public void addRouteSetListener(NodeSetListener listener)
public void removeRouteSetListener(NodeSetListener listener)
public void receiveMessage(Message msg)
receiveMessage
in interface MessageReceiver
msg
- the message.public void registerReceiver(Credentials cred, Address address, MessageReceiver receiver)
cred
- the credentials.address
- the address that the receiver will be at.receiver
- the message receiver.public void registerApp(PastryAppl app)
app
- the applicationpublic abstract ScheduledMessage scheduleMsg(Message msg, long delay)
msg
- a message that will be delivered to the local node after the
specified delaydelay
- time in milliseconds before message is to be delivered
public abstract ScheduledMessage scheduleMsg(Message msg, long delay, long period)
msg
- a message that will be delivered to the local node after the
specified delaydelay
- time in milliseconds before message is to be deliveredperiod
- time in milliseconds between successive message deliveries
public abstract ScheduledMessage scheduleMsgAtFixedRate(Message msg, long delay, long period)
msg
- a message that will be delivered to the local node after the
specified delaydelay
- time in milliseconds before message is to be deliveredperiod
- time in milliseconds between successive message deliveries
public java.lang.String toString()
toString
in class java.lang.Object
public Endpoint registerApplication(Application application, java.lang.String instance)
registerApplication
in interface Node
application
- The Applicationinstance
- An identifier for a given instance
public Endpoint registerApplication(Application application, int port)
registerApplication
in interface Node
application
- The Applicationport
- The port to use
public Id getId()
getId
in interface Node
public IdFactory getIdFactory()
getIdFactory
in interface Node
public void process(Executable task, Continuation command)
task
- The task to run on the processing threadcommand
- The command to return the result to once it's donepublic void destroy()
destroy
in interface Destructable
public abstract void send(NodeHandle handle, Message message)
|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |