GH-3672: Clean up Jdbc & ZK LockRegistry caches

Fixes https://github.com/spring-projects/spring-integration/issues/3672

* Clean up `JdbcLockRegistry`, `ZookeeperLockRegistry` cache automatically 
* setCapacity(int capacity) to cacheCapacity(int capacity)
* field rename `capacity`to `cacheCapacity`, add static
This commit is contained in:
Unseok Kim
2021-11-12 06:36:27 +09:00
committed by GitHub
parent 5452a6fbe6
commit db611028da
9 changed files with 447 additions and 42 deletions

View File

@@ -1091,6 +1091,9 @@ So the time to live can be highly reduce and deployments can retake a lost lock
NOTE: The lock renewal can be done only if the lock is held by the current thread.
String with version 5.5.6, the `JdbcLockRegistry` is support automatically clean up cache for JdbcLock in `JdbcLockRegistry.locks` via `JdbcLockRegistry.setCacheCapacity()`.
See its JavaDocs for more information.
[[jdbc-metadata-store]]
=== JDBC Metadata Store

View File

@@ -884,5 +884,5 @@ You should set the expiry at a large enough value to prevent this condition, but
Starting with version 5.0, the `RedisLockRegistry` implements `ExpirableLockRegistry`, which removes locks last acquired more than `age` ago and that are not currently locked.
String with version 5.5.6, the `RedisLockRegistry` is support automatically clean up cache for redisLocks in `RedisLockRegistry.locks` via `RedisLockRegistry.setCapacity()`.
String with version 5.5.6, the `RedisLockRegistry` is support automatically clean up cache for redisLocks in `RedisLockRegistry.locks` via `RedisLockRegistry.setCacheCapacity()`.
See its JavaDocs for more information.

View File

@@ -84,6 +84,9 @@ public interface KeyToPathStrategy {
If the strategy returns `true` from `isBounded`, unused locks do not need to be harvested.
For unbounded strategies (such as the default), you need to periodically invoke `expireUnusedOlderThan(long age)` to remove old unused locks from memory.
String with version 5.5.6, the `ZookeeperLockRegistry` is support automatically clean up cache for ZkLock in `ZookeeperLockRegistry.locks` via `ZookeeperLockRegistry.setCacheCapacity()`.
See its JavaDocs for more information.
[[zk-leadership]]
=== Zookeeper Leadership Event Handling