org.ow2.carol.cmi.controller.server.impl.jgroups
Class SynchronizedDistributedTree

java.lang.Object
  extended by org.ow2.carol.cmi.controller.server.impl.jgroups.SynchronizedDistributedTree
All Implemented Interfaces:
org.jgroups.MembershipListener, org.jgroups.MessageListener, IIntercepted, org.ow2.externals.jgroups.IDistributedTree

public final class SynchronizedDistributedTree
extends java.lang.Object
implements org.jgroups.MessageListener, org.jgroups.MembershipListener, org.ow2.externals.jgroups.IDistributedTree, IIntercepted

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
 
Nested classes/interfaces inherited from interface org.ow2.externals.jgroups.IDistributedTree
org.ow2.externals.jgroups.IDistributedTree.DistributedTreeListener, org.ow2.externals.jgroups.IDistributedTree.ViewListener
 
Constructor Summary
SynchronizedDistributedTree()
           
SynchronizedDistributedTree(java.lang.String groupname, java.lang.String channel_properties)
           
 
Method Summary
 void _add(java.lang.String fqn)
           
 void _add(java.lang.String fqn, java.io.Serializable element)
           
 void _remove(java.lang.String fqn)
           
 void _reset(java.lang.String fqn, java.io.Serializable element)
          similar to set, but does not error if node does not exist, but rather does an add instead
 void _set(java.lang.String fqn, java.io.Serializable element)
           
 void add(java.lang.String fqn)
           
 void add(java.lang.String fqn, java.io.Serializable element)
           
 void add(java.lang.String fqn, java.io.Serializable element, int timeout)
           
 void addDistributedTreeListener(org.ow2.externals.jgroups.IDistributedTree.DistributedTreeListener listener)
           
 void addViewListener(org.ow2.externals.jgroups.IDistributedTree.ViewListener listener)
           
 void block()
          Block sending and receiving of messages until ViewAccepted is called
 boolean exists(java.lang.String fqn)
           
 java.io.Serializable get(java.lang.String fqn)
           
 org.jgroups.Channel getChannel()
          Returns the Channel the DistributedTree is connected to
 java.util.Vector<java.lang.String> getChildrenNames(java.lang.String fqn)
          Returns all children of a Node as strings
 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
 org.jgroups.Address getLocalAddress()
           
 byte[] getState()
          Return a copy of the tree
 java.lang.String print()
           
 void receive(org.jgroups.Message msg)
           
 void remove(java.lang.String fqn)
           
 void remove(java.lang.String fqn, int timeout)
           
 void removeDistributedTreeListener(org.ow2.externals.jgroups.IDistributedTree.DistributedTreeListener listener)
           
 void removeViewListener(org.ow2.externals.jgroups.IDistributedTree.ViewListener listener)
           
 void reset(java.lang.String fqn, java.io.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
 void reset(java.lang.String fqn, java.io.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
 void set(java.lang.String fqn, java.io.Serializable element)
           
 void set(java.lang.String fqn, java.io.Serializable element, int timeout)
           
 void setDeadlockDetection(boolean flag)
           
 void setState(byte[] data)
           
 void start()
           
 void start(long timeout)
           
 void stop()
           
 void suspect(org.jgroups.Address suspected_mbr)
          Called when a member is suspected
 void viewAccepted(org.jgroups.View new_view)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedDistributedTree

public SynchronizedDistributedTree()

SynchronizedDistributedTree

public SynchronizedDistributedTree(java.lang.String groupname,
                                   java.lang.String channel_properties)
Method Detail

getLocalAddress

public org.jgroups.Address getLocalAddress()
Specified by:
getLocalAddress in interface org.ow2.externals.jgroups.IDistributedTree

setDeadlockDetection

public void setDeadlockDetection(boolean flag)

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface org.ow2.externals.jgroups.IDistributedTree
Throws:
java.lang.Exception

start

public void start(long timeout)
           throws java.lang.Exception
Specified by:
start in interface org.ow2.externals.jgroups.IDistributedTree
Throws:
java.lang.Exception

stop

public void stop()
Specified by:
stop in interface IIntercepted
Specified by:
stop in interface org.ow2.externals.jgroups.IDistributedTree

addDistributedTreeListener

public void addDistributedTreeListener(org.ow2.externals.jgroups.IDistributedTree.DistributedTreeListener listener)
Specified by:
addDistributedTreeListener in interface org.ow2.externals.jgroups.IDistributedTree

removeDistributedTreeListener

public void removeDistributedTreeListener(org.ow2.externals.jgroups.IDistributedTree.DistributedTreeListener listener)
Specified by:
removeDistributedTreeListener in interface org.ow2.externals.jgroups.IDistributedTree

addViewListener

public void addViewListener(org.ow2.externals.jgroups.IDistributedTree.ViewListener listener)
Specified by:
addViewListener in interface org.ow2.externals.jgroups.IDistributedTree

removeViewListener

public void removeViewListener(org.ow2.externals.jgroups.IDistributedTree.ViewListener listener)
Specified by:
removeViewListener in interface org.ow2.externals.jgroups.IDistributedTree

add

public void add(java.lang.String fqn)
Specified by:
add in interface IIntercepted
Specified by:
add in interface org.ow2.externals.jgroups.IDistributedTree

add

public void add(java.lang.String fqn,
                java.io.Serializable element)
Specified by:
add in interface IIntercepted
Specified by:
add in interface org.ow2.externals.jgroups.IDistributedTree

reset

public void reset(java.lang.String fqn,
                  java.io.Serializable element)
Description copied from interface: IIntercepted
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

Specified by:
reset in interface IIntercepted
Specified by:
reset in interface org.ow2.externals.jgroups.IDistributedTree

remove

public void remove(java.lang.String fqn)
Specified by:
remove in interface IIntercepted
Specified by:
remove in interface org.ow2.externals.jgroups.IDistributedTree

add

public void add(java.lang.String fqn,
                java.io.Serializable element,
                int timeout)
Specified by:
add in interface IIntercepted
Specified by:
add in interface org.ow2.externals.jgroups.IDistributedTree

reset

public void reset(java.lang.String fqn,
                  java.io.Serializable element,
                  int timeout)
Description copied from interface: IIntercepted
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

Specified by:
reset in interface IIntercepted
Specified by:
reset in interface org.ow2.externals.jgroups.IDistributedTree

remove

public void remove(java.lang.String fqn,
                   int timeout)
Specified by:
remove in interface IIntercepted
Specified by:
remove in interface org.ow2.externals.jgroups.IDistributedTree

exists

public boolean exists(java.lang.String fqn)
Specified by:
exists in interface IIntercepted
Specified by:
exists in interface org.ow2.externals.jgroups.IDistributedTree

get

public java.io.Serializable get(java.lang.String fqn)
Specified by:
get in interface IIntercepted
Specified by:
get in interface org.ow2.externals.jgroups.IDistributedTree

set

public void set(java.lang.String fqn,
                java.io.Serializable element)
Specified by:
set in interface IIntercepted
Specified by:
set in interface org.ow2.externals.jgroups.IDistributedTree

set

public void set(java.lang.String fqn,
                java.io.Serializable element,
                int timeout)
Specified by:
set in interface IIntercepted
Specified by:
set in interface org.ow2.externals.jgroups.IDistributedTree

getChildrenNames

public java.util.Vector<java.lang.String> getChildrenNames(java.lang.String fqn)
Returns all children of a Node as strings

Specified by:
getChildrenNames in interface IIntercepted
Specified by:
getChildrenNames in interface org.ow2.externals.jgroups.IDistributedTree

print

public java.lang.String print()

getGroupName

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

Returns:
String

getChannel

public org.jgroups.Channel getChannel()
Returns the Channel the DistributedTree is connected to

Specified by:
getChannel in interface org.ow2.externals.jgroups.IDistributedTree
Returns:
Channel

getGroupMembersNumber

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

Returns:
int

_add

public void _add(java.lang.String fqn)

_add

public void _add(java.lang.String fqn,
                 java.io.Serializable element)

_remove

public void _remove(java.lang.String fqn)

_set

public void _set(java.lang.String fqn,
                 java.io.Serializable element)

_reset

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


receive

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

getState

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

Specified by:
getState in interface org.jgroups.MessageListener

setState

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

viewAccepted

public void viewAccepted(org.jgroups.View new_view)
Specified by:
viewAccepted in interface org.jgroups.MembershipListener

suspect

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

Specified by:
suspect in interface org.jgroups.MembershipListener

block

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

Specified by:
block in interface org.jgroups.MembershipListener


Copyright © 2008 OW2 Consortium. All Rights Reserved.