Fixed possible race condition in short-lived synchrynous commands
This commit is contained in:
parent
b11bd4fd1e
commit
900ce2f91c
|
|
@ -429,8 +429,10 @@ public class ApiConnection {
|
||||||
|
|
||||||
private List<Result> getResults() throws ApiCommandException, ApiConnectionException {
|
private List<Result> getResults() throws ApiCommandException, ApiConnectionException {
|
||||||
try {
|
try {
|
||||||
synchronized (this) {
|
synchronized (this) { // don't wait if we already have a result.
|
||||||
wait();
|
if ((err == null) && results.isEmpty()) {
|
||||||
|
wait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
throw new ApiConnectionException(ex.getMessage(), ex);
|
throw new ApiConnectionException(ex.getMessage(), ex);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue