public class LegacyTableWorkerMetricStatsDAODelegate extends WorkerMetricStatsDAODelegate<WorkerMetricStats.LegacyWorkerMetricStats>
The legacy table uses wid as its partition key, which is defined in
WorkerMetricStats.LegacyWorkerMetricStats.
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 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.
log, table, tableName| Constructor and Description |
|---|
LegacyTableWorkerMetricStatsDAODelegate(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient,
LeaseManagementConfig.WorkerMetricsTableConfig tableConfig,
Long workerMetricsReporterFrequencyMillis) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
deleteMetrics(WorkerMetricStats workerMetrics)
Delete the worker metric stats entry with a conditional check on lastUpdateTime.
|
List<WorkerMetricStats> |
getAllWorkerMetricStats()
Retrieve all worker metric stats entries from the backing table.
|
void |
initialize()
Initialize the delegate.
|
boolean |
isEnabled() |
protected WorkerMetricStats.LegacyWorkerMetricStats |
toEntity(WorkerMetricStats workerMetrics)
For the legacy table, simply cast to LegacyWorkerMetricStats using the builder.
|
void |
updateMetrics(WorkerMetricStats workerMetrics)
Update (or create) the worker metric stats for a given worker.
|
getDynamoDbAsyncClient, getTableNamepublic LegacyTableWorkerMetricStatsDAODelegate(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient,
LeaseManagementConfig.WorkerMetricsTableConfig tableConfig,
Long workerMetricsReporterFrequencyMillis)
public void initialize()
throws DependencyException
WorkerMetricStatsDAODelegateinitialize in class WorkerMetricStatsDAODelegate<WorkerMetricStats.LegacyWorkerMetricStats>DependencyException - if initialization fails due to external dependenciesprotected WorkerMetricStats.LegacyWorkerMetricStats toEntity(WorkerMetricStats workerMetrics)
toEntity in class WorkerMetricStatsDAODelegate<WorkerMetricStats.LegacyWorkerMetricStats>public boolean isEnabled()
public List<WorkerMetricStats> getAllWorkerMetricStats() throws DependencyException, InvalidStateException, ProvisionedThroughputException
getAllWorkerMetricStats in class WorkerMetricStatsDAODelegate<WorkerMetricStats.LegacyWorkerMetricStats>WorkerMetricStats entriesDependencyException - if DynamoDB operation fails unexpectedlyInvalidStateException - if the backing table does not existProvisionedThroughputException - if DynamoDB lacks capacitypublic void updateMetrics(WorkerMetricStats workerMetrics) throws DependencyException, InvalidStateException, ProvisionedThroughputException
WorkerMetricStatsDAODelegateupdateMetrics in class WorkerMetricStatsDAODelegate<WorkerMetricStats.LegacyWorkerMetricStats>workerMetrics - the worker metrics to persistDependencyException - if DynamoDB operation fails unexpectedlyInvalidStateException - if the backing table does not existProvisionedThroughputException - if DynamoDB lacks capacitypublic boolean deleteMetrics(WorkerMetricStats workerMetrics) throws DependencyException, InvalidStateException, ProvisionedThroughputException
WorkerMetricStatsDAODelegatedeleteMetrics in class WorkerMetricStatsDAODelegate<WorkerMetricStats.LegacyWorkerMetricStats>workerMetrics - the entry to delete (workerId and lastUpdateTime required)DependencyException - if DynamoDB operation fails unexpectedlyInvalidStateException - if the backing table does not existProvisionedThroughputException - if DynamoDB lacks capacityCopyright © 2026. All rights reserved.