org.objectweb.perseus.concurrency.pessimistic
Class RWPri2RLock
public final class RWPri2RLock
A lock associated to an oid (see the "locks" map within the pessimistic
concurrency manager).
Provides "one writer/multiple readers" concurrency policy with priority to
readers (there is a risk for starvation wrt writers).
- E. Bruneton, P. Dechamboux
protected Set | readers - The contexts that have a read lock for the oid to which this object
is associated.
|
protected Object | writer - The contexts that have a lock for the oid to which this object is
associated.
|
boolean | close(Object ctxt) - Removes the given context from the reader and writer lists of this
lock.
|
byte | getMax()
|
void | readIntention(Object ctxt) - Acquires this lock in read mode for the given context.
|
void | writeIntention(Object ctxt) - Acquires this lock in write mode for the given context.
|
readers
protected Set readers
The contexts that have a read lock for the oid to which this object
is associated.
writer
protected Object writer
The contexts that have a lock for the oid to which this object is
associated.
RWPri2RLock
public RWPri2RLock()
RWPri2RLock
public RWPri2RLock(Object hints,
DependencyGraph dg)
close
public boolean close(Object ctxt)
Removes the given context from the reader and writer lists of this
lock.
- close in interface Lock
ctxt
- a context
- true if the reader and writer list are empty, after the
context has been removed from these lists. In such a case, this
object can be removed from the 'locks' map.
getMax
public byte getMax()
- getMax in interface Lock
readIntention
public void readIntention(Object ctxt)
throws ConcurrencyException
Acquires this lock in read mode for the given context. This method
blocks until the lock can be acquired in read mode by this context.
- readIntention in interface Lock
ctxt
- a context.
writeIntention
public void writeIntention(Object ctxt)
throws ConcurrencyException
Acquires this lock in write mode for the given context. This method
blocks until the lock can be acquired in write mode by this context.
- writeIntention in interface Lock
ctxt
- a context.
Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.