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
    • 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 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 exception must not be thrown for this method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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()
      • 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