diff --git a/jpa/boot-jpa-locks/src/test/java/com/example/locks/services/ActorServiceIntTest.java b/jpa/boot-jpa-locks/src/test/java/com/example/locks/services/ActorServiceIntTest.java index ce2d5b875..d16eac6f9 100644 --- a/jpa/boot-jpa-locks/src/test/java/com/example/locks/services/ActorServiceIntTest.java +++ b/jpa/boot-jpa-locks/src/test/java/com/example/locks/services/ActorServiceIntTest.java @@ -87,15 +87,8 @@ void testPessimisticReadLock() throws ExecutionException, InterruptedException { // Obtaining a pessimistic read lock concurrently by two requests on the same record List> 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))