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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe "lockKey" default name for the partition key in the table.static final longThe 1000L default period in milliseconds between DB polling requests.static final StringThe "SpringIntegrationLocks" default value for the sort key in the table.static final StringThe "sortKey" default name for the sort key in the table.static final StringThe "SpringIntegrationLockRegistry" default name for the locks table in the DynamoDB. -
Constructor Summary
ConstructorsConstructorDescriptionDynamoDbLockRegistry(AmazonDynamoDB dynamoDB) DynamoDbLockRegistry(AmazonDynamoDBLockClient dynamoDBLockClient) DynamoDbLockRegistry(AmazonDynamoDB dynamoDB, String tableName) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()voidexpireUnusedOlderThan(long age) voidsetBillingMode(BillingMode billingMode) voidsetExecutor(Executor executor) Deprecated.with no-op in favor of internally created unmanaged threads.voidsetHeartbeatPeriod(long heartbeatPeriod) voidsetLeaseDuration(long leaseDuration) voidsetPartitionKey(String partitionKey) voidsetReadCapacity(long readCapacity) voidsetRefreshPeriod(long refreshPeriod) voidsetSortKey(String sortKey) Specify a value for the sort key attribute of the lock item.voidsetSortKeyName(String sortKeyName) Specify a name of the table attribute which is used as a sort key.voidsetWriteCapacity(long writeCapacity) toString()
-
Field Details
-
DEFAULT_TABLE_NAME
The "SpringIntegrationLockRegistry" default name for the locks table in the DynamoDB.- See Also:
-
DEFAULT_PARTITION_KEY_NAME
The "lockKey" default name for the partition key in the table.- See Also:
-
DEFAULT_SORT_KEY_NAME
The "sortKey" default name for the sort key in the table.- See Also:
-
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_MSThe 1000L default period in milliseconds between DB polling requests.- See Also:
-
-
Constructor Details
-
DynamoDbLockRegistry
-
DynamoDbLockRegistry
-
DynamoDbLockRegistry
-
-
Method Details
-
setBillingMode
-
setReadCapacity
public void setReadCapacity(long readCapacity) -
setWriteCapacity
public void setWriteCapacity(long writeCapacity) -
setPartitionKey
-
setSortKeyName
Specify a name of the table attribute which is used as a sort key.- Parameters:
sortKeyName- the sort key attribute name to use.
-
setSortKey
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.with no-op in favor of internally created unmanaged threads.Set theExecutor, 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:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
obtain
- Specified by:
obtainin interfaceorg.springframework.integration.support.locks.LockRegistry
-
expireUnusedOlderThan
public void expireUnusedOlderThan(long age) - Specified by:
expireUnusedOlderThanin interfaceorg.springframework.integration.support.locks.ExpirableLockRegistry
-
toString
-