public final class Dispatcher
extends java.lang.Object
Each dispatcher uses an ExecutorService to run calls internally. If you supply your
own executor, it should be able to run the configured maximum number
of calls concurrently.
| Constructor and Description |
|---|
Dispatcher() |
Dispatcher(java.util.concurrent.ExecutorService executorService) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelAll()
Cancel all calls currently enqueued or executing.
|
java.util.concurrent.ExecutorService |
executorService() |
int |
getMaxRequests() |
int |
getMaxRequestsPerHost() |
java.util.List<Call> |
queuedCalls()
Returns a snapshot of the calls currently awaiting execution.
|
int |
queuedCallsCount() |
java.util.List<Call> |
runningCalls()
Returns a snapshot of the calls currently being executed.
|
int |
runningCallsCount() |
void |
setMaxRequests(int maxRequests)
Set the maximum number of requests to execute concurrently.
|
void |
setMaxRequestsPerHost(int maxRequestsPerHost)
Set the maximum number of requests for each host to execute concurrently.
|
public Dispatcher(java.util.concurrent.ExecutorService executorService)
public Dispatcher()
public java.util.concurrent.ExecutorService executorService()
public void setMaxRequests(int maxRequests)
If more than maxRequests requests are in flight when this is invoked, those requests
will remain in flight.
public int getMaxRequests()
public void setMaxRequestsPerHost(int maxRequestsPerHost)
If more than maxRequestsPerHost requests are in flight when this is invoked, those
requests will remain in flight.
public int getMaxRequestsPerHost()
public void cancelAll()
public java.util.List<Call> queuedCalls()
public java.util.List<Call> runningCalls()
public int queuedCallsCount()
public int runningCallsCount()
Copyright © 2016. All Rights Reserved.