Class ZooKeeperLocker
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.util.locker.ZooKeeperLocker
-
-
Constructor Summary
Constructors Constructor Description ZooKeeperLocker(String connectString, int sessionTimeout, String lockBasePath, String lockName)
Public constructor.ZooKeeperLocker(String connectString, int sessionTimeout, String lockBasePath, String lockName, boolean sequentialLockName)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
lock()
Wait the token and then lock the resource.void
process(org.apache.zookeeper.WatchedEvent event)
void
unlock()
Unlock the resource.
-
-
-
Constructor Detail
-
ZooKeeperLocker
public ZooKeeperLocker(String connectString, int sessionTimeout, String lockBasePath, String lockName) throws IOException
Public constructor.- Throws:
IOException
- if an error occurs while creating the ZooKeeper connection
-
ZooKeeperLocker
public ZooKeeperLocker(String connectString, int sessionTimeout, String lockBasePath, String lockName, boolean sequentialLockName) throws IOException
Public constructor.- Parameters:
connectString
- Zookeeper connection stringsessionTimeout
- session time outlockBasePath
- lock base pathlockName
- lock namesequentialLockName
- sequential lock- Throws:
IOException
- if an error occurs while creating the ZooKeeper connection
-
-
Method Detail
-
lock
public void lock() throws IOException
Description copied from interface:Locker
Wait the token and then lock the resource.- Specified by:
lock
in interfaceLocker
- Throws:
IOException
- if an error occurs while locking the resource
-
unlock
public void unlock() throws IOException
Description copied from interface:Locker
Unlock the resource.- Specified by:
unlock
in interfaceLocker
- Throws:
IOException
- if an error occurs while unlocking the resource
-
process
public void process(org.apache.zookeeper.WatchedEvent event)
- Specified by:
process
in interfaceorg.apache.zookeeper.Watcher
-
-