org.objectweb.perseus.concurrency.optimistic
Class OptimisticConcurrencyManager

java.lang.Object
  extended byorg.objectweb.perseus.concurrency.optimistic.OptimisticConcurrencyManager
All Implemented Interfaces:
ConcurrencyManager

public class OptimisticConcurrencyManager
extends java.lang.Object
implements ConcurrencyManager

Author:
E. Bruneton

Nested Class Summary
 
Nested classes inherited from class org.objectweb.perseus.concurrency.api.ConcurrencyManager
ConcurrencyManager.ResourceProvider
 
Field Summary
static java.lang.String DEPENDENCY_GRAPH_BINDING
           
protected  Logger logger
           
protected  java.util.Map timeStamps
          A map associating time stamps to all oids in all active contexts.
 
Constructor Summary
OptimisticConcurrencyManager()
           
 
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 closeTimeStamp(TimeStamp timeStamp, java.lang.Object ctx)
           
 void finalize(java.lang.Object ctx)
          This method marks the end of accesses made by the execution context.
protected  java.lang.Object getResourceId(java.lang.Object object)
           
 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 thinLock, ConcurrencyManager.ResourceProvider resProv, java.lang.Object resourceHints)
          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 of accesses made by the context.
 java.lang.Object writeIntention(java.lang.Object ctx, java.lang.Object resource, java.lang.Object thinLock, ConcurrencyManager.ResourceProvider resProv, java.lang.Object resourceHints)
          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

DEPENDENCY_GRAPH_BINDING

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

logger

protected Logger logger

timeStamps

protected java.util.Map timeStamps
A map associating time stamps to all oids in all active contexts.

Constructor Detail

OptimisticConcurrencyManager

public OptimisticConcurrencyManager()
Method Detail

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)
            throws IllegalBindingException,
                   NoSuchInterfaceException
Throws:
IllegalBindingException
NoSuchInterfaceException

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 of accesses made by the context.

Specified by:
validate in interface ConcurrencyManager
Returns:
a boolean value to indicate if the accesses are validated or not.

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

closeTimeStamp

public void closeTimeStamp(TimeStamp timeStamp,
                           java.lang.Object ctx)

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

getResourceId

protected java.lang.Object getResourceId(java.lang.Object object)

readIntention

public java.lang.Object readIntention(java.lang.Object ctx,
                                      java.lang.Object resourceId,
                                      java.lang.Object thinLock,
                                      ConcurrencyManager.ResourceProvider resProv,
                                      java.lang.Object resourceHints)
                               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:
ctx - is an identifier of the execution context. It can be a transaction handle.
resourceId - is the resource identifier (Object used for synchronization and equals)
thinLock - permit to take smaller lock than on the resource globaly
resProv - is used to retrieve the resource. If not resource provider is specified (null value), then the method returns a null value.
resourceHints - is a hints helping the ResourceProvider to provide the resource corresponding to the identier
Returns:
the resource obtained from the resource provider if there is one.
Throws:
ConcurrencyException - if there is a concurrency problem. In this last case that means the context should be cancelled.

writeIntention

public java.lang.Object writeIntention(java.lang.Object ctx,
                                       java.lang.Object resource,
                                       java.lang.Object thinLock,
                                       ConcurrencyManager.ResourceProvider resProv,
                                       java.lang.Object resourceHints)
                                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:
ctx - is an identifier of the execution context. It can be a transaction handle.
resource - is the resource identifier (Object used for synchronization and equals)
thinLock - permit to take smaller lock than on the resource globaly
resProv - is used to retrieve the resource. If not resource provider is specified (null value), then the method returns a null value.
resourceHints - is a hints helping the ResourceProvider to provide the resource corresponding to the identier
Returns:
the resource obtained from the resource provider if there is one.
Throws:
ConcurrencyException - if there is a concurrency problem. In this last case that means the context should be cancelled.


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