java.lang.Object
org.apache.jena.shared.LockMRSW
- All Implemented Interfaces:
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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
enterCriticalSection
(boolean readLockRequested) Application controlled locking - enter a critical section.final void
Application controlled locking - leave a critical section.
-
Constructor Details
-
LockMRSW
public LockMRSW()
-
-
Method Details
-
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:
-
leaveCriticalSection
public final void leaveCriticalSection()Application controlled locking - leave a critical section.- Specified by:
leaveCriticalSection
in interfaceLock
- See Also:
-