lock
Locks an entry and/or data store on behalf of the thread invoking this service.
Important:
When you lock an entry or data store using this service, you must release the lock by using a put or an explicit unlock. If you do not release the lock, Integration Cloud will release the lock at the end of the Integration execution.
Important:
Be careful when releasing locks with the unlock service. If you release a lock on a data store, another thread can obtain a lock on the data store and delete it, and the entries it contains, even if your thread still has locks on one or more of the entries.
Input Parameters
storeName | String Name of the data store containing the entry. |
key | String Optional. Key of the entry that you want to lock. If key is not supplied and you request: A shared lock, the service obtains a shared lock on the data store, allowing other threads to read and modify entries, but not to delete them. An exclusive lock, the service obtains an exclusive lock on the data store, preventing other threads from locking the data store and the entries, thereby preventing those threads from reading, modifying, or deleting the entries or the data store. If both storeName and key are specified and you request: A shared lock, the service obtains a shared lock on the data store and the entry. An exclusive lock, the service obtains a shared lock on the data store and an exclusive lock on the entry. |
waitLength | String Optional. Length of time, in milliseconds, that you want to wait for this entry to become available if it is already locked by another thread. |
lockMode | String Optional. Type of lock you want to place on the entry or data store. Set to: Exclusive to prevent other threads from obtaining a lock on the data store or entry. An exclusive lock on an entry allows you to modify the entry, and prevents other threads from reading or modifying the entry. An exclusive lock on a data store also locks the entries in the data store. In addition, an exclusive lock on a data store allows you to delete the data store. Read is obsolete. If this value is specified, the service obtains a shared lock. Share to prevent other threads from obtaining an exclusive lock on an entry or a data store. A shared lock on an entry allows you to read, but not modify, the entry. A shared lock on a data store prevents another thread from deleting the data store. This is the default. |
Output Parameters
None.
Usage Notes
If you have not specified a key, and your Integration does not invoke put or unlock, or your Integration throws an exception before invoking put or unlock, the entire data store remains locked.
If the key does not exist in the data store at the time your Integration executes, the lock service inserts the key with an empty value and takes the lock on the entry.
If you request an exclusive lock on an entry, the service obtains an exclusive lock on the entry and a shared lock on the data store. If this service finds a shared lock from the same thread on the entry, the service will automatically promote the shared lock on the entry to an exclusive lock.
If you request a shared lock on an entry, the service obtains a shared lock on the entry and a shared lock on the data store.
If you request a shared lock on an entry or a data store and this service finds an exclusive lock from the same thread, the existing exclusive lock will be reused. The exclusive lock will not be demoted to a shared lock.
If you request an exclusive lock on a data store, and this service finds a shared lock from the same thread on the data store, the service will automatically promote the shared lock on the data store to an exclusive lock.