From 85060784a7758af064aa883d66f029dd292ea9e8 Mon Sep 17 00:00:00 2001 From: dzmitryh Date: Sat, 15 Oct 2016 14:27:15 +0300 Subject: [PATCH 1/2] End process logic clause has been corrected. --- .../async/method/invocation/ThreadAsyncExecutor.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java index 7f96d9ab7..5a10232f0 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java @@ -57,12 +57,10 @@ public class ThreadAsyncExecutor implements AsyncExecutor { @Override public T endProcess(AsyncResult asyncResult) throws ExecutionException, InterruptedException { - if (asyncResult.isCompleted()) { - return asyncResult.getValue(); - } else { + if (!asyncResult.isCompleted()) { asyncResult.await(); - return asyncResult.getValue(); } + return asyncResult.getValue(); } /** From 37b930c3b75ebc17ac46f6ce9f93ef1ed8435aeb Mon Sep 17 00:00:00 2001 From: dzmitryh Date: Sat, 15 Oct 2016 14:29:32 +0300 Subject: [PATCH 2/2] Unused import removed. --- .../async/method/invocation/ThreadAsyncExecutorTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java index b4a23222a..09126e99f 100644 --- a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java +++ b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java @@ -31,7 +31,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import static org.junit.Assert.*; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; import static org.mockito.internal.verification.VerificationModeFactory.times;