org.objectweb.transaction.api.lock
Interface ModeLockFeature

All Superinterfaces:
Feature, ReleaseLockFeature

public interface ModeLockFeature
extends ReleaseLockFeature

Definition of a mode Lock. A possible specialisation is the Read/Write model.

Version:
0.1
Author:
Romain Rouvoy
ADL:
name="MODE_LOCK_FEATURE" value="mode-lock-feature"

Field Summary
static java.lang.String MODE_LOCK_FEATURE
          ADL Identifier
 
Fields inherited from interface org.objectweb.transaction.api.lock.ReleaseLockFeature
RELEASE_LOCK_FEATURE
 
Fields inherited from interface org.objectweb.transaction.api.Feature
FEATURE
 
Method Summary
 void acquire(LockIdentifier id, LockMode mode)
          Acquire the Lock with a specific mode.
 boolean isAcquired(LockIdentifier id, LockMode mode)
          Check if the Lock is acquired.
 boolean tryAcquire(LockIdentifier id, LockMode mode)
          Try to acquire the Lock.
 
Methods inherited from interface org.objectweb.transaction.api.lock.ReleaseLockFeature
release
 

Field Detail

MODE_LOCK_FEATURE

public static final java.lang.String MODE_LOCK_FEATURE
ADL Identifier

See Also:
Constant Field Values
Method Detail

acquire

public void acquire(LockIdentifier id,
                    LockMode mode)
Acquire the Lock with a specific mode. If the Lock is not available, the method wait for the release of the Lock.

Parameters:
id - - the lock requester.
mode - - the requested mode of lock.

tryAcquire

public boolean tryAcquire(LockIdentifier id,
                          LockMode mode)
Try to acquire the Lock. This is a non-blocking method.

Parameters:
id - - the lock requester.
mode - - the requested lock mode.
Returns:
true if the lock is acquired - false if the lock can not be acquired.

isAcquired

public boolean isAcquired(LockIdentifier id,
                          LockMode mode)
Check if the Lock is acquired.

Parameters:
id - - the lock requester.
mode - - the requested lock mode.
Returns:
true if the lock is currently acquired - false if the lock is not acquired.