クラス ZookeeperLockRegistry

java.lang.ObjectSE
org.springframework.integration.zookeeper.lock.ZookeeperLockRegistry
実装されたすべてのインターフェース:
DisposableBeanExpirableLockRegistryLockRegistry

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

      public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client)
      '/SpringIntegration-LockRegistry/' にキーを追加するだけのデフォルトの ZookeeperLockRegistry.KeyToPathStrategy を使用してロックレジストリを構築します。
      パラメーター:
      client - CuratorFramework
    • ZookeeperLockRegistry

      public ZookeeperLockRegistry(org.apache.curator.framework.CuratorFramework client, StringSE root)
      キーを '<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

      public void setMutexTaskExecutor(AsyncTaskExecutor mutexTaskExecutor)
      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

      public LockSE obtain(ObjectSE lockKey)
      インターフェースからコピーされた説明: LockRegistry
      パラメーターオブジェクトに関連付けられたロックを取得します。
      次で指定:
      インターフェース LockRegistryobtain 
      パラメーター:
      lockKey - ロックが関連付けられているオブジェクト。
      戻り値:
      関連するロック。
    • expireUnusedOlderThan

      public void expireUnusedOlderThan(long age)
      現在ロックされていない「年齢」より前に最後に取得されたロックを削除します。ZookeeperLockRegistry.KeyToPathStrategy が有界の場合、有効期限はサポートされません(有限数のパスを返します)。このような ZookeeperLockRegistry.KeyToPathStrategy を使用すると、ロックが取得されたときの追跡のオーバーヘッドが回避されます。
      次で指定:
      インターフェース ExpirableLockRegistryexpireUnusedOlderThan 
      パラメーター:
      age - ロックが最後に取得されてからの時間。
    • destroy

      public void destroy()
      次で指定:
      インターフェース DisposableBeandestroy