mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 22:17:38 +00:00
Merge pull request #506 from dzmitryh/master
Cosmetic fixes in async-method-invocation
This commit is contained in:
commit
932700d9b1
2 files changed
+2
-5
No files matched your search
+2
-4
@@ -57,12 +57,10 @@ public class ThreadAsyncExecutor implements AsyncExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T endProcess(AsyncResult<T> asyncResult) throws ExecutionException, InterruptedException {
|
public <T> T endProcess(AsyncResult<T> asyncResult) throws ExecutionException, InterruptedException {
|
||||||
if (asyncResult.isCompleted()) {
|
if (!asyncResult.isCompleted()) {
|
||||||
return asyncResult.getValue();
|
|
||||||
} else {
|
|
||||||
asyncResult.await();
|
asyncResult.await();
|
||||||
return asyncResult.getValue();
|
|
||||||
}
|
}
|
||||||
|
return asyncResult.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
-1
@@ -31,7 +31,6 @@ import java.util.concurrent.Callable;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.mockito.Matchers.eq;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user