org.objectweb.perseus.concurrency.pessimistic

Class Lock

Known Direct 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
Object
hints
Logger
logger
protected int
reservations

Constructor Summary

Lock()
Lock(Object hints, DependencyGraph dg)

Method Summary

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
reserve()
void
writeIntention(Object ctxt)
Acquires this lock in write mode for the given context.

Field Details

dg

public DependencyGraph dg


hints

public Object hints


logger

public Logger logger


reservations

protected int reservations

Constructor Details

Lock

public Lock()


Lock

public Lock(Object hints,
            DependencyGraph dg)

Method Details

close

public boolean close(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 byte getMax()


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.

Parameters:
ctxt - a context.


reserve

public void reserve()


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.

Parameters:
ctxt - a context.


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