|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.perseus.concurrency.distributed.globallock.lib.GlobalLockUser
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
,
Serialized FormField Summary | |
---|---|
DistResUserService |
drus
|
Constructor Summary | |
---|---|
GlobalLockUser(java.io.Serializable objId,
DistResUserService drus)
|
Method Summary | |
---|---|
void |
downgrade(byte lck)
Notifies a lock downgrade. |
byte |
getGrantable()
Get the maximum lock level that can be granted immediately without contacting the global lock coordinator (and so without blocking). |
java.io.Serializable |
getState(java.lang.Object resId)
|
void |
receive(java.lang.Object objId,
java.io.Serializable message)
|
protected void |
sendCoordinator(java.io.Serializable message)
|
java.lang.String |
toString()
|
protected void |
trace(java.lang.String s)
|
void |
uncache()
Uncache the lock level. |
GlobalLockWaiter |
upgrade(byte lck,
boolean sync,
long timeout)
Request a lock upgrade. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public transient DistResUserService drus
Constructor Detail |
public GlobalLockUser(java.io.Serializable objId, DistResUserService drus)
Method Detail |
public byte getGrantable()
GlobalLock
getGrantable
in interface GlobalLock
public GlobalLockWaiter upgrade(byte lck, boolean sync, long timeout) throws DeadLockException, java.lang.InterruptedException
GlobalLock
upgrade
in interface GlobalLock
lck
- the requested lock levelsync
- if true the method blocks until the request is grantedtimeout
- specifies the the maximum time to wait in sync mode
java.lang.InterruptedException
- if the thread has been interrupted while waiting
DeadLockException
- if the timeout has expiredGlobalLockWaiter
public void downgrade(byte lck)
GlobalLock
downgrade
in interface GlobalLock
lck
- the new level wanted for the lockpublic void uncache()
GlobalLock
uncache
in interface GlobalLock
protected void sendCoordinator(java.io.Serializable message)
public void receive(java.lang.Object objId, java.io.Serializable message)
public java.io.Serializable getState(java.lang.Object resId)
public java.lang.String toString()
protected void trace(java.lang.String s)
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |