org.jboss.cache.buddyreplication
Class BuddyManager

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

public class BuddyManager
extends Object

Class that manages buddy replication groups.

Author:
Manik Surtani (manik@jboss.org)

Nested Class Summary
 class BuddyManager.ViewChangeListener
           
 
Field Summary
static String BUDDY_BACKUP_SUBTREE
          Constants representng the buddy backup subtree
static Fqn<String> BUDDY_BACKUP_SUBTREE_FQN
           
 
Constructor Summary
BuddyManager()
           
BuddyManager(BuddyReplicationConfig config)
           
 
Method Summary
protected  BuddyLocator createBuddyLocator(BuddyReplicationConfig.BuddyLocatorConfig config)
           
protected  BuddyLocator createDefaultBuddyLocator()
           
 List<org.jgroups.Address> getBackupDataOwners()
          Returns a List identifying the DataOwner for each buddy group for which this node serves as a backup node.
 Fqn getBackupFqn(Fqn originalFqn)
          Assumes the backup Fqn if the current instance is the data owner
 List<org.jgroups.Address> getBuddyAddresses()
          Returns a list of buddies for which this instance is Data Owner.
 Vector<org.jgroups.Address> getBuddyAddressesAsVector()
          Created as an optimisation for JGroups, which uses vectors.
 int getBuddyCommunicationTimeout()
           
 String getBuddyPoolName()
           
 BuddyReplicationConfig getConfig()
           
 List<org.jgroups.Address> getMembersOutsideBuddyGroup()
           
 void handleAssignToBuddyGroup(BuddyGroup newGroup, Map<Fqn,byte[]> state)
          Called by CacheImpl._remoteAssignToBuddyGroup(BuddyGroup g) when a method call for this is received from a remote cache.
 void handlePoolNameBroadcast(org.jgroups.Address address, String poolName)
          Called by CacheImpl._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(String groupName)
          Called by CacheImpl._remoteRemoveFromBuddyGroup(String groupName) when a method call for this is received from a remote cache.
 void init()
           
 boolean isAutoDataGravitation()
           
 boolean isDataGravitationRemoveOnFind()
           
 boolean isDataGravitationSearchBackupTrees()
           
 boolean isEnabled()
           
 void stop()
          Stops the buddy manager and the related async thread.
 VisitableCommand transformFqns(VisitableCommand call)
           
 ReplicateCommand transformReplicateCommand(ReplicateCommand rc)
           
 
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 String BUDDY_BACKUP_SUBTREE
Constants representng the buddy backup subtree

See Also:
Constant Field Values

BUDDY_BACKUP_SUBTREE_FQN

public static final Fqn<String> BUDDY_BACKUP_SUBTREE_FQN
Constructor Detail

BuddyManager

public BuddyManager()

BuddyManager

public BuddyManager(BuddyReplicationConfig config)
Method Detail

getConfig

public BuddyReplicationConfig getConfig()

createBuddyLocator

protected BuddyLocator createBuddyLocator(BuddyReplicationConfig.BuddyLocatorConfig config)
                                   throws ClassNotFoundException,
                                          IllegalAccessException,
                                          InstantiationException
Throws:
ClassNotFoundException
IllegalAccessException
InstantiationException

createDefaultBuddyLocator

protected BuddyLocator createDefaultBuddyLocator()

isEnabled

public boolean isEnabled()

getBuddyPoolName

public String getBuddyPoolName()

stop

public void stop()
Stops the buddy manager and the related async thread.


init

public void init()
          throws CacheException
Throws:
CacheException

isAutoDataGravitation

public boolean isAutoDataGravitation()

isDataGravitationRemoveOnFind

public boolean isDataGravitationRemoveOnFind()

isDataGravitationSearchBackupTrees

public boolean isDataGravitationSearchBackupTrees()

getBuddyCommunicationTimeout

public int getBuddyCommunicationTimeout()

handlePoolNameBroadcast

public void handlePoolNameBroadcast(org.jgroups.Address address,
                                    String poolName)
Called by CacheImpl._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(String groupName)
                                throws BuddyNotInitException
Called by CacheImpl._remoteRemoveFromBuddyGroup(String groupName) when a method call for this is received from a remote cache.

Throws:
BuddyNotInitException

handleAssignToBuddyGroup

public void handleAssignToBuddyGroup(BuddyGroup newGroup,
                                     Map<Fqn,byte[]> state)
                              throws Exception
Called by CacheImpl._remoteAssignToBuddyGroup(BuddyGroup g) when a method call for this is received from a remote cache.

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

getBackupDataOwners

public List<org.jgroups.Address> getBackupDataOwners()
Returns a List identifying the DataOwner for each buddy group for which this node serves as a backup node.


getBuddyAddresses

public List<org.jgroups.Address> 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.


getBuddyAddressesAsVector

public Vector<org.jgroups.Address> getBuddyAddressesAsVector()
Created as an optimisation for JGroups, which uses vectors.

Since:
2.2.0

getMembersOutsideBuddyGroup

public List<org.jgroups.Address> getMembersOutsideBuddyGroup()

transformFqns

public VisitableCommand transformFqns(VisitableCommand call)
See Also:
BuddyFqnTransformer

transformReplicateCommand

public ReplicateCommand transformReplicateCommand(ReplicateCommand rc)

getBackupFqn

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

Parameters:
originalFqn -
Returns:
backup fqn


Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.