Class RedisLockRegistry

java.lang.Object
org.springframework.integration.redis.util.RedisLockRegistry
All Implemented Interfaces:
DisposableBean, ExpirableLockRegistry, LockRegistry

public final class RedisLockRegistry
extends Object
implements ExpirableLockRegistry, DisposableBean
Implementation of ExpirableLockRegistry providing a distributed lock using Redis. Locks are stored under the key registryKey:lockKey. Locks expire after (default 60) seconds. Threads unlocking an expired lock will get an IllegalStateException. This should be considered as a critical error because it is possible the protected resources were compromised.

Locks are reentrant.

However, locks are scoped by the registry; a lock from a different registry with the same key (even if the registry uses the same 'registryKey') are different locks, and the second cannot be acquired by the same thread while the first is locked.

Note: This is not intended for low latency applications. It is intended for resource locking across multiple JVMs.

Conditions are not supported.

Since:
4.0
Author:
Gary Russell, Konstantin Yakimov, Artem Bilan, Vedran Pavic, Unseok Kim, Anton Gabov