org.jgroups.blocks

Class DistributedTree

Implemented Interfaces:
Cloneable, MembershipListener, MessageListener

public class DistributedTree
extends java.lang.Object
implements MessageListener, MembershipListener, Cloneable

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

Authors:
Bela Ban
Alfonso Olias-Sanz

Nested Class Summary

static interface
DistributedTree.DistributedTreeListener
static interface
DistributedTree.ViewListener

Field Summary

protected static Log
log

Constructor Summary

DistributedTree()
DistributedTree(String groupname, String channel_properties)
DistributedTree(PullPushAdapter adapter, Serializable id, long state_timeout)

Method Summary

void
_add(String fqn)
void
_add(String fqn, Serializable element)
void
_remove(String fqn)
void
_set(String fqn, Serializable element)
void
add(String fqn)
void
add(String fqn, Serializable element)
void
addDistributedTreeListener(DistributedTree.DistributedTreeListener listener)
void
addViewListener(DistributedTree.ViewListener listener)
void
block()
Block sending and receiving of messages until ViewAccepted is called
boolean
exists(String fqn)
Serializable
get(String fqn)
Channel
getChannel()
Returns the Channel the DistributedTree is connected to
Vector
getChildrenNames(String fqn)
Returns all children of a Node as strings
int
getGroupMembersNumber()
Returns the number of current members joined to the group
String
getGroupName()
Returns the name of the group that the DistributedTree is connected to
Object
getLocalAddress()
byte[]
getState()
Return a copy of the tree
String
print()
void
receive(Message msg)
void
remove(String fqn)
void
removeDistributedTreeListener(DistributedTree.DistributedTreeListener listener)
void
removeViewListener(DistributedTree.ViewListener listener)
void
set(String fqn, Serializable element)
void
setState(byte[] data)
void
start()
void
start(long timeout)
void
stop()
void
suspect(Address suspected_mbr)
Called when a member is suspected
void
viewAccepted(View new_view)
Called by JGroups to notify the target object of a change of membership.

Field Details

log

protected static Log log

Constructor Details

DistributedTree

public DistributedTree()


DistributedTree

public DistributedTree(String groupname,
                       String channel_properties)


DistributedTree

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

Method Details

_add

public void _add(String fqn)


_add

public void _add(String fqn,
                 Serializable element)


_remove

public void _remove(String fqn)


_set

public void _set(String fqn,
                 Serializable element)


add

public void add(String fqn)


add

public void add(String fqn,
                Serializable element)


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
Specified by:
block in interface MembershipListener


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
Specified by:
getState in interface MessageListener


print

public String print()


receive

public void receive(Message msg)
Specified by:
receive in interface MessageListener


remove

public void remove(String fqn)


removeDistributedTreeListener

public void removeDistributedTreeListener(DistributedTree.DistributedTreeListener listener)


removeViewListener

public void removeViewListener(DistributedTree.ViewListener listener)


set

public void set(String fqn,
                Serializable element)


setState

public void setState(byte[] data)
Specified by:
setState in interface MessageListener


start

public void start()
            throws Exception


start

public void start(long timeout)
            throws Exception


stop

public void stop()


suspect

public void suspect(Address suspected_mbr)
Called when a member is suspected
Specified by:
suspect in interface MembershipListener


viewAccepted

public void viewAccepted(View new_view)
Called by JGroups to notify the target object of a change of membership. No long running actions should be done in this callback in the case of Ensemble, as this would block Ensemble. If some long running action needs to be performed, it should be done in a separate thread (cf. ../Tests/QuoteServer.java).
Specified by:
viewAccepted in interface MembershipListener


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.