public class DynamoDbLockManager extends LockManagers.BaseLockManager
Constructor and Description |
---|
DynamoDbLockManager()
constructor for dynamic initialization,
initialize(Map) must be called later. |
DynamoDbLockManager(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamo,
java.lang.String lockTableName)
constructor used for testing purpose
|
Modifier and Type | Method and Description |
---|---|
boolean |
acquire(java.lang.String entityId,
java.lang.String ownerId)
Try to acquire a lock
|
void |
close() |
void |
initialize(java.util.Map<java.lang.String,java.lang.String> properties)
Initialize lock manager from catalog properties.
|
static java.util.List<software.amazon.awssdk.services.dynamodb.model.AttributeDefinition> |
lockTableColDefinitions()
The lock table column definition, for users who whould like to create the table separately
|
static java.util.List<software.amazon.awssdk.services.dynamodb.model.KeySchemaElement> |
lockTableSchema()
The lock table schema, for users who would like to create the table separately
|
boolean |
release(java.lang.String entityId,
java.lang.String ownerId)
Release a lock
|
acquireIntervalMs, acquireTimeoutMs, heartbeatIntervalMs, heartbeatThreads, heartbeatTimeoutMs, scheduler
public DynamoDbLockManager()
initialize(Map)
must be called later.public DynamoDbLockManager(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamo, java.lang.String lockTableName)
dynamo
- dynamo clientlockTableName
- lock table namepublic void initialize(java.util.Map<java.lang.String,java.lang.String> properties)
LockManager
initialize
in interface LockManager
initialize
in class LockManagers.BaseLockManager
properties
- catalog propertiespublic boolean acquire(java.lang.String entityId, java.lang.String ownerId)
LockManager
entityId
- ID of the entity to lockownerId
- ID of the owner if the lockpublic boolean release(java.lang.String entityId, java.lang.String ownerId)
LockManager
exception must not be thrown for this method.
entityId
- ID of the entity to lockownerId
- ID of the owner if the lockpublic void close()
close
in interface java.lang.AutoCloseable
close
in class LockManagers.BaseLockManager
public static java.util.List<software.amazon.awssdk.services.dynamodb.model.KeySchemaElement> lockTableSchema()
public static java.util.List<software.amazon.awssdk.services.dynamodb.model.AttributeDefinition> lockTableColDefinitions()