com.hp.hpl.jena.shared
Class LockMRSW
java.lang.Object
com.hp.hpl.jena.shared.LockMRSW
- All Implemented Interfaces:
- Lock
public class LockMRSW
- extends Object
- implements Lock
Lock implemenetation using a Multiple Reader, Single Writer policy.
All the locking work is done by the imported WriterPreferenceReadWriteLock.
Ths class adds:
- The same thread that acquired a lock should release it
- Lock promotion (turning read locks into write locks) is
deteched as an error
- Version:
- $Id: LockMRSW.java,v 1.2 2009/10/01 21:59:51 andy_seaborne Exp $
- Author:
- Andy Seaborne
Fields inherited from interface com.hp.hpl.jena.shared.Lock |
READ, WRITE |
Method Summary |
void |
enterCriticalSection(boolean readLockRequested)
Application controlled locking - enter a critical section. |
void |
leaveCriticalSection()
Application controlled locking - leave a critical section. |
LockMRSW
public LockMRSW()
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 interface Lock
- 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 interface Lock
- See Also:
enterCriticalSection(boolean)
Copyright ? 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP