org.objectweb.perseus.concurrency.pessimistic
Class Lock

java.lang.Object
  extended byorg.objectweb.perseus.concurrency.pessimistic.Lock
Direct Known Subclasses:
MutexLock, RWFifoLock, RWPri2RLock

public abstract class Lock
extends java.lang.Object

A lock associated to an oid (see the "locks" map within the pessimistic concurrency manager).

Author:
E. Bruneton, P. Dechamboux

Field Summary
 DependencyGraph dg
           
 java.lang.Object hints
           
 Logger logger
           
 java.lang.Object oid
           
protected  int reservations
           
 
Constructor Summary
Lock()
           
Lock(java.lang.Object hints, DependencyGraph dg)
           
 
Method Summary
abstract  boolean close(java.lang.Object ctxt)
          Removes the given context from the reader and writer lists of this lock.
abstract  byte getMax()
           
abstract  void readIntention(java.lang.Object ctxt)
          Acquires this lock in read mode for the given context.
 void reserve()
           
abstract  void writeIntention(java.lang.Object ctxt)
          Acquires this lock in write mode for the given context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reservations

protected int reservations

hints

public java.lang.Object hints

dg

public DependencyGraph dg

logger

public Logger logger

oid

public java.lang.Object oid
Constructor Detail

Lock

public Lock()

Lock

public Lock(java.lang.Object hints,
            DependencyGraph dg)
Method Detail

reserve

public void reserve()

readIntention

public abstract void readIntention(java.lang.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.

Parameters:
ctxt - a context.
Throws:
ConcurrencyException

writeIntention

public abstract void writeIntention(java.lang.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.

Parameters:
ctxt - a context.
Throws:
ConcurrencyException

close

public abstract boolean close(java.lang.Object ctxt)
Removes the given context from the reader and writer lists of this lock.

Parameters:
ctxt - a context
Returns:
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 abstract byte getMax()


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.