Class DynamoDbLockRegistry

java.lang.Object
org.springframework.integration.aws.lock.DynamoDbLockRegistry
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.integration.support.locks.ExpirableLockRegistry, org.springframework.integration.support.locks.LockRegistry

public class DynamoDbLockRegistry extends Object implements org.springframework.integration.support.locks.ExpirableLockRegistry, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
An ExpirableLockRegistry implementation for the AWS DynamoDB. The algorithm is based on the AmazonDynamoDBLockClient.

Can create table in DynamoDB if an external AmazonDynamoDBLockClient is not provided.

Since:
2.0
Author:
Artem Bilan, Karl Lessard, Asiel Caballero
  • Field Details

    • DEFAULT_TABLE_NAME

      public static final String DEFAULT_TABLE_NAME
      The "SpringIntegrationLockRegistry" default name for the locks table in the DynamoDB.
      See Also:
    • DEFAULT_PARTITION_KEY_NAME

      public static final String DEFAULT_PARTITION_KEY_NAME
      The "lockKey" default name for the partition key in the table.
      See Also:
    • DEFAULT_SORT_KEY_NAME

      public static final String DEFAULT_SORT_KEY_NAME
      The "sortKey" default name for the sort key in the table.
      See Also:
    • DEFAULT_SORT_KEY

      public static final String DEFAULT_SORT_KEY
      The "SpringIntegrationLocks" default value for the sort key in the table.
      See Also:
    • DEFAULT_REFRESH_PERIOD_MS

      public static final long DEFAULT_REFRESH_PERIOD_MS
      The 1000L default period in milliseconds between DB polling requests.
      See Also:
  • Constructor Details

  • Method Details

    • setBillingMode

      public void setBillingMode(BillingMode billingMode)
    • setReadCapacity

      public void setReadCapacity(long readCapacity)
    • setWriteCapacity

      public void setWriteCapacity(long writeCapacity)
    • setPartitionKey

      public void setPartitionKey(String partitionKey)
    • setSortKeyName

      public void setSortKeyName(String sortKeyName)
      Specify a name of the table attribute which is used as a sort key.
      Parameters:
      sortKeyName - the sort key attribute name to use.
    • setSortKey

      public void setSortKey(String sortKey)
      Specify a value for the sort key attribute of the lock item.
      Parameters:
      sortKey - the sort key value to use.
    • setLeaseDuration

      public void setLeaseDuration(long leaseDuration)
    • setHeartbeatPeriod

      public void setHeartbeatPeriod(long heartbeatPeriod)
    • setRefreshPeriod

      public void setRefreshPeriod(long refreshPeriod)
    • setExecutor

      @Deprecated public void setExecutor(Executor executor)
      Deprecated.
      with no-op in favor of internally created unmanaged threads.
      Set the Executor, where is not provided then a default of cached thread pool Executor will be used.
      Parameters:
      executor - the executor service
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
    • obtain

      public Lock obtain(Object lockKey)
      Specified by:
      obtain in interface org.springframework.integration.support.locks.LockRegistry
    • expireUnusedOlderThan

      public void expireUnusedOlderThan(long age)
      Specified by:
      expireUnusedOlderThan in interface org.springframework.integration.support.locks.ExpirableLockRegistry
    • toString

      public String toString()
      Overrides:
      toString in class Object