Skip to content

Commit

Permalink
fixed minor bug on non blocking query result, issue #6267
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Jul 1, 2016
1 parent 0ddeeb2 commit 007a128
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
public class OSQLNonBlockingQuery<T extends Object> extends OSQLQuery<T> implements OCommandRequestAsynch {
private static final long serialVersionUID = 1L;

public static class ONonBlockingQueryFuture implements Future, List<Future> {
public class ONonBlockingQueryFuture implements Future, List<Future> {

protected volatile boolean finished = false;

Expand All @@ -71,15 +71,15 @@ public synchronized Object get() throws InterruptedException, ExecutionException
while (!finished) {
wait();
}
return null;
return OSQLNonBlockingQuery.this.getResultListener().getResult();
}

@Override
public synchronized Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
while (!finished) {
wait();
}
return null;
return OSQLNonBlockingQuery.this.getResultListener().getResult();
}

@Override
Expand All @@ -99,7 +99,23 @@ public boolean contains(Object o) {

@Override
public Iterator<Future> iterator() {
throw new UnsupportedOperationException("Trying to iterate over a non-blocking query result");
return new Iterator<Future>() {

@Override
public boolean hasNext() {
return false;
}

@Override
public Future next() {
return null;
}

@Override
public void remove() {
throw new UnsupportedOperationException("Unsuppored remove on non blocking query result");
}
};
}

@Override
Expand Down

0 comments on commit 007a128

Please sign in to comment.