From ec314afd99fdcfec65c5fe72076eeed2308bdc1b Mon Sep 17 00:00:00 2001 From: Koziolek Date: Fri, 18 Oct 2024 19:38:27 +0200 Subject: [PATCH] feat: move Lock initialization to constructor --- vavr/src/main/java/io/vavr/concurrent/FutureImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vavr/src/main/java/io/vavr/concurrent/FutureImpl.java b/vavr/src/main/java/io/vavr/concurrent/FutureImpl.java index 6f036abba..f56b2458c 100644 --- a/vavr/src/main/java/io/vavr/concurrent/FutureImpl.java +++ b/vavr/src/main/java/io/vavr/concurrent/FutureImpl.java @@ -47,7 +47,7 @@ final class FutureImpl implements Future { /** * Used to synchronize state changes. */ - private final Lock lock = new ReentrantLock(); + private final Lock lock; /** * Indicates if this Future is cancelled @@ -89,6 +89,7 @@ final class FutureImpl implements Future { // single constructor private FutureImpl(Executor executor, Option> value, Queue>> actions, Queue waiters, Computation computation) { + this.lock = new ReentrantLock(); this.executor = executor; lock.lock(); try {