Class RedisDistributedLock
java.lang.Object
com.iantapply.orchestra.adapter.redis.RedisDistributedLock
- All Implemented Interfaces:
DistributedLock
Redis lease provider using atomic NX/PX acquisition and token-checked release.
-
Nested Class Summary
Nested classes/interfaces inherited from interface DistributedLock
DistributedLock.Lease -
Constructor Summary
ConstructorsConstructorDescriptionRedisDistributedLock(URI uri, String namespace) Creates a Redis-backed lease provider. -
Method Summary
Modifier and TypeMethodDescriptiontryAcquire(String key, Duration duration) Attempts to claim a key for a bounded duration without waiting.
-
Constructor Details
-
RedisDistributedLock
-
-
Method Details
-
tryAcquire
Description copied from interface:DistributedLockAttempts to claim a key for a bounded duration without waiting.- Specified by:
tryAcquirein interfaceDistributedLock- Parameters:
key- globally meaningful lock keyduration- lease lifetime- Returns:
- owned lease, or empty when another node owns the key
-