org.objectweb.perseus.concurrency.distributed.globallock.lib
Class GlobalLockUser
java.lang.Object
org.objectweb.perseus.concurrency.distributed.globallock.lib.GlobalLockUser
- DistResUser, GlobalLock, Serializable
public class GlobalLockUser
extends java.lang.Object
This class the client side of global lock management. A global lock can be
associated to each resource that is to be shared between different
machines (actually JVMs).
Global lock users are coordinated by a GlobalLockCoordinator and
communicate with it through the DistResUserService interface.
Global locks permit to share a resource between nodes, but not between tasks.
One must ensure that the global lock that has been obtained locally
is sufficient to satisfy the requirements of the local tasks, and that
the local tasks are well synchronized according to the local lock levels they
have obtained. Locks are managed in term of level. The lock level must be
explicitly upgraded if what is grantable not sufficient to satisfy new local
requirements and must be explicitly downgraded to the maximum local
requirements when local requirements are released.
Locks are cached: the local node indicates what is locally required but
internally but what will be locally grantable can be bigger that what has
been actually granted. The local lock level can be downgraded to NOLOCK,
then later upgraded to some lock value without inducing a request to the
coordinator provided the grantable level is bigger thant the new requested
level. Lock levels are called back by the coordinator when required.
For each shared resource the user state is composed of three lock level
- what HAS BEEN granted locally
- what CAN BE granted locally
- what has been requested to the coordinator (which is hidden to users)
Note that the different level of lock and their compatibility is configured
through the LockValue interface. This implementation works well with
Shared/Exclusive locks but should also work with more complex lock values
like intention to read/write lock levels, provided lock levels are strictly
ordered. This can be configured when initializing the GlobalLockMasterFactory
Note that at the moment, deadlocks are detected with timeout. AE timeout can
occur if the lock level cannot be granted because of its use, or because
there are some communication problems. However, when in the future fault
tolerence will be supported, the two behaviors will be distinguished. In
this case, the timeout value will be a hint to indicate a normal amount
of time a lock request should be blocked according to the application
behaviour. The time spent due to failure correction should not be taken into
account.
GlobalLockCoordinator
, GlobalLockCoordinatorFactory
, LockValue
, org.objectweb.perseus.distribution.api.DistResUser
, org.objectweb.perseus.distribution.api.DistResUserService
drus
public DistResUserService drus
GlobalLockUser
public GlobalLockUser(Serializable objId,
DistResUserService drus)
getState
public Serializable getState(Object resId)
receive
public void receive(Object objId,
Serializable message)
sendCoordinator
protected void sendCoordinator(Serializable message)
toString
public String toString()
trace
protected void trace(String s)
Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.