org.jboss.cache.buddyreplication
Class BuddyManager

java.lang.Object
  extended by org.jboss.cache.buddyreplication.BuddyManager

public class BuddyManager
extends java.lang.Object

Class that manages buddy replication groups.

Author:
Manik Surtani (manik@jboss.org)

Field Summary
static java.lang.String BUDDY_BACKUP_SUBTREE
          Constants representng the buddy backup subtree
static Fqn BUDDY_BACKUP_SUBTREE_FQN
           
 
Constructor Summary
BuddyManager(org.w3c.dom.Element element)
           
 
Method Summary
protected  BuddyLocator createBuddyLocator(java.lang.String className, java.util.Properties props)
           
protected  BuddyLocator createDefaultBuddyLocator(java.util.Properties props)
           
static Fqn getActualFqn(Fqn fqn)
           
 Fqn getBackupFqn(Fqn originalFqn)
          Assumes the backup Fqn if the current instance is the data owner
static Fqn getBackupFqn(Fqn buddyGroupRoot, Fqn origFqn)
           
static Fqn getBackupFqn(java.lang.Object buddyGroupName, Fqn origFqn)
           
 java.util.List getBuddyAddresses()
          Returns a list of buddies for which this instance is Data Owner.
 int getBuddyCommunicationTimeout()
           
 java.lang.String getBuddyPoolName()
           
static java.lang.String getGroupNameFromAddress(java.lang.Object address)
           
 void handleAssignToBuddyGroup(BuddyGroup newGroup, java.util.Map state)
          Called by TreeCache._remoteAssignToBuddyGroup(BuddyGroup g) when a method call for this is received from a remote cache.
 void handlePoolNameBroadcast(org.jgroups.stack.IpAddress address, java.lang.String poolName)
          Called by TreeCache._remoteAnnounceBuddyPoolName(Address address, String buddyPoolName) when a view change occurs and caches need to inform the cluster of which buddy pool it is in.
 void handleRemoveFromBuddyGroup(java.lang.String groupName)
          Called by TreeCache._remoteRemoveFromBuddyGroup(String groupName) when a method call for this is received from a remote cache.
 void init(TreeCache cache)
           
 boolean isAutoDataGravitation()
           
static boolean isBackupFqn(Fqn name)
           
 boolean isDataGravitationRemoveOnFind()
           
 boolean isDataGravitationSearchBackupTrees()
           
 boolean isEnabled()
           
 JBCMethodCall transformFqns(JBCMethodCall call)
          Introspects method call for Fqns and changes them such that they are under the current buddy group's backup subtree (e.g., /_buddy_backup_/my_host:7890/) rather than the root (/).
 JBCMethodCall transformFqns(JBCMethodCall call, boolean transformForCurrentCall)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUDDY_BACKUP_SUBTREE

public static final java.lang.String BUDDY_BACKUP_SUBTREE
Constants representng the buddy backup subtree

See Also:
Constant Field Values

BUDDY_BACKUP_SUBTREE_FQN

public static final Fqn BUDDY_BACKUP_SUBTREE_FQN
Constructor Detail

BuddyManager

public BuddyManager(org.w3c.dom.Element element)
Method Detail

createBuddyLocator

protected BuddyLocator createBuddyLocator(java.lang.String className,
                                          java.util.Properties props)
                                   throws java.lang.ClassNotFoundException,
                                          java.lang.IllegalAccessException,
                                          java.lang.InstantiationException
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException

createDefaultBuddyLocator

protected BuddyLocator createDefaultBuddyLocator(java.util.Properties props)

isEnabled

public boolean isEnabled()

getBuddyPoolName

public java.lang.String getBuddyPoolName()

getGroupNameFromAddress

public static java.lang.String getGroupNameFromAddress(java.lang.Object address)

init

public void init(TreeCache cache)
          throws java.lang.Exception
Throws:
java.lang.Exception

isAutoDataGravitation

public boolean isAutoDataGravitation()

isDataGravitationRemoveOnFind

public boolean isDataGravitationRemoveOnFind()

isDataGravitationSearchBackupTrees

public boolean isDataGravitationSearchBackupTrees()

getBuddyCommunicationTimeout

public int getBuddyCommunicationTimeout()

handlePoolNameBroadcast

public void handlePoolNameBroadcast(org.jgroups.stack.IpAddress address,
                                    java.lang.String poolName)
Called by TreeCache._remoteAnnounceBuddyPoolName(Address address, String buddyPoolName) when a view change occurs and caches need to inform the cluster of which buddy pool it is in.


handleRemoveFromBuddyGroup

public void handleRemoveFromBuddyGroup(java.lang.String groupName)
Called by TreeCache._remoteRemoveFromBuddyGroup(String groupName) when a method call for this is received from a remote cache.


handleAssignToBuddyGroup

public void handleAssignToBuddyGroup(BuddyGroup newGroup,
                                     java.util.Map state)
                              throws java.lang.Exception
Called by TreeCache._remoteAssignToBuddyGroup(BuddyGroup g) when a method call for this is received from a remote cache. If the node is able to join the buddy group, a state transfer is requested from the Data Owner (pull).

Parameters:
newGroup - the buddy group
state - Map of any state from the DataOwner. Cannot be null.
Throws:
java.lang.Exception

getBackupFqn

public static Fqn getBackupFqn(java.lang.Object buddyGroupName,
                               Fqn origFqn)

getBackupFqn

public static Fqn getBackupFqn(Fqn buddyGroupRoot,
                               Fqn origFqn)

isBackupFqn

public static boolean isBackupFqn(Fqn name)

getBuddyAddresses

public java.util.List getBuddyAddresses()
Returns a list of buddies for which this instance is Data Owner. List excludes self. Used by the BaseRPCInterceptor when deciding who to replicate to.


transformFqns

public JBCMethodCall transformFqns(JBCMethodCall call)
Introspects method call for Fqns and changes them such that they are under the current buddy group's backup subtree (e.g., /_buddy_backup_/my_host:7890/) rather than the root (/). Called by BaseRPCInterceptor to transform method calls before broadcasting.


transformFqns

public JBCMethodCall transformFqns(JBCMethodCall call,
                                   boolean transformForCurrentCall)

getBackupFqn

public Fqn getBackupFqn(Fqn originalFqn)
Assumes the backup Fqn if the current instance is the data owner

Parameters:
originalFqn -
Returns:
backup fqn

getActualFqn

public static Fqn getActualFqn(Fqn fqn)


Copyright 1998-2005 JBoss Inc . All Rights Reserved.