Class DynamoDbLockManager

    • 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
    • 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 client
        lockTableName - 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 interface LockManager
        Overrides:
        initialize in class LockManagers.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 lock
        ownerId - 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 lock

        exception must not be thrown for this method.

        Parameters:
        entityId - ID of the entity to lock
        ownerId - ID of the owner if the lock
        Returns:
        if the owner held the lock and successfully released it.
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class LockManagers.BaseLockManager
        Throws:
        java.lang.Exception
      • 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