Skip to content

Commit

Permalink
feat: move Lock initialization to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Koziolek committed Oct 18, 2024
1 parent e6a664b commit ec314af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vavr/src/main/java/io/vavr/concurrent/FutureImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class FutureImpl<T> implements Future<T> {
/**
* Used to synchronize state changes.
*/
private final Lock lock = new ReentrantLock();
private final Lock lock;

/**
* Indicates if this Future is cancelled
Expand Down Expand Up @@ -89,6 +89,7 @@ final class FutureImpl<T> implements Future<T> {

// single constructor
private FutureImpl(Executor executor, Option<Try<T>> value, Queue<Consumer<Try<T>>> actions, Queue<Thread> waiters, Computation<T> computation) {
this.lock = new ReentrantLock();
this.executor = executor;
lock.lock();
try {
Expand Down

0 comments on commit ec314af

Please sign in to comment.