public interface LeaseRefresher
Modifier and Type | Method and Description |
---|---|
boolean |
createLeaseIfNotExists(Lease lease)
Create a new lease.
|
boolean |
createLeaseTableIfNotExists(Long readCapacity,
Long writeCapacity)
Creates the table that will store leases.
|
void |
deleteAll()
Delete all leases from DynamoDB.
|
void |
deleteLease(Lease lease)
Delete the given lease from DynamoDB.
|
boolean |
evictLease(Lease lease)
Evict the current owner of lease by setting owner to null.
|
ExtendedSequenceNumber |
getCheckpoint(String shardId)
Gets the current checkpoint of the shard.
|
Lease |
getLease(String shardId) |
boolean |
isLeaseTableEmpty()
Check (synchronously) if there are any leases in the lease table.
|
boolean |
leaseTableExists() |
List<Lease> |
listLeases()
List all objects in table synchronously.
|
boolean |
renewLease(Lease lease)
Renew a lease by incrementing the lease counter.
|
boolean |
takeLease(Lease lease,
String owner)
Take a lease for the given owner by incrementing its leaseCounter and setting its owner field.
|
boolean |
updateLease(Lease lease)
Update application-specific fields of the given lease in DynamoDB.
|
boolean |
waitUntilLeaseTableExists(long secondsBetweenPolls,
long timeoutSeconds)
Blocks until the lease table exists by polling leaseTableExists.
|
boolean createLeaseTableIfNotExists(Long readCapacity, Long writeCapacity) throws ProvisionedThroughputException, DependencyException
readCapacity
- writeCapacity
- ProvisionedThroughputException
- if we cannot create the lease table due to per-AWS-account capacity
restrictions.DependencyException
- if DynamoDB createTable fails in an unexpected wayboolean leaseTableExists() throws DependencyException
DependencyException
- if DynamoDB describeTable fails in an unexpected wayboolean waitUntilLeaseTableExists(long secondsBetweenPolls, long timeoutSeconds) throws DependencyException
secondsBetweenPolls
- time to wait between polls in secondstimeoutSeconds
- total time to wait in secondsDependencyException
- if DynamoDB describeTable fails in an unexpected wayList<Lease> listLeases() throws DependencyException, InvalidStateException, ProvisionedThroughputException
DependencyException
- if DynamoDB scan fails in an unexpected wayInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB scan fails due to lack of capacityboolean createLeaseIfNotExists(Lease lease) throws DependencyException, InvalidStateException, ProvisionedThroughputException
lease
- the lease to createDependencyException
- if DynamoDB put fails in an unexpected wayInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB put fails due to lack of capacityLease getLease(String shardId) throws DependencyException, InvalidStateException, ProvisionedThroughputException
shardId
- Get the lease for this shardIdInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB get fails due to lack of capacityDependencyException
- if DynamoDB get fails in an unexpected wayboolean renewLease(Lease lease) throws DependencyException, InvalidStateException, ProvisionedThroughputException
lease
- the lease to renewInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB update fails due to lack of capacityDependencyException
- if DynamoDB update fails in an unexpected wayboolean takeLease(Lease lease, String owner) throws DependencyException, InvalidStateException, ProvisionedThroughputException
lease
- the lease to takeowner
- the new ownerInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB update fails due to lack of capacityDependencyException
- if DynamoDB update fails in an unexpected wayboolean evictLease(Lease lease) throws DependencyException, InvalidStateException, ProvisionedThroughputException
lease
- the lease to voidInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB update fails due to lack of capacityDependencyException
- if DynamoDB update fails in an unexpected wayvoid deleteLease(Lease lease) throws DependencyException, InvalidStateException, ProvisionedThroughputException
lease
- the lease to deleteInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB delete fails due to lack of capacityDependencyException
- if DynamoDB delete fails in an unexpected wayvoid deleteAll() throws DependencyException, InvalidStateException, ProvisionedThroughputException
InvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB scan or delete fail due to lack of capacityDependencyException
- if DynamoDB scan or delete fail in an unexpected wayboolean updateLease(Lease lease) throws DependencyException, InvalidStateException, ProvisionedThroughputException
InvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB update fails due to lack of capacityDependencyException
- if DynamoDB update fails in an unexpected wayboolean isLeaseTableEmpty() throws DependencyException, InvalidStateException, ProvisionedThroughputException
DependencyException
- if DynamoDB scan fails in an unexpected wayInvalidStateException
- if lease table does not existProvisionedThroughputException
- if DynamoDB scan fails due to lack of capacityExtendedSequenceNumber getCheckpoint(String shardId) throws ProvisionedThroughputException, InvalidStateException, DependencyException
shardId
- Checkpoint of this shard will be returnedProvisionedThroughputException
- if DynamoDB update fails due to lack of capacityInvalidStateException
- if lease table does not existDependencyException
- if DynamoDB update fails in an unexpected wayCopyright © 2019. All rights reserved.