Skip to content

Commit

Permalink
feat : polish test
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Feb 26, 2024
1 parent eb43516 commit b204593
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,8 @@ void testPessimisticReadLock() throws ExecutionException, InterruptedException {
// Obtaining a pessimistic read lock concurrently by two requests on the same record
List<CompletableFuture<Actor>> completableFutureList = IntStream.range(0, 2)
.boxed()
.map(actorName -> CompletableFuture.supplyAsync(() -> {
var readLockActor = new Actor();
try {
readLockActor = actorService.getActorWithPessimisticReadLock(actorResponse.actorId());
} catch (Exception e) {
log.error("exception occurred", e);
}
return readLockActor;
}))
.map(actorName -> CompletableFuture.supplyAsync(
() -> actorService.getActorWithPessimisticReadLock(actorResponse.actorId())))
.toList();

CompletableFuture.allOf(completableFutureList.toArray(CompletableFuture[]::new))
Expand Down

0 comments on commit b204593

Please sign in to comment.