|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.support.lang.ObjectProxySupport<T>
org.entityfs.lock.AbstractReadWriteLockableProxy<T>
public abstract class AbstractReadWriteLockableProxy<T extends ReadWriteLockable>
This abstract class can be used as a starting point for implementing a proxy
for a ReadWriteLockable
class. It implements all methods in the
ReadWriteLockable
interface.
Constructor Summary | |
---|---|
protected |
AbstractReadWriteLockableProxy(T proxied)
|
Method Summary | |
---|---|
EntityLock |
getReadLock()
Get the read lock without locking it. |
EntityLock |
getWriteLock()
Get the write 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. |
boolean |
isWriteLockedByCurrentThread()
Does the calling thread hold a write lock for the lockable object (this)? |
EntityLock |
lockForReading()
Lock object for reading and return the lock. |
EntityLock |
lockForWriting()
Lock the object for writing and return the lock. |
Methods inherited from class org.entityfs.support.lang.ObjectProxySupport |
---|
equals, getProxied, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractReadWriteLockableProxy(T proxied)
Method Detail |
---|
public EntityLock getReadLock()
ReadLockable
This method always returns a lock, even if the object's file system is not locking or if the object is read only.
getReadLock
in interface ReadLockable
public EntityLock getWriteLock()
WriteLockable
This method always returns a lock, even if the object's file system is not locking or if the object is read only.
getWriteLock
in interface WriteLockable
public boolean isReadLockedByCurrentThread()
ReadLockable
isReadLockedByCurrentThread
in interface ReadLockable
true
if the lockable object is read or write locked by
the current thread.public boolean isWriteLockedByCurrentThread()
WriteLockable
isWriteLockedByCurrentThread
in interface WriteLockable
true
if the lockable object is write locked by the
current thread.public EntityLock lockForReading()
ReadLockable
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.
lockForReading
in interface ReadLockable
public EntityLock lockForWriting()
WriteLockable
EntityLockAdapterFactory
and
LockAcquiringStrategy
used. If this is called on an object that
is somehow connected to an Entity
object, that entity's file
systems' lock adapter factory and lock acquiring strategy is used. A
write lock can be downgraded to a read lock (by calling
ReadLockable.lockForReading()
and then releasing the write lock).
An entity in a locking read only file system may still be locked for writing.
For more discussions on locks and locking, see Entity
and
FileSystem
.
This method always returns a lock, even if the file system is not locking.
lockForWriting
in interface WriteLockable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |