|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.ReceiverAdapter org.jgroups.blocks.ReplicatedTree
public class ReplicatedTree
A tree-like structure that is replicated across several members. Updates will be multicast to all group members reliably and in the same order.
Nested Class Summary | |
---|---|
static class |
ReplicatedTree.Node
|
static interface |
ReplicatedTree.ReplicatedTreeListener
|
Field Summary | |
---|---|
protected Log |
log
|
static java.lang.String |
SEPARATOR
|
Constructor Summary | |
---|---|
ReplicatedTree()
|
|
ReplicatedTree(JChannel channel)
Expects an already connected channel. |
|
ReplicatedTree(java.lang.String groupname,
java.lang.String props,
long state_fetch_timeout)
Creates a channel with the given properties. |
|
ReplicatedTree(java.lang.String groupname,
java.lang.String props,
long state_fetch_timeout,
boolean jmx)
|
Method Summary | |
---|---|
void |
_put(java.lang.String fqn,
java.util.HashMap data)
|
void |
_put(java.lang.String fqn,
java.lang.String key,
java.lang.Object value)
|
void |
_remove(java.lang.String fqn)
|
void |
_remove(java.lang.String fqn,
java.lang.String key)
|
void |
_removeData(java.lang.String fqn)
|
void |
addReplicatedTreeListener(ReplicatedTree.ReplicatedTreeListener listener)
|
boolean |
exists(java.lang.String fqn)
Checks whether a given node exists in the tree |
void |
fetchState(long timeout)
Fetch the group state from the current coordinator. |
java.lang.Object |
get(java.lang.String fqn,
java.lang.String key)
Finds a node given its name and returns the value associated with a given key in its data
map. |
Channel |
getChannel()
Returns the Channel the DistributedTree is connected to |
java.util.Set |
getChildrenNames(java.lang.String fqn)
Returns all children of a given node |
int |
getGroupMembersNumber()
Returns the number of current members joined to the group |
java.lang.String |
getGroupName()
Returns the name of the group that the DistributedTree is connected to |
java.util.Set |
getKeys(java.lang.String fqn)
Gets the keys of the data map. |
Address |
getLocalAddress()
|
java.util.List<Address> |
getMembers()
|
void |
getState(java.io.OutputStream ostream)
Allows an application to write a state through a provided OutputStream. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
print(java.lang.String fqn)
Prints a representation of the node defined by fqn . |
void |
put(java.lang.String fqn,
java.util.HashMap data)
Adds a new node to the tree and sets its data. |
void |
put(java.lang.String fqn,
java.lang.String key,
java.lang.Object value)
Adds a key and value to a given node. |
void |
receive(Message msg)
Callback. |
void |
remove(java.lang.String fqn)
Removes the node from the tree. |
void |
remove(java.lang.String fqn,
java.lang.String key)
Removes key from the node's hashmap |
void |
removeReplicatedTreeListener(ReplicatedTree.ReplicatedTreeListener listener)
|
void |
setRemoteCalls(boolean flag)
|
void |
setRootNode(ReplicatedTree.Node n)
|
void |
setState(java.io.InputStream istream)
Allows an application to read a state through a provided InputStream. |
void |
start()
|
void |
stop()
|
java.lang.String |
toString()
|
void |
viewAccepted(View new_view)
Called when a change in membership has occurred. |
Methods inherited from class org.jgroups.ReceiverAdapter |
---|
block, suspect, unblock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SEPARATOR
protected final Log log
Constructor Detail |
---|
public ReplicatedTree(java.lang.String groupname, java.lang.String props, long state_fetch_timeout) throws java.lang.Exception
java.lang.Exception
public ReplicatedTree(java.lang.String groupname, java.lang.String props, long state_fetch_timeout, boolean jmx) throws java.lang.Exception
java.lang.Exception
public ReplicatedTree()
public ReplicatedTree(JChannel channel) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public void setRemoteCalls(boolean flag)
public void setRootNode(ReplicatedTree.Node n)
public Address getLocalAddress()
public java.util.List<Address> getMembers()
public void fetchState(long timeout) throws java.lang.Exception
java.lang.Exception
public void addReplicatedTreeListener(ReplicatedTree.ReplicatedTreeListener listener)
public void removeReplicatedTreeListener(ReplicatedTree.ReplicatedTreeListener listener)
public final void start() throws java.lang.Exception
java.lang.Exception
public void stop()
public void put(java.lang.String fqn, java.util.HashMap data)
fqn
- The fully qualified name of the new nodedata
- The new data. May be null if no data should be set in the node.public void put(java.lang.String fqn, java.lang.String key, java.lang.Object value)
fqn
- The fully qualified name of the nodekey
- The keyvalue
- The valuepublic void remove(java.lang.String fqn)
fqn
- The fully qualified name of the node.public void remove(java.lang.String fqn, java.lang.String key)
key
from the node's hashmap
fqn
- The fullly qualified name of the nodekey
- The key to be removedpublic boolean exists(java.lang.String fqn)
fqn
- The fully qualified name of the node
public java.util.Set getKeys(java.lang.String fqn)
data
map. Returns all keys as Strings. Returns null if node
does not exist.
fqn
- The fully qualified name of the node
public java.lang.Object get(java.lang.String fqn, java.lang.String key)
data
map. Returns null if the node was not found in the tree or the key was not found in the hashmap.
fqn
- The fully qualified name of the node.key
- The key.public java.lang.String print(java.lang.String fqn)
fqn
. Output includes name, fqn and
data.
public java.util.Set getChildrenNames(java.lang.String fqn)
fqn
- The fully qualified name of the node
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getGroupName()
public Channel getChannel()
public int getGroupMembersNumber()
public void _put(java.lang.String fqn, java.util.HashMap data)
public void _put(java.lang.String fqn, java.lang.String key, java.lang.Object value)
public void _remove(java.lang.String fqn)
public void _remove(java.lang.String fqn, java.lang.String key)
public void _removeData(java.lang.String fqn)
public void receive(Message msg)
receive
in interface MessageListener
receive
in class ReceiverAdapter
public void getState(java.io.OutputStream ostream) throws java.lang.Exception
ReceiverAdapter
getState
in interface MessageListener
getState
in class ReceiverAdapter
ostream
- the OutputStream
java.lang.Exception
- if the streaming fails, any exceptions should be thrown so that the state requester
can re-throw them and let the caller know what happenedOutputStream.close()
public void setState(java.io.InputStream istream) throws java.lang.Exception
ReceiverAdapter
setState
in interface MessageListener
setState
in class ReceiverAdapter
istream
- the InputStream
java.lang.Exception
- if the streaming fails, any exceptions should be thrown so that the state requester
can catch them and thus know what happenedInputStream.close()
public void viewAccepted(View new_view)
ReceiverAdapter
Channel.connect(String)
returns.
viewAccepted
in interface MembershipListener
viewAccepted
in class ReceiverAdapter
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |