| java.lang.Object org.jgroups.blocks.ReplicatedTree
Inner Class :public interface ReplicatedTreeListener | |
Inner Class :public static class Node implements Serializable | |
Inner Class :static class MyListener implements ReplicatedTreeListener | |
Method Summary | |
public void | _put(String fqn, HashMap data) | public void | _put(String fqn, String key, Object value) | public void | _remove(String fqn) | public void | _remove(String fqn, String key) | public void | _removeData(String fqn) | public void | addReplicatedTreeListener(ReplicatedTreeListener listener) | public void | block() | public boolean | exists(String fqn) | public void | fetchState(long timeout) Fetch the group state from the current coordinator. | Node | findNode(String fqn) Returns the node at fqn. | Node | findParentNode(String fqn, StringHolder child_name, boolean create_if_not_exists) Find the node just above the one indicated by fqn . | public Object | get(String fqn, String key) Finds a node given its name and returns the value associated with a given key in its data
map. | HashMap | get(String fqn) Returns the data hashmap for a given node. | public Channel | getChannel() | public Set | getChildrenNames(String fqn) | public int | getGroupMembersNumber() | public String | getGroupName() | public Set | getKeys(String fqn) Gets the keys of the data map. | public Address | getLocalAddress() | public Vector | getMembers() | public byte[] | getState() | public static void | main(String[] args) | void | notifyAllNodesCreated(Node curr) Generates NodeAdded notifications for all nodes of the tree. | void | notifyNodeAdded(String fqn) | void | notifyNodeModified(String fqn) | void | notifyNodeRemoved(String fqn) | void | notifyViewChange(View v) | public String | print(String fqn) Prints a representation of the node defined by fqn . | public void | put(String fqn, HashMap data) Adds a new node to the tree and sets its data. | public void | put(String fqn, String key, Object value) Adds a key and value to a given node. | public void | receive(Message msg) Callback. | public void | remove(String fqn) Removes the node from the tree. | public void | remove(String fqn, String key) | public void | removeReplicatedTreeListener(ReplicatedTreeListener listener) | public void | run() | public void | setRemoteCalls(boolean flag) | public void | setRootNode(Node n) | public void | setState(byte[] new_state) | final public void | start() | public void | stop() | public void | suspect(Address suspected_mbr) | public String | toString() | public void | viewAccepted(View new_view) |
INDENT | final static int INDENT(Code) | | |
log | final protected Log log(Code) | | |
remote_calls | boolean remote_calls(Code) | | Whether or not to use remote calls. If false, all methods will be invoked directly on this
instance rather than sending a message to all replicas and only then invoking the method.
Useful for testing
|
state_fetch_timeout | long state_fetch_timeout(Code) | | |
ReplicatedTree | public ReplicatedTree(String groupname, String props, long state_fetch_timeout) throws Exception(Code) | | Creates a channel with the given properties. Connects to the channel, then creates a PullPushAdapter
and starts it
|
ReplicatedTree | public ReplicatedTree()(Code) | | |
ReplicatedTree | public ReplicatedTree(JChannel channel) throws Exception(Code) | | Expects an already connected channel. Creates a PullPushAdapter and starts it
|
addReplicatedTreeListener | public void addReplicatedTreeListener(ReplicatedTreeListener listener)(Code) | | |
block | public void block()(Code) | | Block sending and receiving of messages until viewAccepted() is called
|
exists | public boolean exists(String fqn)(Code) | | Checks whether a given node exists in the tree
Parameters: fqn - The fully qualified name of the node boolean Whether or not the node exists |
findNode | Node findNode(String fqn)(Code) | | Returns the node at fqn. This method should not be used by clients (therefore it is package-private):
it is only used internally (for navigation). C++ 'friend' would come in handy here...
Parameters: fqn - The fully qualified name of the node Node The node at fqn |
findParentNode | Node findParentNode(String fqn, StringHolder child_name, boolean create_if_not_exists)(Code) | | Find the node just above the one indicated by fqn . This is needed in many cases,
e.g. to add a new node or remove an existing node.
Parameters: fqn - The fully qualified name of the node. Parameters: child_name - Will be filled with the name of the child when this method returns. The child nameis the last relative name of the fqn , e.g. in "/a/b/c" it would be "c". Parameters: create_if_not_exists - Create parent nodes along the way if they don't exist. Otherwise, this methodwill return when a node cannot be found. |
get | public Object get(String fqn, String key)(Code) | | Finds a node given its name and returns the value associated with a given key in its data
map. Returns null if the node was not found in the tree or the key was not found in the hashmap.
Parameters: fqn - The fully qualified name of the node. Parameters: key - The key. |
get | HashMap get(String fqn)(Code) | | Returns the data hashmap for a given node. This method can only be used by callers that are inside
the same package. The reason is that callers must not modify the return value, as these modifications
would not be replicated, thus rendering the replicas inconsistent.
Parameters: fqn - The fully qualified name of the node HashMap The data hashmap for the given node |
getChannel | public Channel getChannel()(Code) | | Returns the Channel the DistributedTree is connected to
Channel |
getChildrenNames | public Set getChildrenNames(String fqn)(Code) | | Returns all children of a given node
Parameters: fqn - The fully qualified name of the node Set A list of child names (as Strings) |
getGroupMembersNumber | public int getGroupMembersNumber()(Code) | | Returns the number of current members joined to the group
int |
getGroupName | public String getGroupName()(Code) | | Returns the name of the group that the DistributedTree is connected to
String |
getKeys | public Set getKeys(String fqn)(Code) | | Gets the keys of the data map. Returns all keys as Strings. Returns null if node
does not exist.
Parameters: fqn - The fully qualified name of the node Set A set of keys (as Strings) |
getState | public byte[] getState()(Code) | | Return a copy of the current cache (tree)
|
notifyAllNodesCreated | void notifyAllNodesCreated(Node curr)(Code) | | Generates NodeAdded notifications for all nodes of the tree. This is called whenever the tree is
initially retrieved (state transfer)
|
notifyNodeModified | void notifyNodeModified(String fqn)(Code) | | |
notifyViewChange | void notifyViewChange(View v)(Code) | | |
print | public String print(String fqn)(Code) | | Prints a representation of the node defined by fqn . Output includes name, fqn and
data.
|
put | public void put(String fqn, HashMap data)(Code) | | Adds a new node to the tree and sets its data. If the node doesn not yet exist, it will be created.
Also, parent nodes will be created if not existent. If the node already has data, then the new data
will override the old one. If the node already existed, a nodeModified() notification will be generated.
Otherwise a nodeCreated() motification will be emitted.
Parameters: fqn - The fully qualified name of the new node Parameters: data - The new data. May be null if no data should be set in the node. |
put | public void put(String fqn, String key, Object value)(Code) | | Adds a key and value to a given node. If the node doesn't exist, it will be created. If the node
already existed, a nodeModified() notification will be generated. Otherwise a
nodeCreated() motification will be emitted.
Parameters: fqn - The fully qualified name of the node Parameters: key - The key Parameters: value - The value |
receive | public void receive(Message msg)(Code) | | Callback. Process the contents of the message; typically an _add() or _set() request
|
remove | public void remove(String fqn)(Code) | | Removes the node from the tree.
Parameters: fqn - The fully qualified name of the node. |
remove | public void remove(String fqn, String key)(Code) | | Removes key from the node's hashmap
Parameters: fqn - The fullly qualified name of the node Parameters: key - The key to be removed |
removeReplicatedTreeListener | public void removeReplicatedTreeListener(ReplicatedTreeListener listener)(Code) | | |
run | public void run()(Code) | | Request handler thread
|
setRemoteCalls | public void setRemoteCalls(boolean flag)(Code) | | |
setRootNode | public void setRootNode(Node n)(Code) | | |
setState | public void setState(byte[] new_state)(Code) | | Set the cache (tree) to this value
|
suspect | public void suspect(Address suspected_mbr)(Code) | | Called when a member is suspected
|
viewAccepted | public void viewAccepted(View new_view)(Code) | | |
|
|