public interface MultiCall<T,R>
extends java.lang.Cloneable
The request can be executed in a number of ways
MultiCallback
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels all the requests in this MultiCall
|
MultiCall<T,R> |
clone()
Creates a new instance of a MultiCall object to be reused for the same calls
|
void |
enqueue(MultiCallback<T,R> callback)
Enqueues asynchronously and calls a MultiCallback to notify progress, completion or failure
|
java.util.List<R> |
enqueueAndWait()
Enqueues on another thread but blocks the calling thread until completion or until an exception is thrown
|
java.util.List<R> |
enqueueAndWait(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Enqueues on another thread but blocks the calling thread for
at most the amount of time specified in the arguments.
|
java.util.List<R> |
execute()
Executes synchronously and blocks until completion or until an exception is thrown
|
boolean |
isCancelled()
Returns true if this MultiCall has been
cancelled, false otherwise
|
boolean |
isExecuted()
Returns true if this MultiCall has
been executed already
|
java.lang.String |
methodName()
The API method name to be executed.
|
java.util.List<T> |
requests()
Returns a List of the requests for this MultiCall
|
Interactor<R>
|
start()
Start executing the call and return a Interactor
|
java.lang.String methodName()
java.util.List<T> requests()
java.util.List<R> execute() throws java.io.IOException
java.io.IOException
- on failed IO operationsjava.util.List<R> enqueueAndWait() throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
- on failed network operationsjava.lang.InterruptedException
- if the calling thread is interruptedjava.util.List<R> enqueueAndWait(long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
Note you are not guaranteed to receive all the responses in the time you specified and if all the operations are not complete in this time a TimeoutException will be thrown
timeout
- The maximum amount of time before an attempt to collect the results from this operationtimeUnit
- The unit in which you specified the time argumentjava.io.IOException
- on failed IO operationsjava.lang.InterruptedException
- if the waiting thread was interruptedjava.util.concurrent.TimeoutException
- if the time is up before all the responses have been receivedvoid enqueue(MultiCallback<T,R> callback)
callback
- The MultiCallback to be fired on success or failureInteractor<R> start()
For more details on usage, see Interactor
boolean isExecuted()
void cancel()
boolean isCancelled()