org.wso2.carbon.registry.core.clustering
Class NodeGroupLock

java.lang.Object
  extended by org.wso2.carbon.registry.core.clustering.NodeGroupLock

public class NodeGroupLock
extends java.lang.Object

This utilizes the environment's cluster lock to ensure that no more than a single master node exists.


Field Summary
static java.lang.String INITIALIZE_LOCK
          The name of the lock used during the initialization process.
 
Constructor Summary
NodeGroupLock()
           
 
Method Summary
static void init(DataAccessManager dataAccessManager)
          Initializes the Node Group Lock Object.
static void lock(java.lang.String lockName)
          Creates a lock by the given name
static void unlock(java.lang.String lockName)
          Unlocks a named lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIALIZE_LOCK

public static final java.lang.String INITIALIZE_LOCK
The name of the lock used during the initialization process.

See Also:
Constant Field Values
Constructor Detail

NodeGroupLock

public NodeGroupLock()
Method Detail

init

public static void init(DataAccessManager dataAccessManager)
                 throws RegistryException
Initializes the Node Group Lock Object. This method is responsible of initializing the database, which is required for creating locks in the future.

Parameters:
dataAccessManager - the data access manager to be used to communicate with the database.
Throws:
RegistryException - if the creation of the cluster lock table failed, or if any exceptions occur during the initialization.

lock

public static void lock(java.lang.String lockName)
                 throws RegistryException
Creates a lock by the given name

Parameters:
lockName - the name of the lock.
Throws:
RegistryException - if an exception occurred while locking.

unlock

public static void unlock(java.lang.String lockName)
                   throws RegistryException
Unlocks a named lock.

Parameters:
lockName - the name of the lock.
Throws:
RegistryException - if an exception occurred while unlocking.


Copyright © 2011 WSO2 Inc. All Rights Reserved.