Using the Locking System
Here we will have a look at the Locking System. We will learn how to lock and unlock objects using locks. Locks are used to make sure objects are only used by one owner.
Getting ready
The Locking System doesn't need anything, as it itself is just virtual.
How to do it...
There are three phases to locking: locking, checking and unlocking.
Create a lock
We will now create a lock:
Create a new workflow and add a scriptable task.
Add the following variables as input:
Name
Type
Section
Use
object
String
IN
Any string
owner
String
IN
Any string
Enter the following script:
LockingSystem.lockAndWait(object ,owner);
Add the workflow Display all Locks at the end.
Save and run the workflow. Enter as object any string, such as
Test
and as owner or any other string such asGoofy
.Check the logs.
Check for lock
We will now check if an object is locked:
Create a new workflow and add a scriptable task.
Add the following variables as input:
Name
Type
Section...