org.wso2.carbon.registry.core.jdbc.dataaccess
Class JDBCClusterLock

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCClusterLock
All Implemented Interfaces:
ClusterLock

public class JDBCClusterLock
extends Object
implements ClusterLock

A ClusterLock implementation to avoid database schema creation and data population from multiple nodes for JDBC-base databases.


Constructor Summary
JDBCClusterLock()
           
 
Method Summary
 void init(DataAccessManager dataAccessManager, String clusterLockTableStatement)
          Initializes the Node Group Lock Object.
 void lock(String lockName)
          Creates a lock by the given name
 void unlock(String lockName)
          Unlocks a named lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCClusterLock

public JDBCClusterLock()
Method Detail

init

public void init(DataAccessManager dataAccessManager,
                 String clusterLockTableStatement)
          throws RegistryException
Description copied from interface: ClusterLock
Initializes the Node Group Lock Object. This method is responsible of initializing the database, which is required for creating locks in the future.

Specified by:
init in interface ClusterLock
Parameters:
dataAccessManager - the data access manager to be used to communicate with the database.
clusterLockTableStatement - the SQL statement required create the cluster lock table.
Throws:
RegistryException - if the creation of the cluster lock table failed, or if any exceptions occur during the initialization.

lock

public void lock(String lockName)
          throws RegistryException
Description copied from interface: ClusterLock
Creates a lock by the given name

Specified by:
lock in interface ClusterLock
Parameters:
lockName - the name of the lock.
Throws:
RegistryException - if an exception occurred while locking.

unlock

public void unlock(String lockName)
            throws RegistryException
Description copied from interface: ClusterLock
Unlocks a named lock.

Specified by:
unlock in interface ClusterLock
Parameters:
lockName - the name of the lock.
Throws:
RegistryException - if an exception occurred while unlocking.


Copyright © 2014 WSO2 Inc. All Rights Reserved.