org.objectweb.perseus.concurrency.api
Interface ConcurrencyManager

All Known Implementing Classes:
OptimisticConcurrencyManager, PessimisticConcurrencyManager

public interface ConcurrencyManager

This is the interface for Concurrency Control service.

Author:
Luciano Garcia-Banuelos (Luciano.Garcia@imag.fr)

Nested Class Summary
static interface ConcurrencyManager.ResourceProvider
          This interfaces is the callback used by the concurrency manager to obtain a resource from its identifier on readIntention or writeIntention calls.
 
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 finalize(java.lang.Object ctx)
          This method marks the end of accesses made by the execution context.
 java.lang.Object readIntention(java.lang.Object ctx, java.lang.Object resourceId, java.lang.Object lockHints, ConcurrencyManager.ResourceProvider resProv, java.lang.Object resourceHints)
          This method records an access intention to a data object in read mode.
 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 resourceId, java.lang.Object lockHints, ConcurrencyManager.ResourceProvider resProv, java.lang.Object resourceHints)
          This method records an access intention to a data object in write mode.
 

Method Detail

begin

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

Parameters:
ctx - is the context

validate

public boolean validate(java.lang.Object ctx)
This method requests the validation of accesses made by the context.

Returns:
a boolean value to indicate if the accesses are validated or not.

finalize

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


abort

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


readIntention

public java.lang.Object readIntention(java.lang.Object ctx,
                                      java.lang.Object resourceId,
                                      java.lang.Object lockHints,
                                      ConcurrencyManager.ResourceProvider resProv,
                                      java.lang.Object resourceHints)
                               throws ConcurrencyException
This method records an access intention to a data object in read mode.

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)
lockHints - 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 resourceId,
                                       java.lang.Object lockHints,
                                       ConcurrencyManager.ResourceProvider resProv,
                                       java.lang.Object resourceHints)
                                throws ConcurrencyException
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.

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)
lockHints - 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.