public class LegacyTableCoordinatorStateDAODelegate extends CoordinatorStateDAODelegate
On initialize(), checks if the legacy table exists. If it does not exist,
the delegate is marked as not enabled and all read operations become no-ops
(returning null or empty collections). Write operations on a non-enabled delegate
will throw InvalidStateException.
The legacy table should only be deleted after the table migration status moves to
COMPLETE, at which point no read/write calls should be routed to this delegate.
However, if the table existed at initialization but was deleted later (e.g., by the
migration tool after COMPLETE), the underlying DDB calls will throw
ResourceNotFoundException which surfaces as a DependencyException
to the caller.
| Modifier and Type | Field and Description |
|---|---|
static String |
COORDINATOR_STATE_TABLE_HASH_KEY_ATTRIBUTE_NAME
Key value for the item in the CoordinatorState table
|
| Constructor and Description |
|---|
LegacyTableCoordinatorStateDAODelegate(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient,
CoordinatorConfig.CoordinatorStateTableConfig config) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
createCoordinatorStateIfNotExists(CoordinatorState state)
Create a new
CoordinatorState if it does not exist. |
boolean |
deleteCoordinatorState(String key)
Create a new
CoordinatorState if it does not exist. |
CoordinatorState |
getCoordinatorState(String key) |
void |
initialize()
Check if the legacy table exists.
|
boolean |
isEnabled() |
List<CoordinatorState> |
listCoordinatorState()
List all the
CoordinatorState from the DDB table synchronously |
List<CoordinatorState> |
listCoordinatorStateByEntityType(EntityType.CoordinatorStateType entityType)
List all the
CoordinatorState from the DDB table synchronously |
boolean |
updateCoordinatorStateWithExpectation(CoordinatorState state,
Map<String,software.amazon.awssdk.services.dynamodb.model.ExpectedAttributeValue> expectations)
Update fields of the given coordinator state in DynamoDB.
|
createTransactDelete, createTransactPut, fromDynamoRecord, getDDBLockClientOptionsBuilder, getPartitionKeyAttributeName, getTableName, toTransactRecordpublic static final String COORDINATOR_STATE_TABLE_HASH_KEY_ATTRIBUTE_NAME
public LegacyTableCoordinatorStateDAODelegate(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient,
CoordinatorConfig.CoordinatorStateTableConfig config)
public void initialize()
throws DependencyException
initialize in class CoordinatorStateDAODelegateDependencyException - if unable to determine table existence due to unexpected errorspublic boolean isEnabled()
public CoordinatorState getCoordinatorState(String key) throws DependencyException, InvalidStateException, ProvisionedThroughputException
getCoordinatorState in class CoordinatorStateDAODelegatekey - Get the CoordinatorState for this keyDependencyException - if DynamoDB get fails in an unexpected wayInvalidStateException - if ddb table does not existProvisionedThroughputException - if DynamoDB get fails due to lack of capacitypublic List<CoordinatorState> listCoordinatorState() throws ProvisionedThroughputException, DependencyException, InvalidStateException
CoordinatorStateDAODelegateCoordinatorState from the DDB table synchronouslylistCoordinatorState in class CoordinatorStateDAODelegateProvisionedThroughputException - if DynamoDB scan fails due to lack of capacityDependencyException - if DynamoDB scan fails in an unexpected wayInvalidStateException - if ddb table does not existpublic List<CoordinatorState> listCoordinatorStateByEntityType(EntityType.CoordinatorStateType entityType) throws ProvisionedThroughputException, DependencyException, InvalidStateException
CoordinatorStateDAODelegateCoordinatorState from the DDB table synchronouslylistCoordinatorStateByEntityType in class CoordinatorStateDAODelegateProvisionedThroughputException - if DynamoDB scan fails due to lack of capacityDependencyException - if DynamoDB scan fails in an unexpected wayInvalidStateException - if ddb table does not existpublic boolean createCoordinatorStateIfNotExists(CoordinatorState state) throws DependencyException, InvalidStateException, ProvisionedThroughputException
CoordinatorStateDAODelegateCoordinatorState if it does not exist.createCoordinatorStateIfNotExists in class CoordinatorStateDAODelegatestate - the state to createDependencyException - if DynamoDB put fails in an unexpected wayInvalidStateException - if lease table does not existProvisionedThroughputException - if DynamoDB put fails due to lack of capacitypublic boolean updateCoordinatorStateWithExpectation(CoordinatorState state, Map<String,software.amazon.awssdk.services.dynamodb.model.ExpectedAttributeValue> expectations) throws DependencyException, InvalidStateException, ProvisionedThroughputException
CoordinatorStateDAODelegateupdateCoordinatorStateWithExpectation in class CoordinatorStateDAODelegateDependencyException - if DynamoDB update fails in an unexpected wayInvalidStateException - if table does not existProvisionedThroughputException - if DynamoDB update fails due to lack of capacitypublic boolean deleteCoordinatorState(String key) throws ProvisionedThroughputException, InvalidStateException, DependencyException
CoordinatorStateDAODelegateCoordinatorState if it does not exist.deleteCoordinatorState in class CoordinatorStateDAODelegatekey - the key to deleteProvisionedThroughputException - if DynamoDB delete fails due to lack of capacityInvalidStateException - if lease table does not existDependencyException - if DynamoDB delete fails in an unexpected wayCopyright © 2026. All rights reserved.