Package org.apache.jena.shared
Class LockMRSW
- java.lang.Object
-
- org.apache.jena.shared.LockMRSW
-
- All Implemented Interfaces:
Lock
public class LockMRSW extends java.lang.Object implements Lock
Lock implementation using a Multiple Reader, Single Writer policy. All the locking work is done by the imported WriterPreferenceReadWriteLock. This class adds:- The same thread that acquired a lock should release it
- Lock promotion (turning read locks into write locks) is detached as an error
-
-
Constructor Summary
Constructors Constructor Description LockMRSW()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enterCriticalSection(boolean readLockRequested)
Application controlled locking - enter a critical section.void
leaveCriticalSection()
Application controlled locking - leave a critical section.
-
-
-
Method Detail
-
enterCriticalSection
public final void enterCriticalSection(boolean readLockRequested)
Application controlled locking - enter a critical section. Locking is reentrant so an application can have nested critical sections. Typical code:try { enterCriticalSection(Lock.READ) ; ... application code ... } finally { leaveCriticalSection() ; }
- Specified by:
enterCriticalSection
in interfaceLock
- Parameters:
readLockRequested
- true implies a read lock, false implies write lock.- See Also:
Lock.leaveCriticalSection()
-
leaveCriticalSection
public final void leaveCriticalSection()
Application controlled locking - leave a critical section.- Specified by:
leaveCriticalSection
in interfaceLock
- See Also:
enterCriticalSection(boolean)
-
-