|
Rice Pastry 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 class PastryNode
A Pastry node is single entity in the pastry network.
Fields inherited from interface org.mpisws.p2p.transport.proximity.ProximityProvider |
---|
DEFAULT_PROXIMITY |
Fields inherited from interface org.mpisws.p2p.transport.liveness.LivenessTypes |
---|
LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_DEAD_FOREVER, LIVENESS_SUSPECTED |
Constructor Summary | |
---|---|
PastryNode(Id id,
Environment e)
Constructor, with NodeId. |
Method Summary | |
---|---|
protected void |
acceptAppSocket(int appId)
|
Destructable |
addDestructable(Destructable d)
|
void |
addLeafSetListener(NodeSetListener listener)
|
void |
addLeafSetObserver(java.util.Observer o)
Deprecated. use addLeafSetListener |
void |
addLivenessListener(LivenessListener<NodeHandle> name)
|
void |
addNetworkListener(NetworkListener listener)
|
void |
addNodeHandleFactoryListener(NodeHandleFactoryListener listener)
|
void |
addProximityListener(ProximityListener<NodeHandle> listener)
|
void |
addRouteSetListener(NodeSetListener listener)
|
void |
addRouteSetObserver(java.util.Observer o)
Deprecated. use addRouteSetListener |
void |
boot(java.util.Collection o2)
|
void |
boot(java.lang.Object o)
|
void |
broadcastChannelClosed(java.net.InetSocketAddress addr)
|
void |
broadcastChannelOpened(java.net.InetSocketAddress addr,
int reason)
|
void |
broadcastReceivedListeners(int address,
short msgType,
java.net.InetSocketAddress from,
int size,
int wireType)
|
void |
broadcastSentListeners(int address,
short msgType,
java.net.InetSocketAddress dest,
int size,
int wireType)
|
Endpoint |
buildEndpoint(Application application,
java.lang.String instance)
Same as register application, but returns an unregistered Endpoint. |
boolean |
checkLiveness(NodeHandle i,
java.util.Map<java.lang.String,java.lang.Object> options)
Returns whether a new notification will occur. |
void |
clearState(NodeHandle i)
Force layer to clear the existing state related to the Identifier. |
NodeHandle |
coalesce(NodeHandle newHandle)
Needed for legacy java deserialization of NodeHanlde because we aren't given any other way to do this properly such as a protected constructor. |
SocketRequestHandle |
connect(NodeHandle i,
AppSocketReceiver deliverSocketToMe,
PastryAppl appl,
int timeout)
Called by PastryAppl to ask the transport layer to open a Socket to its counterpart on another node. |
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. |
void |
doneNode(java.util.Collection<NodeHandle> bootstrap)
Called after the node is initialized. |
Bootstrapper |
getBootstrapper()
|
ReadyStrategy |
getDefaultReadyStrategy()
Simple Ready Strategy |
Environment |
getEnvironment()
Returns the environment. |
NodeHandleFactory |
getHandleFactroy()
|
Id |
getId()
Returns the Id of this node |
IdFactory |
getIdFactory()
Returns a factory for Ids specific to this node's protocol. |
LeafSet |
getLeafSet()
|
int |
getLiveness(NodeHandle i)
|
int |
getLiveness(NodeHandle i,
java.util.Map<java.lang.String,java.lang.Object> options)
|
LivenessProvider<NodeHandle> |
getLivenessProvider()
|
NodeHandle |
getLocalHandle()
|
NodeHandle |
getLocalNodeHandle()
Returns a handle to the local node. |
MessageDispatch |
getMessageDispatch()
FOR TESTING ONLY - DO NOT USE! |
protected java.lang.Iterable<NetworkListener> |
getNetworkListeners()
|
void |
getNodeHandle(java.lang.Object o,
Continuation<NodeHandle,java.lang.Exception> c)
|
Id |
getNodeId()
|
ProximityProvider<NodeHandle> |
getProxProvider()
|
Router |
getRouter()
|
RoutingTable |
getRoutingTable()
|
TransportLayer<NodeHandle,RawMessage> |
getTL()
|
java.util.Map<java.lang.String,java.lang.Object> |
getVars()
|
void |
incomingSocket(P2PSocket<NodeHandle> s)
Notification of a new socket. |
boolean |
isAlive(NodeHandle i)
|
boolean |
isClosest(Id 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()
|
boolean |
joinFailed()
Returns true if there was a fatal error Joining |
void |
joinFailed(JoinFailedException cje)
|
JoinFailedException |
joinFailedReason()
|
void |
livenessChanged(NodeHandle i,
int val,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when the liveness changes. |
void |
messageReceived(NodeHandle i,
RawMessage m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
void |
nodeIsReady()
Deprecated. use nodeIsReady(boolean) |
void |
nodeIsReady(boolean state)
Overridden by derived classes, and invoked when the node has joined successfully. |
protected void |
notifyLivenessListeners(NodeHandle i,
int val,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
notifyReadyObservers()
|
java.lang.String |
printRouteState()
For debugging: print the internal routing state of the Node. |
void |
process(Executable task,
Continuation command)
Schedules a job for processing on the dedicated processing thread, should one exist. |
int |
proximity(NodeHandle nh)
The proximity of the node handle. |
int |
proximity(NodeHandle nh,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
proximityChanged(NodeHandle handle,
int val,
java.util.Map<java.lang.String,java.lang.Object> options)
|
NodeHandle |
readNodeHandle(InputBuffer buf)
|
void |
receiveMessage(Message msg)
message receiver interface. |
void |
registerApp(PastryAppl app)
Registers an application with this pastry node. |
Endpoint |
registerApplication(Application application,
java.lang.String instance)
Deprecated. use buildEndpoint() endpoint.register() |
void |
registerReceiver(int address,
PastryAppl receiver)
Registers a message receiver with this Pastry node. |
boolean |
removeDestructable(Destructable d)
|
boolean |
removeLivenessListener(LivenessListener<NodeHandle> name)
|
void |
removeNetworkListener(NetworkListener listener)
|
void |
removeNodeHandleFactoryListener(NodeHandleFactoryListener listener)
|
boolean |
removeProximityListener(ProximityListener<NodeHandle> listener)
|
void |
removeRouteSetListener(NodeSetListener listener)
|
ScheduledMessage |
scheduleMsg(Message msg,
long delay)
Schedule the specified message to be sent to the local node after a specified delay. |
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. |
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. |
PMessageReceipt |
send(NodeHandle handle,
Message msg,
PMessageNotification deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> tempOptions)
Deliver message to the NodeHandle. |
void |
setElements(NodeHandle lh,
MessageDispatch md,
LeafSet ls,
RoutingTable rt,
Router router)
Combined accessor method for various members of PastryNode. |
void |
setJoinProtocols(Bootstrapper boot,
JoinProtocol joinP,
LeafSetProtocol leafsetP,
RouteSetProtocol routeP)
|
void |
setMessageDispatch(MessageDispatch md)
|
void |
setNodeHandleFetcher(NodeHandleFetcher nodeHandleFetcher)
|
void |
setReady()
Overridden by derived classes to initiate the join process |
void |
setReady(boolean ready)
|
void |
setReadyStrategy(ReadyStrategy rs)
|
void |
setSocketElements(int lsmf,
int rsmf,
TransportLayer<NodeHandle,RawMessage> tl,
LivenessProvider<NodeHandle> livenessProvider,
ProximityProvider<NodeHandle> proxProvider,
NodeHandleFactory handleFactory)
|
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 |
---|
public static final byte CONNECTION_UNKNOWN_ERROR
public static final byte CONNECTION_UNKNOWN
public static final byte CONNECTION_OK
public static final byte CONNECTION_NO_APP
public static final byte CONNECTION_NO_ACCEPTOR
protected Id myNodeId
protected LeafSet leafSet
protected RoutingTable routeSet
protected NodeHandle localhandle
protected java.util.Vector apps
protected Logger logger
protected boolean joinFailed
protected boolean isDestroyed
protected Router router
protected NodeHandleFactory handleFactory
protected JoinProtocol joiner
protected Bootstrapper bootstrapper
protected TransportLayer<NodeHandle,RawMessage> tl
protected ProximityProvider<NodeHandle> proxProvider
protected JoinFailedException joinFailedReason
protected int leafSetMaintFreq
protected int routeSetMaintFreq
protected ScheduledMessage leafSetRoutineMaintenance
protected ScheduledMessage routeSetRoutineMaintenance
protected LivenessProvider<NodeHandle> livenessProvider
Constructor Detail |
---|
public PastryNode(Id id, Environment e)
Method Detail |
---|
public void boot(java.lang.Object o)
public void boot(java.util.Collection o2)
public ReadyStrategy getDefaultReadyStrategy()
public void setReadyStrategy(ReadyStrategy rs)
public void setElements(NodeHandle lh, MessageDispatch md, LeafSet ls, RoutingTable rt, Router router)
lh
- Node handle corresponding to this node.sm
- Security manager.md
- Message dispatcher.ls
- Leaf set.rt
- Routing table.public void setJoinProtocols(Bootstrapper boot, JoinProtocol joinP, LeafSetProtocol leafsetP, RouteSetProtocol routeP)
public NodeHandle getLocalNodeHandle()
Node
getLocalNodeHandle
in interface Node
public Environment getEnvironment()
Node
getEnvironment
in interface Node
public NodeHandle getLocalHandle()
public Id getNodeId()
public boolean isReady()
public MessageDispatch getMessageDispatch()
public void setMessageDispatch(MessageDispatch md)
public Destructable addDestructable(Destructable d)
public boolean removeDestructable(Destructable d)
public void nodeIsReady(boolean state)
state
- true when the node is ready, false when notpublic void setReady()
bootstrap
- Node handle to bootstrap with.public void setReady(boolean ready)
public NodeHandle coalesce(NodeHandle newHandle)
NodeHandleFactory
coalesce
in interface NodeHandleFactory
public void notifyReadyObservers()
public boolean isClosest(Id 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)
public void registerReceiver(int address, PastryAppl 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 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 buildEndpoint(Application application, java.lang.String instance)
Node
buildEndpoint
in interface Node
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 SocketRequestHandle connect(NodeHandle i, AppSocketReceiver deliverSocketToMe, PastryAppl appl, int timeout)
handle
- receiver
- appl
- public void joinFailed(JoinFailedException cje)
public boolean joinFailed()
public JoinFailedException joinFailedReason()
public Router getRouter()
public java.lang.String printRouteState()
Node
printRouteState
in interface Node
public void setSocketElements(int lsmf, int rsmf, TransportLayer<NodeHandle,RawMessage> tl, LivenessProvider<NodeHandle> livenessProvider, ProximityProvider<NodeHandle> proxProvider, NodeHandleFactory handleFactory)
public java.util.Map<java.lang.String,java.lang.Object> getVars()
public void incomingSocket(P2PSocket<NodeHandle> s) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<NodeHandle,RawMessage>
s
- the incoming socket
java.io.IOException
protected void acceptAppSocket(int appId) throws AppSocketException
AppSocketException
public int proximity(NodeHandle nh)
nh
-
public int proximity(NodeHandle nh, java.util.Map<java.lang.String,java.lang.Object> options)
proximity
in interface ProximityProvider<NodeHandle>
public 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 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 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 PMessageReceipt send(NodeHandle handle, Message msg, PMessageNotification deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> tempOptions)
nh
- m
-
public void messageReceived(NodeHandle i, RawMessage m, java.util.Map<java.lang.String,java.lang.Object> options) throws java.io.IOException
TransportLayerCallback
messageReceived
in interface TransportLayerCallback<NodeHandle,RawMessage>
i
- The node it is coming fromm
- the messageoptions
- describe how the message arrived (udp/tcp, encrypted etc)
java.io.IOException
- if there is a problem decoding the messagepublic NodeHandle readNodeHandle(InputBuffer buf) throws java.io.IOException
readNodeHandle
in interface NodeHandleFactory
java.io.IOException
public Bootstrapper getBootstrapper()
public void doneNode(java.util.Collection<NodeHandle> bootstrap)
bootstrap
- The node which this node should boot off of.public void livenessChanged(NodeHandle i, int val, java.util.Map<java.lang.String,java.lang.Object> options)
LivenessListener
livenessChanged
in interface LivenessListener<NodeHandle>
public void addLivenessListener(LivenessListener<NodeHandle> name)
addLivenessListener
in interface LivenessProvider<NodeHandle>
public boolean removeLivenessListener(LivenessListener<NodeHandle> name)
removeLivenessListener
in interface LivenessProvider<NodeHandle>
protected void notifyLivenessListeners(NodeHandle i, int val, java.util.Map<java.lang.String,java.lang.Object> options)
public boolean checkLiveness(NodeHandle i, java.util.Map<java.lang.String,java.lang.Object> options)
LivenessProvider
checkLiveness
in interface LivenessProvider<NodeHandle>
i
- the node to check
public int getLiveness(NodeHandle i, java.util.Map<java.lang.String,java.lang.Object> options)
getLiveness
in interface LivenessProvider<NodeHandle>
public int getLiveness(NodeHandle i)
public boolean isAlive(NodeHandle i)
public void proximityChanged(NodeHandle handle, int val, java.util.Map<java.lang.String,java.lang.Object> options)
proximityChanged
in interface ProximityListener<NodeHandle>
public LivenessProvider<NodeHandle> getLivenessProvider()
public ProximityProvider<NodeHandle> getProxProvider()
public TransportLayer<NodeHandle,RawMessage> getTL()
public void clearState(NodeHandle i)
LivenessProvider
clearState
in interface LivenessProvider<NodeHandle>
clearState
in interface ProximityProvider<NodeHandle>
public void addProximityListener(ProximityListener<NodeHandle> listener)
addProximityListener
in interface ProximityProvider<NodeHandle>
public boolean removeProximityListener(ProximityListener<NodeHandle> listener)
removeProximityListener
in interface ProximityProvider<NodeHandle>
public void nodeIsReady()
public NodeHandleFactory getHandleFactroy()
public void addNetworkListener(NetworkListener listener)
public void removeNetworkListener(NetworkListener listener)
protected java.lang.Iterable<NetworkListener> getNetworkListeners()
public void broadcastChannelClosed(java.net.InetSocketAddress addr)
public void broadcastChannelOpened(java.net.InetSocketAddress addr, int reason)
public void broadcastSentListeners(int address, short msgType, java.net.InetSocketAddress dest, int size, int wireType)
public void broadcastReceivedListeners(int address, short msgType, java.net.InetSocketAddress from, int size, int wireType)
public void addNodeHandleFactoryListener(NodeHandleFactoryListener listener)
addNodeHandleFactoryListener
in interface NodeHandleFactory
public void removeNodeHandleFactoryListener(NodeHandleFactoryListener listener)
removeNodeHandleFactoryListener
in interface NodeHandleFactory
public void setNodeHandleFetcher(NodeHandleFetcher nodeHandleFetcher)
public void getNodeHandle(java.lang.Object o, Continuation<NodeHandle,java.lang.Exception> c)
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |