Package com.algorithmia.algo
Class FutureAlgoResponse
- java.lang.Object
-
- com.algorithmia.algo.FutureAlgoResponse
-
- All Implemented Interfaces:
java.util.concurrent.Future<AlgoResponse>
public class FutureAlgoResponse extends java.lang.Object implements java.util.concurrent.Future<AlgoResponse>
A request object to represent that an algorithm has been call asynchronously WrappingFuture<AlgoResponse>
will allow other async scenarios (e.g. where the internal implementation is based on polling instead of long-lived connections) without changing the exposed interface
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.Future<AlgoResponse>
promise
-
Constructor Summary
Constructors Modifier Constructor Description protected
FutureAlgoResponse()
FutureAlgoResponse(java.util.concurrent.Future<AlgoResponse> promise)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancel(boolean mayInterruptIfRunning)
AlgoResponse
get()
AlgoResponse
get(long timeout, java.util.concurrent.TimeUnit unit)
boolean
isCancelled()
boolean
isDone()
-
-
-
Field Detail
-
promise
protected java.util.concurrent.Future<AlgoResponse> promise
-
-
Constructor Detail
-
FutureAlgoResponse
protected FutureAlgoResponse()
-
FutureAlgoResponse
public FutureAlgoResponse(java.util.concurrent.Future<AlgoResponse> promise)
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interfacejava.util.concurrent.Future<AlgoResponse>
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfacejava.util.concurrent.Future<AlgoResponse>
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<AlgoResponse>
-
get
public AlgoResponse get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.util.concurrent.Future<AlgoResponse>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
get
public AlgoResponse get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
- Specified by:
get
in interfacejava.util.concurrent.Future<AlgoResponse>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
-
-