|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.lock.impl.ReentrantLockAdapter
org.entityfs.lock.impl.rw.ReadWriteEntityLockAdapter
public class ReadWriteEntityLockAdapter
This EntityLockAdapter
uses a
ReadLockOwnerAwareReentrantReadWriteLock
for the lockable object's
read and write lock and an EntityLockFactory
for creating other
locks.
Method Summary | |
---|---|
void |
createEntityLockForIdentifier(Object identifier,
boolean readLock,
boolean writeLock)
This must be called before using a lock to ensure that it exists in the lock adapter. |
EntityLock |
getEntityLock(Object identifier)
Get the lock identified by the identifier. |
EntityLock |
getReadLock()
Get the entity's read lock. |
EntityLock |
getWriteLock()
|
boolean |
isReadLockedByCurrentThread()
|
boolean |
isWriteLockedByCurrentThread()
|
Methods inherited from class org.entityfs.lock.impl.ReentrantLockAdapter |
---|
createLockForIdentifier, getLock, getLockFactory, registerLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.entityfs.lock.LockAdapter |
---|
createLockForIdentifier, getLock |
Method Detail |
---|
public EntityLock getReadLock()
EntityLockAdapter
EntityLockAdapterFactory
used by the file system.
getReadLock
in interface EntityLockAdapter
public EntityLock getWriteLock()
getWriteLock
in interface EntityLockAdapter
public boolean isReadLockedByCurrentThread()
isReadLockedByCurrentThread
in interface EntityLockAdapter
public boolean isWriteLockedByCurrentThread()
isWriteLockedByCurrentThread
in interface EntityLockAdapter
public void createEntityLockForIdentifier(Object identifier, boolean readLock, boolean writeLock)
EntityLockAdapter
Locks created by calling this method can later be retrieved by calling
EntityLockAdapter.getEntityLock(Object)
.
createEntityLockForIdentifier
in interface EntityLockAdapter
identifier
- An identifier that is unique for the lock-using object.
This may be any kind of object, a static Object
constant, for
instance.readLock
- Is the lock a read lock? I.e., should the lock's
isReadLock()
method return true
?writeLock
- Is the lock a write lock? I.e., should the lock's
isWriteLock()
method return true
?public EntityLock getEntityLock(Object identifier)
EntityLockAdapter
EntityLockAdapter.createEntityLockForIdentifier(Object, boolean, boolean)
before
it can be retrieved by this method.
getEntityLock
in interface EntityLockAdapter
identifier
- The identifier for the lock. The identifier for each
defined lock is unique in the lock using object.
null
if no lock is defined for the
identifier.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |