org.jgroups.blocks

Class DistributedTree

public class DistributedTree extends Object implements MessageListener, MembershipListener

A tree-like structure that is replicated across several members. Updates will be multicast to all group members reliably and in the same order.

Author: Bela Ban Alfonso Olias-Sanz

Nested Class Summary
interfaceDistributedTree.DistributedTreeListener
interfaceDistributedTree.ViewListener
Field Summary
protected Channelchannel
protected RpcDispatcherdisp
protected static Loglog
Constructor Summary
DistributedTree()
DistributedTree(String groupname, String channel_properties)
DistributedTree(PullPushAdapter adapter, Serializable id, long state_timeout)
Method Summary
voidadd(String fqn)
voidadd(String fqn, Serializable element)
voidadd(String fqn, Serializable element, int timeout)
voidaddDistributedTreeListener(DistributedTree.DistributedTreeListener listener)
voidaddViewListener(DistributedTree.ViewListener listener)
voidblock()
Block sending and receiving of messages until ViewAccepted is called
booleanexists(String fqn)
Serializableget(String fqn)
ChannelgetChannel()
Returns the Channel the DistributedTree is connected to
VectorgetChildrenNames(String fqn)
Returns all children of a Node as strings
intgetGroupMembersNumber()
Returns the number of current members joined to the group
StringgetGroupName()
Returns the name of the group that the DistributedTree is connected to
ObjectgetLocalAddress()
byte[]getState()
Return a copy of the tree
Stringprint()
voidreceive(Message msg)
voidremove(String fqn)
voidremove(String fqn, int timeout)
voidremoveDistributedTreeListener(DistributedTree.DistributedTreeListener listener)
voidremoveViewListener(DistributedTree.ViewListener listener)
voidreset(String fqn, Serializable element)
resets an existing node, useful after a merge when you want to tell other members of your state, but do not wish to remove and then add as two separate calls
voidreset(String fqn, Serializable element, int timeout)
resets an existing node, useful after a merge when you want to tell other members of your state, but do not wish to remove and then add as two separate calls
voidset(String fqn, Serializable element)
voidset(String fqn, Serializable element, int timeout)
voidsetDeadlockDetection(boolean flag)
voidsetState(byte[] data)
voidstart()
voidstart(long timeout)
voidstop()
voidsuspect(Address suspected_mbr)
Called when a member is suspected
voidviewAccepted(View new_view)
void_add(String fqn)
void_add(String fqn, Serializable element)
void_remove(String fqn)
void_reset(String fqn, Serializable element)
similar to set, but does not error if node does not exist, but rather does an add instead
void_set(String fqn, Serializable element)

Field Detail

channel

protected Channel channel

disp

protected RpcDispatcher disp

log

protected static final Log log

Constructor Detail

DistributedTree

public DistributedTree()

DistributedTree

public DistributedTree(String groupname, String channel_properties)

DistributedTree

public DistributedTree(PullPushAdapter adapter, Serializable id, long state_timeout)

Method Detail

add

public void add(String fqn)

add

public void add(String fqn, Serializable element)

add

public void add(String fqn, Serializable element, int timeout)

addDistributedTreeListener

public void addDistributedTreeListener(DistributedTree.DistributedTreeListener listener)

addViewListener

public void addViewListener(DistributedTree.ViewListener listener)

block

public void block()
Block sending and receiving of messages until ViewAccepted is called

exists

public boolean exists(String fqn)

get

public Serializable get(String fqn)

getChannel

public Channel getChannel()
Returns the Channel the DistributedTree is connected to

Returns: Channel

getChildrenNames

public Vector getChildrenNames(String fqn)
Returns all children of a Node as strings

getGroupMembersNumber

public int getGroupMembersNumber()
Returns the number of current members joined to the group

Returns: int

getGroupName

public String getGroupName()
Returns the name of the group that the DistributedTree is connected to

Returns: String

getLocalAddress

public Object getLocalAddress()

getState

public byte[] getState()
Return a copy of the tree

print

public String print()

receive

public void receive(Message msg)

remove

public void remove(String fqn)

remove

public void remove(String fqn, int timeout)

removeDistributedTreeListener

public void removeDistributedTreeListener(DistributedTree.DistributedTreeListener listener)

removeViewListener

public void removeViewListener(DistributedTree.ViewListener listener)

reset

public void reset(String fqn, Serializable element)
resets an existing node, useful after a merge when you want to tell other members of your state, but do not wish to remove and then add as two separate calls

reset

public void reset(String fqn, Serializable element, int timeout)
resets an existing node, useful after a merge when you want to tell other members of your state, but do not wish to remove and then add as two separate calls

set

public void set(String fqn, Serializable element)

set

public void set(String fqn, Serializable element, int timeout)

setDeadlockDetection

public void setDeadlockDetection(boolean flag)

setState

public void setState(byte[] data)

start

public void start()

start

public void start(long timeout)

stop

public void stop()

suspect

public void suspect(Address suspected_mbr)
Called when a member is suspected

viewAccepted

public void viewAccepted(View new_view)

_add

public void _add(String fqn)

_add

public void _add(String fqn, Serializable element)

_remove

public void _remove(String fqn)

_reset

public void _reset(String fqn, Serializable element)
similar to set, but does not error if node does not exist, but rather does an add instead

_set

public void _set(String fqn, Serializable element)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.