クラス ZookeeperLockRegistry
java.lang.ObjectSE
org.springframework.integration.zookeeper.lock.ZookeeperLockRegistry
- 実装されたすべてのインターフェース:
DisposableBean
、ExpirableLockRegistry
、LockRegistry
public class ZookeeperLockRegistry
extends ObjectSE
implements ExpirableLockRegistry, DisposableBean
Zookeeper、より具体的には Curator
InterProcessMutex
を使用した ExpirableLockRegistry
実装。- 導入:
- 4.2
- 作成者:
- Gary Russell, Artem Bilan, Vedran Pavic, Unseok Kim, Christian Tzolov
ネストされたクラスのサマリー
ネストされたクラスコンストラクターのサマリー
コンストラクターコンストラクター説明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) 現在ロックされていない「年齢」より前に最後に取得されたロックを削除します。パラメーターオブジェクトに関連付けられたロックを取得します。void
setCacheCapacity
(int cacheCapacity) キャッシュされたロックの容量を設定します。void
setMutexTaskExecutor
(AsyncTaskExecutor mutexTaskExecutor) Zookeeper との接続を確立 (およびテスト) するときに使用するAsyncTaskExecutor
を設定します。クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSE
インターフェース org.springframework.integration.support.locks.LockRegistry から継承されたメソッド
executeLocked, executeLocked, executeLocked, executeLocked
コンストラクターの詳細
ZookeeperLockRegistry
public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client) '/SpringIntegration-LockRegistry/' にキーを追加するだけのデフォルトのZookeeperLockRegistry.KeyToPathStrategy
を使用してロックレジストリを構築します。- パラメーター:
client
-CuratorFramework
ZookeeperLockRegistry
キーを'<root>/'
に単純に追加するデフォルトのZookeeperLockRegistry.KeyToPathStrategy
を使用して、ロックレジストリを構築します。- パラメーター:
client
-CuratorFramework
root
- パスルート(末尾の / なし)。
ZookeeperLockRegistry
public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client, ZookeeperLockRegistry.KeyToPathStrategy keyToPath) 提供されたZookeeperLockRegistry.KeyToPathStrategy
を使用してロックレジストリを構築します。- パラメーター:
client
-CuratorFramework
keyToPath
-ZookeeperLockRegistry.KeyToPathStrategy
の実装。
メソッドの詳細
setMutexTaskExecutor
Zookeeper との接続を確立 (およびテスト) するときに使用するAsyncTaskExecutor
を設定します。Lock.tryLock(long, TimeUnit)
SE 契約が尊重されるように、これは非同期で実行する必要があります。エグゼキュータは内部で使用されますが、一部の環境 (たとえば、WorkManagerTaskExecutor
の使用が必要な環境) では外部エグゼキュータが必要になる場合があります。- パラメーター:
mutexTaskExecutor
- 執行者。- 導入:
- 4.2.10
setCacheCapacity
public void setCacheCapacity(int cacheCapacity) キャッシュされたロックの容量を設定します。- パラメーター:
cacheCapacity
- キャッシュされたロックの容量(デフォルトは 30_000)。- 導入:
- 5.5.6
obtain
インターフェースからコピーされた説明:LockRegistry
パラメーターオブジェクトに関連付けられたロックを取得します。- 次で指定:
- インターフェース
LockRegistry
のobtain
- パラメーター:
lockKey
- ロックが関連付けられているオブジェクト。- 戻り値:
- 関連するロック。
expireUnusedOlderThan
public void expireUnusedOlderThan(long age) 現在ロックされていない「年齢」より前に最後に取得されたロックを削除します。ZookeeperLockRegistry.KeyToPathStrategy
が有界の場合、有効期限はサポートされません(有限数のパスを返します)。このようなZookeeperLockRegistry.KeyToPathStrategy
を使用すると、ロックが取得されたときの追跡のオーバーヘッドが回避されます。- 次で指定:
- インターフェース
ExpirableLockRegistry
のexpireUnusedOlderThan
- パラメーター:
age
- ロックが最後に取得されてからの時間。
destroy
public void destroy()- 次で指定:
- インターフェース
DisposableBean
のdestroy