org.objectweb.perseus.concurrency.pessimistic
Class PessimisticConcurrencyManager

java.lang.Object
  extended byorg.objectweb.perseus.concurrency.pessimistic.PessimisticConcurrencyManager
All Implemented Interfaces:
ConcurrencyManager

public abstract class PessimisticConcurrencyManager
extends java.lang.Object
implements ConcurrencyManager

Author:
E. Bruneton

Nested Class Summary
protected static class PessimisticConcurrencyManager.ContextInfo
          Information associated to a context
 
Field Summary
protected  java.util.Map contextInfos
          A map associating a ContextInfo to each context.
static java.lang.String DEPENDENCY_GRAPH_BINDING
           
protected  DependencyGraph dg
           
protected  java.util.Map locks
          A map associating locks to all oids in all active contexts.
protected  Logger logger
           
protected  short policy
          True to distinguish read/write locks, false to use a single lock for both modes.
static short POLICY_MUTEX
           
static short POLICY_RW_FIFO
           
static short POLICY_RW_PRIORITY2READERS
           
 
Constructor Summary
PessimisticConcurrencyManager()
           
PessimisticConcurrencyManager(short policy)
           
 
Method Summary
 void abort(java.lang.Object ctx)
          This method allows to release the resources allocated in a given context.
 void begin(java.lang.Object ctx)
          This method records the start of an execution context.
 void bindFc(java.lang.String s, java.lang.Object o)
           
 void finalize(java.lang.Object ctx)
          This method marks the end of accesses made by the execution context.
protected  PessimisticConcurrencyManager.ContextInfo getContextInfo(java.lang.Object ctxt)
           
protected  Lock getLock(java.lang.Object oid, java.lang.Object hints)
          Returns the lock associated to the given oid.
protected abstract  java.lang.Object getState(java.lang.Object ctx, java.lang.Object resourceId, Lock lock, java.lang.Object hints)
           
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String s)
           
 java.lang.Object readIntention(java.lang.Object ctx, java.lang.Object resourceId, java.lang.Object hints)
          This method records an access intention to a data object in read mode.
 void unbindFc(java.lang.String s)
           
 boolean validate(java.lang.Object ctx)
          This method requests the validation os accesses made by the context.
 java.lang.Object writeIntention(java.lang.Object ctx, java.lang.Object resourceId, java.lang.Object hints)
          This method records an access intention to a data object in write mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_MUTEX

public static final short POLICY_MUTEX
See Also:
Constant Field Values

POLICY_RW_PRIORITY2READERS

public static final short POLICY_RW_PRIORITY2READERS
See Also:
Constant Field Values

POLICY_RW_FIFO

public static final short POLICY_RW_FIFO
See Also:
Constant Field Values

DEPENDENCY_GRAPH_BINDING

public static final java.lang.String DEPENDENCY_GRAPH_BINDING
See Also:
Constant Field Values

policy

protected short policy
True to distinguish read/write locks, false to use a single lock for both modes.


locks

protected java.util.Map locks
A map associating locks to all oids in all active contexts.


dg

protected DependencyGraph dg

contextInfos

protected java.util.Map contextInfos
A map associating a ContextInfo to each context.


logger

protected Logger logger
Constructor Detail

PessimisticConcurrencyManager

public PessimisticConcurrencyManager()
                              throws ConcurrencyException

PessimisticConcurrencyManager

public PessimisticConcurrencyManager(short policy)
                              throws ConcurrencyException
Method Detail

getState

protected abstract java.lang.Object getState(java.lang.Object ctx,
                                             java.lang.Object resourceId,
                                             Lock lock,
                                             java.lang.Object hints)
                                      throws ConcurrencyException
Parameters:
ctx - is the context using the resource
resourceId - is the resource identifier
lock - is the lock instance matching the resource
hints - uses to give information on access
Returns:
the resource state to use
Throws:
ConcurrencyException

listFc

public java.lang.String[] listFc()

lookupFc

public java.lang.Object lookupFc(java.lang.String s)

bindFc

public void bindFc(java.lang.String s,
                   java.lang.Object o)

unbindFc

public void unbindFc(java.lang.String s)

begin

public void begin(java.lang.Object ctx)
Description copied from interface: ConcurrencyManager
This method records the start of an execution context. It can be a transaction starting.

Specified by:
begin in interface ConcurrencyManager
Parameters:
ctx - is the context

validate

public boolean validate(java.lang.Object ctx)
Description copied from interface: ConcurrencyManager
This method requests the validation os accesses made by the context. It retrieves a boolean value to indicate if the accesses are validate or not.

Specified by:
validate in interface ConcurrencyManager

finalize

public void finalize(java.lang.Object ctx)
Description copied from interface: ConcurrencyManager
This method marks the end of accesses made by the execution context. This method should be called when the validate method has returned true.

Specified by:
finalize in interface ConcurrencyManager

abort

public void abort(java.lang.Object ctx)
Description copied from interface: ConcurrencyManager
This method allows to release the resources allocated in a given context. This method should be called when the validate method has returned false.

Specified by:
abort in interface ConcurrencyManager

readIntention

public java.lang.Object readIntention(java.lang.Object ctx,
                                      java.lang.Object resourceId,
                                      java.lang.Object hints)
                               throws ConcurrencyException
Description copied from interface: ConcurrencyManager
This method records an access intention to a data object in read mode.

Specified by:
readIntention in interface ConcurrencyManager
Parameters:
resourceId - is the resource identifier
ctx - is an identifier of the execution context. It can be a transaction handle.
hints - is an object parameter permiting to some implementation to do some action at "readIntention time".
Returns:
null or an object depending on the ConcurrencyManager type
Throws:
ConcurrencyException

writeIntention

public java.lang.Object writeIntention(java.lang.Object ctx,
                                       java.lang.Object resourceId,
                                       java.lang.Object hints)
                                throws ConcurrencyException
Description copied from interface: ConcurrencyManager
This method records an access intention to a data object in write mode. A call to the readIntention is necessary before a call to this method.

Specified by:
writeIntention in interface ConcurrencyManager
Parameters:
resourceId - is the resource identifier
ctx - is an identifier of the execution context. It can be a transaction handle.
hints - is an object parameter permiting to some implementation to do some action at "readIntention time".
Returns:
null or an object depending on the ConcurrencyManager type
Throws:
ConcurrencyException

getLock

protected Lock getLock(java.lang.Object oid,
                       java.lang.Object hints)
Returns the lock associated to the given oid.

Parameters:
oid - an object identifier.
Returns:
the lock associated to the given oid.

getContextInfo

protected PessimisticConcurrencyManager.ContextInfo getContextInfo(java.lang.Object ctxt)


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