org.objectweb.perseus.concurrency.distributed.globallock.api
Interface GlobalLock
- GlobalLockUser
public interface GlobalLock
This is the interface of global locks. Global locks are created and
associated w/ resource identifiers using the getGlobalLock
of the GlobalLockManager
interface. Once created the lock
can be upgraded/downgraded to a specified level. The initial value is
implementation dependent.
GlobalLockManager
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).
|
void | uncache() - Uncache the lock level.
|
GlobalLockWaiter | upgrade(byte lck, boolean sync, long timeout) - Request a lock upgrade.
|
downgrade
public void downgrade(byte lck)
Notifies a lock downgrade.
lck
- the new level wanted for the lock
getGrantable
public byte getGrantable()
Get the maximum lock level that can be granted immediately without
contacting the global lock coordinator (and so without blocking).
Note that this is just a hint. There is no guarantee that a subsequent
call to upgrade will not block.
- the maximum grantable lock level
uncache
public void uncache()
Uncache the lock level. The following call to upgrade will automatically
generate a request to the coordinator.
upgrade
public GlobalLockWaiter upgrade(byte lck,
boolean sync,
long timeout)
throws DeadLockException,
InterruptedException
Request a lock upgrade. In synchronous mode the method returns when
the lock has been granted. In asynchronous mode the method returns a
waiter object if the request cannot be granted immediately. The caller
must call the waitLock method of this object to effectively wait
for the lock. It must also call the signalHandled method when the
granting has been handled to let other waiters be unblocked. This scheme
let the possibility to implement a FIFO handling of requests.
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
- a waiter object in asynchronous mode (sync == false) if the
request cannot be satisfied immediately.
DeadLockException
- if the timeout has expired
GlobalLockWaiter
Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.