public class NamedLocks extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
NamedLocks.NamedLock |
protected static class |
NamedLocks.WrappedLock |
Constructor and Description |
---|
NamedLocks() |
Modifier and Type | Method and Description |
---|---|
protected Lock |
lock(String name,
boolean writeLock) |
Lock |
readLock(String name)
Obtain a read lock for the supplied name.
|
int |
size()
Get the number of named locks.
|
protected void |
unlock(NamedLocks.NamedLock namedLock,
Lock rawLock) |
Lock |
writeLock(String name)
Obtain a write lock for the supplied name.
|
public Lock writeLock(String name)
Lock.lock()
, Lock.lockInterruptibly()
,
Lock.tryLock()
or Lock.tryLock(long, TimeUnit)
), as those methods will immediately return.name
- the name of the lockpublic Lock readLock(String name)
Lock.lock()
, Lock.lockInterruptibly()
,
Lock.tryLock()
or Lock.tryLock(long, TimeUnit)
), as those methods will immediately return.name
- the name of the lockprotected void unlock(NamedLocks.NamedLock namedLock, Lock rawLock)
public int size()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.