|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadLockable
This interface is implemented by classes that can be locked for reading. This
can for instance be an entity, or a read-enabled aspect of an entity, such as
ReadableFile
.
WriteLockable
Method Summary | |
---|---|
EntityLock |
getReadLock()
Get the read lock without locking it. |
boolean |
isReadLockedByCurrentThread()
Does the calling thread hold a read lock for this object? A write lock also qualifies as a read lock. |
EntityLock |
lockForReading()
Lock object for reading and return the lock. |
Method Detail |
---|
EntityLock getReadLock()
This method always returns a lock, even if the object's file system is not locking or if the object is read only.
EntityLock lockForReading() throws LockTimeoutException
EntityLockAdapterFactory
and
LockAcquiringStrategy
used. If this is called on an object that
somehow is connected to an entity object, that entity's file system's
entity lock adapter factory and lock acquiring strategy is used.
A read lock cannot be upgraded to a write lock (just like how Java's
ReadWriteLock
works).
For more discussions on locks and locking, see Entity
and
FileSystem
.
This method always returns a lock, even if the object's file system is not locking or if the object is read only.
LockTimeoutException
- If the lock acquiring timed out. (It is up
to the LockAcquiringStrategy
to decide if lock acquiring can time
out.)boolean isReadLockedByCurrentThread() throws IllegalStateException
true
if the lockable object is read or write locked by
the current thread.
IllegalStateException
- If this is called on a disconnected entity
view.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |