diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionFuture.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionFuture.java index 7ce1581f638..93ac556579f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionFuture.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionFuture.java @@ -39,6 +39,13 @@ public interface ActionFuture extends Future { */ 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 * {@link org.elasticsearch.ElasticSearchInterruptedException}, and throwing the actual diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java index 02291bfa275..4d502a39864 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/PlainActionFuture.java @@ -111,6 +111,10 @@ public class PlainActionFuture implements ActionFuture, ActionListener } } + @Override public T actionGet(String timeout) throws ElasticSearchException { + return actionGet(TimeValue.parseTimeValue(timeout, null)); + } + @Override public T actionGet(long timeoutMillis) throws ElasticSearchException { return actionGet(timeoutMillis, TimeUnit.MILLISECONDS); }