|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.generic.commonapi.NodeImpl
planet.symphony.SymphonyNode
This node is an implementation of the Symphony overlay.
Nested Class Summary | |
class |
SymphonyNode.StabilizeTask
Simple TimerTask that invoke stabilize() Node method. |
Field Summary | |
static int |
ACCEPT_CONNECT
|
boolean |
alive
|
static int |
CANCEL_CONNECT
|
static int |
CLOSE_LONG_CONNECT
|
static int |
CLOSE_NEIGHBOUR_CONNECT
|
static int |
DATA
Type value: It identifies that this message contains an application level Message. |
boolean |
fixedNeighbours
|
static java.lang.String[] |
MODES
This String contains a string representation of each mode value of the RouteMessage. |
SortedKList |
neighbourSet
|
static int |
NumberOfModes
|
static int |
NumberOfTypes
|
static int |
QUERY_CONNECT
|
static int |
QUERY_JOIN
Type value: First message that is send by any node to get its inmediate successor. |
static int |
REFRESH
Mode value: Defines a message's mode that requires only communication on one way. |
static int |
REPLY
Mode value: Defines the response of a communication. |
static int |
REQUEST
Mode value: Defines the start of communication that requires response (REPLY). |
int |
retriesNewLongDistance
|
static int |
SET_INFO
|
int |
statisticStabilizationSteps
|
boolean |
statisticStabilized
|
static java.lang.String[] |
TYPES
This String contains a string representation of each type value of the RouteMessage. |
Fields inherited from class planet.generic.commonapi.NodeImpl |
endpoints, id, listeners, nodeHandle, role |
Constructor Summary | |
SymphonyNode()
Initialize the internal data structure. |
Method Summary | |
boolean |
addToNeighbourSet(java.util.Collection c,
boolean adviceForClosing)
Add all NodeHandle in the c Collection to the neighbour set. |
void |
addToNeighbourSet(NodeHandle neighbour)
Add the neighbour to hte neighbour set. |
void |
broadcast(java.lang.String appId,
NodeHandle to,
NodeHandle nextHop,
Message msg)
This method throws a NoSuchMethodError, because the broadcast algorithm is not implemented yet. |
void |
buildEdges(java.lang.String resultName,
java.util.Collection edgeCollection,
ResultsConstraint constraint)
This method is a callback method used to collect all of the edges of a graph according to current resultName format. |
RouteMessage |
buildMessage(NodeHandle from,
NodeHandle to,
int type,
int mode,
Message m)
Builds a RouteMessage with the specified data. |
RouteMessage |
buildMessage(NodeHandle from,
NodeHandle to,
int type,
int mode,
Message m,
java.lang.String key)
Builds a new RouteMessage with the specified data. |
RouteMessage |
buildMessage(NodeHandle from,
NodeHandle to,
NodeHandle nextHop,
int type,
int mode,
Message m)
Builds a nw RouteMessage with the specified data. |
RouteMessage |
buildMessage(NodeHandle from,
NodeHandle to,
NodeHandle nextHop,
int type,
int mode,
Message m,
java.lang.String key)
Builds a RouteMessage with the specified data. |
RouteMessage |
buildMessage(RouteMessage toCopy,
NodeHandle nextHop)
Builds a new RouteMessage with all the values appeared in toCopy, and the specified nextHop. |
void |
dispatcher(RouteMessage msg)
Dispatch any incomming RouteMessage and update the local state or is resent to other node. |
void |
fail()
The leave protocol is the same as in leave case. |
java.util.Set |
getAllLinks()
Gets all node connections to other nodes as its NodeHandles. |
NodeHandle |
getClosestNodeHandle(Id id)
Returns the NodeHandle closest to id. |
java.util.Hashtable |
getEndPoints()
Return the endpoints, based on (key,value) structure, where the key is the Application name, and the value the own EndPoint instance. |
java.util.Collection |
getFarthestNeighbours()
Gets the farthest neighbours. |
java.util.List |
getIncommingSet()
Get the incomming set of long distance connections. |
java.util.Hashtable |
getInfo()
This method returns the internal data in a Hashtable, where the key is a String with the field name, and the value, the related object. |
static int |
getLongDistanceNumber()
Gets the maximum number of long distance links per node. |
java.util.Collection |
getNeighbourSet()
Gets the neightbour set. |
RouteMessage |
getNewLongDistance()
Returns a RouteMessage to be sent to acquire a new long distance. |
java.util.List |
getOutcommingSet()
Get the outcomming set of long distance connections. |
NodeHandle |
getPred()
Returns the NodeHandle of node predecessor. |
NodeHandle |
getSucc()
Returns the NodeHandle of node successor. |
static int |
getSuccessorsNumber()
Gets the maximum number of successors per node. |
java.util.Vector |
getSuccList(int max)
Returns up to max successors of the actual node. |
boolean |
isAlive()
Shows if the node is already alive. |
boolean |
isLocalMessage(RouteMessage msg)
The isLocalMessage's method is an extension method for commonapi specs. |
boolean |
isStabilized()
Informs if this node is stabilized. |
void |
join(NodeHandle bootstrap)
This node joins to the overlay network by the bootstrap node with NodeHandle bootstrap. |
void |
leave()
Leaves the node from the overlay network. |
java.util.Vector |
localLookup(Id key,
int max,
boolean safe)
Returns a list of nodes that can be used as next hops on a route towards key. |
java.util.Vector |
neighborSet(int max)
Obtains an unordered list of up to max nodes that are neighbors of the local node. |
boolean |
neighbourSetContains(NodeHandle o)
Test if the NodeHandle o is in the neighbour set. |
void |
prettyPrintNode()
Shows a brief description of the internal routing state. |
void |
printNode()
Shows in the standard out all internal routing information. |
boolean |
process(int actualStep)
This method is invoked to each simulation step to process the internal data, and all incomming RouteMessage. |
boolean |
range(NodeHandle node,
Id rank,
Id leftKey,
Id rightKey)
This methods ALWAYS return false. |
boolean |
removeNeighbour(NodeHandle o)
Removes the o from the neighbourSet |
java.util.Vector |
replicaSet(Id key,
int maxRank)
Returns an ordered set of nodes on which replicas of the object with this key can be stored. |
NodeHandle |
route(NodeHandle to)
Returns the NodeHandle with the shortest path to the destination node, using all internal routing information. |
void |
routeData(java.lang.String appId,
NodeHandle to,
NodeHandle nextHop,
Message msg)
Receive's data of the application level and sends it through de network. |
Node |
setValues(Id newId)
Sets the new Id. |
java.lang.String |
toString()
Shows a String representation of this node, showing only its Id. |
Methods inherited from class planet.generic.commonapi.NodeImpl |
addEdges, addMessageListener, buildMessage, buildMessage, buildNewEdge, dispatchDataMessage, getId, getLocalHandle, getRegisteredApplication, getRegisteredApplications, hasMoreMessages, inMessages, invokeByStepToAllApplications, nextMessage, outMessages, playsGoodRole, receive, registerApplication, removeMessageListener, send, sendMessage, sendMessage, sendMessage, sendMessage, setGoodRole, setTimer, setTimer |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int REQUEST
public static final int REPLY
public static final int REFRESH
public static final int QUERY_JOIN
public static final int SET_INFO
public static final int QUERY_CONNECT
public static final int ACCEPT_CONNECT
public static final int CANCEL_CONNECT
public static final int CLOSE_LONG_CONNECT
public static final int CLOSE_NEIGHBOUR_CONNECT
public static final int DATA
public static final int NumberOfTypes
public static final int NumberOfModes
public static final java.lang.String[] TYPES
public static final java.lang.String[] MODES
public SortedKList neighbourSet
public int retriesNewLongDistance
public boolean alive
public boolean fixedNeighbours
public boolean statisticStabilized
public int statisticStabilizationSteps
Constructor Detail |
public SymphonyNode() throws InitializationException
InitializationException
Method Detail |
public static int getSuccessorsNumber()
public static int getLongDistanceNumber()
public java.util.Hashtable getEndPoints()
public RouteMessage buildMessage(NodeHandle from, NodeHandle to, int type, int mode, Message m)
from
- Communication source.to
- Communitacion destination.type
- Communication type.mode
- Communication mode, from the specified type.m
- Data to be sent in this communication.
public RouteMessage buildMessage(NodeHandle from, NodeHandle to, int type, int mode, Message m, java.lang.String key)
from
- Communication source.to
- Communication destination.type
- Communication type.mode
- Communication mode, from the specified type.m
- Data to be sent in this communication.key
- Unique communication key.
public RouteMessage buildMessage(NodeHandle from, NodeHandle to, NodeHandle nextHop, int type, int mode, Message m)
from
- Communication source.to
- Communication destination.nextHop
- Communication next hop.type
- Communication type.mode
- Communication mode, from the specified type.m
- Data to be sent in this communication.
public RouteMessage buildMessage(NodeHandle from, NodeHandle to, NodeHandle nextHop, int type, int mode, Message m, java.lang.String key)
from
- Communication source.to
- Communication destination.nextHop
- Communication next hop.type
- Communication type.mode
- Communication mode, from the specified type.m
- Data to be sent in this communication.key
- Unique communication key.
public RouteMessage buildMessage(RouteMessage toCopy, NodeHandle nextHop)
toCopy
- Message to be cloned.nextHop
- Next hop in the route.
public boolean addToNeighbourSet(java.util.Collection c, boolean adviceForClosing)
c
- Collection with neighbours.adviceForClosing
- Send a CLOSE_NEIGHBOUR message to the removed neighbours
public void addToNeighbourSet(NodeHandle neighbour)
neighbour
- Neighbour NodeHandle to be added.public java.util.Collection getNeighbourSet()
public java.util.Collection getFarthestNeighbours()
SortedKList.getFarthestNeighbours()
public boolean neighbourSetContains(NodeHandle o)
o
- The NodeHandle to be test.
public boolean removeNeighbour(NodeHandle o)
o
- The NodeHandle to be removed.
public NodeHandle getSucc()
Node.getSucc()
public NodeHandle getPred()
Node.getPred()
public java.util.List getOutcommingSet()
public java.util.List getIncommingSet()
public void join(NodeHandle bootstrap)
join
in interface Node
join
in class NodeImpl
bootstrap
- NodeHandle of the bootstrap node.Node.join(planet.commonapi.NodeHandle)
public void leave()
leave
in interface Node
leave
in class NodeImpl
Node.leave()
public RouteMessage getNewLongDistance()
public void dispatcher(RouteMessage msg)
msg
- Incomming RouteMessage to be treat.public boolean process(int actualStep)
process
in interface Node
process
in class NodeImpl
actualStep
- The current simulation step.
Node.process(int)
public boolean isLocalMessage(RouteMessage msg)
isLocalMessage
in interface Node
isLocalMessage
in class NodeImpl
BehavioursPool
public java.util.Hashtable getInfo()
getInfo
in class NodeImpl
NodeImpl.getInfo()
public void routeData(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
Node
appId
- String that includes the application identification.to
- Node that must receive this message. If cannot represents
a real node.nextHop
- Node that must receive this message as first hop.msg
- Message to be sent.
If it is null, the message must be routed.public void printNode()
Node.printNode()
public void prettyPrintNode()
Node.prettyPrintNode()
public boolean isAlive()
Node.isAlive()
public NodeHandle route(NodeHandle to)
to
- Destination node.
public java.lang.String toString()
Object.toString()
public boolean isStabilized()
public void broadcast(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
appId
- Application identification.to
- Source of the message.nextHop
- NextHop of the message.msg
- Message to be send as broadcast.Node.broadcast(java.lang.String,
planet.commonapi.NodeHandle, planet.commonapi.NodeHandle,
planet.commonapi.Message)
public void fail()
Node.fail()
public java.util.Vector getSuccList(int max)
max
- Maximum number of successors to return.
Node.getSuccList(int)
public java.util.Vector localLookup(Id key, int max, boolean safe)
key
- Target keymax
- Number of next hops.safe
- If true, the expected fraction of faulty nodes are the same
of the nodes in the overlay.
Node.localLookup(planet.commonapi.Id, int, boolean)
public java.util.Vector neighborSet(int max)
max
- Maximum of nodes to return.
Node.neighborSet(int)
public boolean range(NodeHandle node, Id rank, Id leftKey, Id rightKey)
node
- Node that is currently a root of some range of keys.rank
- Number of keys that is root the node (rank=rightKey-leftKey).leftKey
- The value that appears in the invokation is the candidate left
key of the range. It may be modified to reflect the correct left margin
once invokation has finished.rightKey
- Shows once the invokation has finished the left margin of
the range.
Node.range(planet.commonapi.NodeHandle,
planet.commonapi.Id, planet.commonapi.Id, planet.commonapi.Id)
public java.util.Vector replicaSet(Id key, int maxRank)
key
- Id for which we find the replica set.maxRank
- Maximum number of members in replica set.
Node.replicaSet(planet.commonapi.Id, int)
public NodeHandle getClosestNodeHandle(Id id)
getClosestNodeHandle
in interface Node
getClosestNodeHandle
in class NodeImpl
id
- Id to find.
public java.util.Set getAllLinks()
public void buildEdges(java.lang.String resultName, java.util.Collection edgeCollection, ResultsConstraint constraint)
resultName
- Result type name to use.edgeCollection
- Edge collection where to add new edges.constraint
- ResultsConstraint for edge selectionpublic Node setValues(Id newId) throws InitializationException
setValues
in interface Node
setValues
in class NodeImpl
newId
- New Id.
InitializationException
- if any error has occurred.Node.setValues(planet.commonapi.Id)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |