public final class Dispatcher extends 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(ExecutorService
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelAll()
Cancel all calls currently enqueued or executing.
|
ExecutorService |
executorService()
|
int |
getMaxRequests()
|
int |
getMaxRequestsPerHost()
|
List |
queuedCalls()
Returns a snapshot of the calls currently awaiting execution.
|
int |
queuedCallsCount()
|
List |
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(ExecutorServiceexecutorService)
public Dispatcher()
public ExecutorServiceexecutorService()
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 List<Call > queuedCalls()
public List<Call > runningCalls()
public int queuedCallsCount()
public int runningCallsCount()