Acquires a specific lock to execute a process.
| Arguments: |
|
|---|---|
| Return-type : | java.lang.Boolean |
| Returns: | Returns Boolean true if the lock is acquired or False if the parameter exceptionHandling is passed as “BOOLEAN”, throws exception if exceptionHandling is “EXCEPTION”. |
Example:
=LOCK_ACQUIRE("SMOOTHIE", "EXCLUSIVE", "EXCEPTION", "0:0:2")
In the above example, the process will wait for 2 seconds to acquire the exclusive lock “SMOOTHIE” and an exception is thrown if it fails to acquire the lock in specified time.
Waits if a lock is busy, but does not permanently acquire the lock.
Internally afunction will wait and tries to acquire the lock. On failure based on exceptionHandling parameter returns false or throws exception. On success release the lock immediately so that the lock is set free for any other process to acquire.
Thus both LOCK_ACQUIRE and LOCK_WAIT are implemented almost the same way except that LOCK_WAIT immediately releases the acquired lock.
| Arguments: |
|
|---|---|
| Return-type : | java.lang.Boolean |
| Returns: | Returns Boolean true if the lock gets acquired within the specified time or False if the parameter exceptionHandling is passed as “BOOLEAN”, throws exception if exceptionHandling is “EXCEPTION”. |
Example:
=LOCK_WAIT("SMOOTHIE", "EXCLUSIVE", "EXCEPTION", "0:2:0")
In the above example, the process will wait for the exclusive lock “SMOOTHIE” for maximum 2 minutes. On failure an exception is thrown if the wait exceeds beyond the permissible time. On success release the lock immediately so that the lock is set free for any other process to acquire.
Release a specific lock to for the other processes to acquire the lock and execute.
| Arguments: |
|
|---|---|
| Return-type : | java.lang.Boolean |
| Returns: |
Example:
=LOCK_RELEASE("SMOOTHIE")
In the above example, the lock “SMOOTHIE” is released.