org.usergrid.locking.zookeeper
Class ZooKeeperLockManagerImpl

java.lang.Object
  extended by org.usergrid.locking.zookeeper.ZooKeeperLockManagerImpl
All Implemented Interfaces:
LockManager

public final class ZooKeeperLockManagerImpl
extends Object
implements LockManager

Implementation for Zookeeper service that handles global locks.


Field Summary
protected static org.slf4j.Logger logger
           
 
Constructor Summary
ZooKeeperLockManagerImpl()
           
ZooKeeperLockManagerImpl(String hostPort, int sessionTimeout, int maxAttemps)
           
 
Method Summary
 Lock createLock(UUID applicationId, String... path)
          Acquires a lock on a particular path.
 String getHostPort()
           
 int getMaxAttempts()
           
 int getSessionTimeout()
           
 void init()
           
 void setHostPort(String hostPort)
           
 void setMaxAttempts(int maxAttemps)
           
 void setSessionTimeout(int sessionTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.slf4j.Logger logger
Constructor Detail

ZooKeeperLockManagerImpl

public ZooKeeperLockManagerImpl(String hostPort,
                                int sessionTimeout,
                                int maxAttemps)

ZooKeeperLockManagerImpl

public ZooKeeperLockManagerImpl()
Method Detail

init

@PostConstruct
public void init()

createLock

public Lock createLock(UUID applicationId,
                       String... path)
                throws UGLockException
Description copied from interface: LockManager
Acquires a lock on a particular path.

Specified by:
createLock in interface LockManager
Parameters:
applicationId - application UUID
path - a unique path
Throws:
UGLockException - if the lock cannot be acquired

getHostPort

public String getHostPort()

setHostPort

public void setHostPort(String hostPort)

getSessionTimeout

public int getSessionTimeout()

setSessionTimeout

public void setSessionTimeout(int sessionTimeout)

getMaxAttempts

public int getMaxAttempts()

setMaxAttempts

public void setMaxAttempts(int maxAttemps)


Copyright © 2013. All Rights Reserved.