Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
josecorella committed Dec 17, 2024
1 parent 62fd618 commit a9c2675
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,29 @@ public class ConcurrentConditionCheckWriteTest {
private static final List<String> identifiers = Collections.unmodifiableList(
Arrays.asList("1", "2", "3", "4", "5")
);
private Map<String, DynamoDbClient> ddbClientToThreadId;
private Map<String, DynamoDbClient> threadIdToDdbClient;
private static Map<String, String> indexToThreadId;
private ConcurrentLinkedDeque<String> unpickedIndices;

@BeforeClass
public void setup() {
ddbClientToThreadId = new ConcurrentHashMap<>(6, 1, threadCount);
threadIdToDdbClient = new ConcurrentHashMap<>(6, 1, threadCount);
identifiers.forEach(id ->
ddbClientToThreadId.put(id, DynamoDbClient.create())
threadIdToDdbClient.put(id, DynamoDbClient.create())
);
indexToThreadId = new ConcurrentHashMap<>(6, 1, threadCount);
unpickedIndices = new ConcurrentLinkedDeque<>(identifiers);
}

@AfterClass
public void teardown() {
DynamoDbClient _ddbClient = DynamoDbClient.create();
identifiers.forEach(id ->
DdbHelper.deleteKeyStoreDdbItem(
mLockedId,
"branch:ACTIVE",
Fixtures.TEST_KEYSTORE_NAME,
DynamoDbClient.create(),
_ddbClient,
true
)
);
Expand Down Expand Up @@ -99,7 +100,7 @@ public static TransactWriteItem conditionalWrite(
}

private DynamoDbClient clientForThread(final String threadIdToIndex) {
return ddbClientToThreadId.computeIfAbsent(
return threadIdToDdbClient.computeIfAbsent(
threadIdToIndex,
ddbClient -> DynamoDbClient.create()
);
Expand Down

0 comments on commit a9c2675

Please sign in to comment.