allow to specify timeout as a string time value (i.e. "2s") when getting from a future
This commit is contained in:
parent
9846847a61
commit
93e14e06c9
|
@ -39,6 +39,13 @@ public interface ActionFuture<T> extends Future<T> {
|
||||||
*/
|
*/
|
||||||
T actionGet() throws ElasticSearchException;
|
T actionGet() throws ElasticSearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just wrapping the {@link InterruptedException} with
|
||||||
|
* {@link org.elasticsearch.ElasticSearchInterruptedException}, and throwing the actual
|
||||||
|
* cause of the {@link java.util.concurrent.ExecutionException}.
|
||||||
|
*/
|
||||||
|
T actionGet(String timeout) throws ElasticSearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just wrapping the {@link InterruptedException} with
|
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just wrapping the {@link InterruptedException} with
|
||||||
* {@link org.elasticsearch.ElasticSearchInterruptedException}, and throwing the actual
|
* {@link org.elasticsearch.ElasticSearchInterruptedException}, and throwing the actual
|
||||||
|
|
|
@ -111,6 +111,10 @@ public class PlainActionFuture<T> implements ActionFuture<T>, ActionListener<T>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public T actionGet(String timeout) throws ElasticSearchException {
|
||||||
|
return actionGet(TimeValue.parseTimeValue(timeout, null));
|
||||||
|
}
|
||||||
|
|
||||||
@Override public T actionGet(long timeoutMillis) throws ElasticSearchException {
|
@Override public T actionGet(long timeoutMillis) throws ElasticSearchException {
|
||||||
return actionGet(timeoutMillis, TimeUnit.MILLISECONDS);
|
return actionGet(timeoutMillis, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue