Skip to content

Commit

Permalink
Change while-loop; Spotless Apply
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Oct 5, 2023
1 parent b73c01d commit 80a6593
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,8 @@ public static void testClientSetGet(
"%n concurrent = %d/%d, client# = %d/%d%n",
finalI, concurrentNum, finalJ + 1, clientNum);
}
while (true) {
int iterationIncrement = iterationCounter.getAndIncrement();
if (iterationIncrement >= iterations) {
break;
}
int iterationIncrement = iterationCounter.getAndIncrement();
while (iterationIncrement < iterations) {
if (config.debugLogging) {
System.out.printf(
"> iteration = %d/%d, client# = %d/%d%n",
Expand All @@ -190,6 +187,8 @@ public static void testClientSetGet(
Pair<ChosenAction, Long> result =
measurePerformance(client, config.dataSize, async);
actionResults.get(result.getLeft()).add(result.getRight());

iterationIncrement = iterationCounter.getAndIncrement();
}
});
}
Expand Down Expand Up @@ -226,17 +225,26 @@ public static Pair<ChosenAction, Long> measurePerformance(
actions.put(
ChosenAction.GET_EXISTING,
async
? () -> ((AsyncClient) client).asyncGet(generateKeySet()).get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
? () ->
((AsyncClient) client)
.asyncGet(generateKeySet())
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
: () -> ((SyncClient) client).get(generateKeySet()));
actions.put(
ChosenAction.GET_NON_EXISTING,
async
? () -> ((AsyncClient) client).asyncGet(generateKeyGet()).get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
? () ->
((AsyncClient) client)
.asyncGet(generateKeyGet())
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
: () -> ((SyncClient) client).get(generateKeyGet()));
actions.put(
ChosenAction.SET,
async
? () -> ((AsyncClient) client).asyncSet(generateKeySet(), value).get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
? () ->
((AsyncClient) client)
.asyncSet(generateKeySet(), value)
.get(ASYNC_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS)
: () -> ((SyncClient) client).set(generateKeySet(), value));

return getLatency(actions);
Expand Down

0 comments on commit 80a6593

Please sign in to comment.