public class DynamoDbLockRegistry
extends java.lang.Object
implements org.springframework.integration.support.locks.ExpirableLockRegistry, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
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.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_PARTITION_KEY_NAME
The "lockKey" default name for the partition key in the
table.
|
static long |
DEFAULT_REFRESH_PERIOD_MS
The 1000L default period in milliseconds between DB
polling requests.
|
static java.lang.String |
DEFAULT_SORT_KEY
The "SpringIntegrationLocks" default value for the sort key in the table.
|
static java.lang.String |
DEFAULT_SORT_KEY_NAME
The "sortKey" default name for the sort key in the table.
|
static java.lang.String |
DEFAULT_TABLE_NAME
The "SpringIntegrationLockRegistry" default name for the locks table in the DynamoDB.
|
| Constructor and Description |
|---|
DynamoDbLockRegistry(AmazonDynamoDB dynamoDB) |
DynamoDbLockRegistry(AmazonDynamoDBLockClient dynamoDBLockClient) |
DynamoDbLockRegistry(AmazonDynamoDB dynamoDB,
java.lang.String tableName) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
void |
expireUnusedOlderThan(long age) |
java.util.concurrent.locks.Lock |
obtain(java.lang.Object lockKey) |
void |
setExecutor(java.util.concurrent.Executor executor)
Set the
Executor, where is not provided then a default of cached thread
pool Executor will be used. |
void |
setHeartbeatPeriod(long heartbeatPeriod) |
void |
setLeaseDuration(long leaseDuration) |
void |
setPartitionKey(java.lang.String partitionKey) |
void |
setReadCapacity(long readCapacity) |
void |
setRefreshPeriod(long refreshPeriod) |
void |
setSortKey(java.lang.String sortKey)
Specify a value for the sort key attribute of the lock item.
|
void |
setSortKeyName(java.lang.String sortKeyName)
Specify a name of the table attribute which is used as a sort key.
|
void |
setWriteCapacity(long writeCapacity) |
java.lang.String |
toString() |
public static final java.lang.String DEFAULT_TABLE_NAME
public static final java.lang.String DEFAULT_PARTITION_KEY_NAME
public static final java.lang.String DEFAULT_SORT_KEY_NAME
public static final java.lang.String DEFAULT_SORT_KEY
public static final long DEFAULT_REFRESH_PERIOD_MS
public DynamoDbLockRegistry(AmazonDynamoDB dynamoDB)
public DynamoDbLockRegistry(AmazonDynamoDB dynamoDB, java.lang.String tableName)
public DynamoDbLockRegistry(AmazonDynamoDBLockClient dynamoDBLockClient)
public void setReadCapacity(long readCapacity)
public void setWriteCapacity(long writeCapacity)
public void setPartitionKey(java.lang.String partitionKey)
public void setSortKeyName(java.lang.String sortKeyName)
sortKeyName - the sort key attribute name to use.public void setSortKey(java.lang.String sortKey)
sortKey - the sort key value to use.public void setLeaseDuration(long leaseDuration)
public void setHeartbeatPeriod(long heartbeatPeriod)
public void setRefreshPeriod(long refreshPeriod)
public void setExecutor(java.util.concurrent.Executor executor)
Executor, where is not provided then a default of cached thread
pool Executor will be used.executor - the executor servicepublic void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic void destroy()
throws java.lang.Exception
destroy in interface org.springframework.beans.factory.DisposableBeanjava.lang.Exceptionpublic java.util.concurrent.locks.Lock obtain(java.lang.Object lockKey)
obtain in interface org.springframework.integration.support.locks.LockRegistrypublic void expireUnusedOlderThan(long age)
expireUnusedOlderThan in interface org.springframework.integration.support.locks.ExpirableLockRegistrypublic java.lang.String toString()
toString in class java.lang.Object