|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.oozie.util.MemoryLocks
public class MemoryLocks
In memory resource locking that provides READ/WRITE lock capabilities.
Nested Class Summary | |
---|---|
class |
MemoryLocks.LockToken
Lock token returned when obtaining a lock, the token must be released when the lock is not needed anymore. |
Constructor Summary | |
---|---|
MemoryLocks()
|
Method Summary | |
---|---|
MemoryLocks.LockToken |
getReadLock(String resource,
long wait)
Obtain a READ lock for a source. |
MemoryLocks.LockToken |
getWriteLock(String resource,
long wait)
Obtain a WRITE lock for a source. |
int |
size()
Return the number of active locks. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryLocks()
Method Detail |
---|
public int size()
public MemoryLocks.LockToken getReadLock(String resource, long wait) throws InterruptedException
resource
- 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 MemoryLocks.LockToken getWriteLock(String resource, long wait) throws InterruptedException
resource
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |