public class DynamoDBLockProvider extends Object implements LockProvider
aws-java-sdk-dynamodb.
It uses a table with the following structure:
{
"_id" : "lock name",
"lockUntil" : ISODate("2017-01-07T16:52:04.071Z"),
"lockedAt" : ISODate("2017-01-07T16:52:03.932Z"),
"lockedBy" : "host name"
}
lockedAt and lockedBy are just for troubleshooting
and are not read by the code.
filter _id == :name AND lock_until <= :now.
lock_until is set to now or lockAtLeastUntil whichever is later.
| Constructor and Description |
|---|
DynamoDBLockProvider(@NotNull com.amazonaws.services.dynamodbv2.document.Table table)
Uses DynamoDB to coordinate locks
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull Optional<SimpleLock> |
lock(@NotNull LockConfiguration lockConfiguration) |
public DynamoDBLockProvider(@NotNull
@NotNull com.amazonaws.services.dynamodbv2.document.Table table)
table - existing DynamoDB table to be used@NotNull public @NotNull Optional<SimpleLock> lock(@NotNull @NotNull LockConfiguration lockConfiguration)
lock in interface LockProviderCopyright © 2020. All rights reserved.