public class ZookeeperLockRegistry extends ObjectSE implements ExpirableLockRegistry, DisposableBean
InterProcessMutex
を使用した ExpirableLockRegistry
実装。修飾子と型 | クラスと説明 |
---|---|
static interface | ZookeeperLockRegistry.KeyToPathStrategy ロックキーを変換する戦略(例: |
コンストラクターと説明 |
---|
ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client) '/SpringIntegration-LockRegistry/' にキーを追加するだけのデフォルトの ZookeeperLockRegistry.KeyToPathStrategy を使用してロックレジストリを構築します。 |
ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client, StringSE root) キーを '<root>/' に単純に追加するデフォルトの ZookeeperLockRegistry.KeyToPathStrategy を使用して、ロックレジストリを構築します。 |
ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client, ZookeeperLockRegistry.KeyToPathStrategy keyToPath) 提供された ZookeeperLockRegistry.KeyToPathStrategy を使用してロックレジストリを構築します。 |
修飾子と型 | メソッドと説明 |
---|---|
void | destroy() |
void | expireUnusedOlderThan(long age) 現在ロックされていない「年齢」より前に最後に取得されたロックを削除します。 |
LockSE | obtain(ObjectSE lockKey) パラメーターオブジェクトに関連付けられたロックを取得します。 |
void | setMutexTaskExecutor(AsyncTaskExecutor mutexTaskExecutor) Zookeeper との接続を確立 (およびテスト) するときに使用する AsyncTaskExecutor を設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client)
ZookeeperLockRegistry.KeyToPathStrategy
を使用してロックレジストリを構築します。client
- CuratorFramework
public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client, StringSE root)
'<root>/'
に単純に追加するデフォルトの ZookeeperLockRegistry.KeyToPathStrategy
を使用して、ロックレジストリを構築します。client
- CuratorFramework
root
- パスルート(末尾の / なし)。public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client, ZookeeperLockRegistry.KeyToPathStrategy keyToPath)
ZookeeperLockRegistry.KeyToPathStrategy
を使用してロックレジストリを構築します。client
- CuratorFramework
keyToPath
- ZookeeperLockRegistry.KeyToPathStrategy
の実装。public void setMutexTaskExecutor(AsyncTaskExecutor mutexTaskExecutor)
AsyncTaskExecutor
を設定します。Lock.tryLock(long, TimeUnit)
SE 契約が尊重されるように、これは非同期で実行する必要があります。エグゼキュータは内部で使用されますが、一部の環境 (たとえば、WorkManagerTaskExecutor
の使用が必要な環境) では外部エグゼキュータが必要になる場合があります。mutexTaskExecutor
- 執行者。public LockSE obtain(ObjectSE lockKey)
LockRegistry
LockRegistry
の obtain
lockKey
- ロックが関連付けられているオブジェクト。public void expireUnusedOlderThan(long age)
ZookeeperLockRegistry.KeyToPathStrategy
が有界の場合、有効期限はサポートされません(有限数のパスを返します)。このような ZookeeperLockRegistry.KeyToPathStrategy
を使用すると、ロックが取得されたときの追跡のオーバーヘッドが回避されます。ExpirableLockRegistry
の expireUnusedOlderThan
age
- ロックが最後に取得されてからの時間。public void destroy()
DisposableBean
の destroy