Package org.apache.iceberg.aws.dynamodb
Class DynamoDbLockManager
- java.lang.Object
-
- org.apache.iceberg.util.LockManagers.BaseLockManager
-
- org.apache.iceberg.aws.dynamodb.DynamoDbLockManager
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,LockManager
public class DynamoDbLockManager extends LockManagers.BaseLockManager
DynamoDB implementation for the lock manager.
-
-
Constructor Summary
Constructors Constructor 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
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acquire(java.lang.String entityId, java.lang.String ownerId)
Try to acquire a lockvoid
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 separatelystatic java.util.List<software.amazon.awssdk.services.dynamodb.model.KeySchemaElement>
lockTableSchema()
The lock table schema, for users who would like to create the table separatelyboolean
release(java.lang.String entityId, java.lang.String ownerId)
Release a lock-
Methods inherited from class org.apache.iceberg.util.LockManagers.BaseLockManager
acquireIntervalMs, acquireTimeoutMs, heartbeatIntervalMs, heartbeatThreads, heartbeatTimeoutMs, scheduler
-
-
-
-
Constructor Detail
-
DynamoDbLockManager
public DynamoDbLockManager()
constructor for dynamic initialization,initialize(Map)
must be called later.
-
DynamoDbLockManager
public DynamoDbLockManager(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamo, java.lang.String lockTableName)
constructor used for testing purpose- Parameters:
dynamo
- dynamo clientlockTableName
- lock table name
-
-
Method Detail
-
initialize
public void initialize(java.util.Map<java.lang.String,java.lang.String> properties)
Description copied from interface:LockManager
Initialize lock manager from catalog properties.- Specified by:
initialize
in interfaceLockManager
- Overrides:
initialize
in classLockManagers.BaseLockManager
- Parameters:
properties
- catalog properties
-
acquire
public boolean acquire(java.lang.String entityId, java.lang.String ownerId)
Description copied from interface:LockManager
Try to acquire a lock- Parameters:
entityId
- ID of the entity to lockownerId
- ID of the owner if the lock- Returns:
- if the lock for the entity is acquired by the owner
-
release
public boolean release(java.lang.String entityId, java.lang.String ownerId)
Description copied from interface:LockManager
Release a lockexception must not be thrown for this method.
- Parameters:
entityId
- ID of the entity to lockownerId
- ID of the owner if the lock- Returns:
- if the owner held the lock and successfully released it.
-
close
public void close()
-
lockTableSchema
public 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- Returns:
- lock table schema
-
lockTableColDefinitions
public 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- Returns:
- lock table column definition
-
-