public class ZKLocksService extends MemoryLocksService implements Service, Instrumentable
ZKUtils). For example, with default settings, if the
resource we're locking is called "foo", then the ZNode backing the lock will be at /oozie/locks/foo.| Modifier and Type | Field and Description |
|---|---|
static String |
LOCKS_NODE |
static String |
REAPING_THREADS |
static String |
REAPING_THRESHOLD |
INSTRUMENTATION_GROUPCONF_PREFIX, DEFAULT_LOCK_TIMEOUT, lockTimeout| Constructor and Description |
|---|
ZKLocksService() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the zookeeper locks service.
|
HashMap<String,org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock> |
getLocks() |
LockToken |
getReadLock(String resource,
long wait)
Obtain a READ lock for a source.
|
LockToken |
getWriteLock(String resource,
long wait)
Obtain a WRITE lock for a source.
|
void |
init(Services services)
Initialize the zookeeper locks service
|
void |
instrument(Instrumentation instr)
Instruments the zookeeper locks service.
|
getInterfaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInterfacepublic static final String LOCKS_NODE
public static final String REAPING_THRESHOLD
public static final String REAPING_THREADS
public ZKLocksService()
public void init(Services services) throws ServiceException
init in interface Serviceinit in class MemoryLocksServiceservices - services instance.ServiceException - thrown if the service could not initialize.public void destroy()
destroy in interface Servicedestroy in class MemoryLocksServicepublic void instrument(Instrumentation instr)
instrument in interface Instrumentableinstrument in class MemoryLocksServiceinstr - instance to instrument the memory locks service to.public LockToken getReadLock(String resource, long wait) throws InterruptedException
getReadLock in class MemoryLocksServiceresource - resource name.wait - time out in milliseconds to wait for the lock, -1 means no timeout and 0 no wait.null if the lock could not be obtained.InterruptedException - thrown if the thread was interrupted while waiting.public LockToken getWriteLock(String resource, long wait) throws InterruptedException
getWriteLock in class MemoryLocksServiceresource - resource name.wait - time out in milliseconds to wait for the lock, -1 means no timeout and 0 no wait.null if the lock could not be obtained.InterruptedException - thrown if the thread was interrupted while waiting.Copyright © 2015 Apache Software Foundation. All Rights Reserved.