Skip to content

Commit 099d1af

Browse files
authored
Update map lock docs (#1572)
1 parent c199191 commit 099d1af

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/proxy/IMap.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ export interface IMap<K, V> extends DistributedObject {
343343
* Releases the lock for the specified key regardless of the owner.
344344
* This operation always unlocks the key.
345345
*
346+
* **Warning:** This method should be used with caution.
347+
* It releases the lock even if it was acquired by another client.
348+
* That can lead to data inconsistencies if not used properly.
349+
*
346350
* @param key the key of the map entry
347351
* @throws AssertionError if `key` is `null`
348352
*/
@@ -351,6 +355,8 @@ export interface IMap<K, V> extends DistributedObject {
351355
/**
352356
* Checks whether given key is locked.
353357
*
358+
* This method returns `true` if the key is locked by any client.
359+
*
354360
* @param key the key of the map entry
355361
* @throws AssertionError if `key` is `null`
356362
* @returns `true` if key is locked, `false` otherwise
@@ -373,6 +379,10 @@ export interface IMap<K, V> extends DistributedObject {
373379
* method must be called the same amount of times, otherwise the lock will
374380
* remain unavailable.
375381
*
382+
* **Important:**
383+
* In the Node.js client, all lock operations from the same client instance share the same lock ownership.
384+
* This differs from the Java client where each thread has separate lock ownership.
385+
*
376386
* @param key the key of the map entry
377387
* @param leaseTime lock is automatically unlocked after `leaseTime`
378388
* milliseconds; defaults to infinity
@@ -542,6 +552,9 @@ export interface IMap<K, V> extends DistributedObject {
542552
* `unlock()` method must be called the same amount of times, otherwise the
543553
* lock will remain unavailable.
544554
*
555+
* **Important:**
556+
* In the Node.js client, all lock operations from the same client instance share the same lock ownership.
557+
*
545558
* @param key the key of the map entry
546559
* @param timeout server waits for `timeout` milliseconds to acquire
547560
* the lock before giving up; defaults to `0`

0 commit comments

Comments
 (0)