public class UESLock
extends java.lang.Object
UESLock lock = UESLock.create(resourceUri, createDto);
try {
// ...
// a business logic here
// ...
} finally {
lock.unlock();
}
Modifier and Type | Field and Description |
---|---|
private static long |
DEFAULT_WAIT_TIMEOUT
Default timeout for which can process wait for lock creation or resource unlock.
|
private UESLockManager |
lockMng
Instance of lock manager.
|
private UESURI |
lockUri
Lock URI.
|
private static long |
MAXIMUM_WAIT_TIMEOUT
Maximum timeout for which can process wait for lock creation or resource unlock.
|
Modifier | Constructor and Description |
---|---|
private |
UESLock(UESLockAttributes lock)
Creates new instance of
UESLock . |
Modifier and Type | Method and Description |
---|---|
static UESLock |
create(UESURI resourceUri,
Creates new lock.
|
private static java.lang.String |
getOwnerId()
Returns owner ID (in case owner ID does not exists yet new one
is generated and stored as retained parameter on PCB).
|
UESURI |
getUri()
Returns UESURI of this lock.
|
boolean |
isValid()
Checks if lock is valid (e.g. is not expired or was not removed by other process).
|
void |
reallocate(java.lang.Long lockTimeout)
Reallocates lock and thus allows prolonging (or shortening)
its expiration time.
|
void |
unlock()
Unlocks lock.
|
UESLock
.lock
- Attributes of created lockresourceUri
- UESURI of resource to be lockedlock
- Additional lock attributeslockTimeout
- New value of lock timeout in seconds (may be
null or -1 to maintain lock timeout initially
set on lock create)