org.usergrid.locking.zookeeper
Class ZookeeperLockImpl

java.lang.Object
  extended by org.usergrid.locking.zookeeper.ZookeeperLockImpl
All Implemented Interfaces:
Lock

public class ZookeeperLockImpl
extends Object
implements Lock

Wrapper for locks using curator

Author:
tnine

Constructor Summary
ZookeeperLockImpl(com.netflix.curator.framework.recipes.locks.InterProcessMutex zkMutex)
           
 
Method Summary
 void lock()
          Block until a lock is available
 boolean tryLock(long timeout, TimeUnit time)
          Acquire the lock.
 void unlock()
          Release the lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZookeeperLockImpl

public ZookeeperLockImpl(com.netflix.curator.framework.recipes.locks.InterProcessMutex zkMutex)
Method Detail

tryLock

public boolean tryLock(long timeout,
                       TimeUnit time)
                throws UGLockException
Description copied from interface: Lock
Acquire the lock. Wait the specified amount of time before giving up

Specified by:
tryLock in interface Lock
Parameters:
timeout - The amount of time to wait
time - the units of time to wait
Throws:
UGLockException

lock

public void lock()
          throws UGLockException
Description copied from interface: Lock
Block until a lock is available

Specified by:
lock in interface Lock
Throws:
UGLockException

unlock

public void unlock()
            throws UGLockException
Description copied from interface: Lock
Release the lock

Specified by:
unlock in interface Lock
Throws:
UGLockException


Copyright © 2013. All Rights Reserved.