public class NetworkDispatcher
extends java.lang.Thread
Network interface. Responses are committed to cache, if
eligible, using a specified Cache interface. Valid responses and
errors are posted back to the caller via a ResponseDelivery.| Modifier and Type | Field and Description |
|---|---|
private Cache |
mCache
The cache to write to.
|
private ResponseDelivery |
mDelivery
For posting responses and errors.
|
private Network |
mNetwork
The network interface for processing requests.
|
private java.util.concurrent.BlockingQueue<Request<?>> |
mQueue
The queue of requests to service.
|
private boolean |
mQuit
Used for telling us to die.
|
| Constructor and Description |
|---|
NetworkDispatcher(java.util.concurrent.BlockingQueue<Request<?>> queue,
Network network,
Cache cache,
ResponseDelivery delivery)
Creates a new network dispatcher thread.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addTrafficStatsTag(Request<?> request) |
private void |
parseAndDeliverNetworkError(Request<?> request,
VolleyError error) |
void |
quit()
Forces this dispatcher to quit immediately.
|
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldprivate final java.util.concurrent.BlockingQueue<Request<?>> mQueue
private final Network mNetwork
private final Cache mCache
private final ResponseDelivery mDelivery
private volatile boolean mQuit
public NetworkDispatcher(java.util.concurrent.BlockingQueue<Request<?>> queue, Network network, Cache cache, ResponseDelivery delivery)
Thread.start()
in order to begin processing.queue - Queue of incoming requests for triagenetwork - Network interface to use for performing requestscache - Cache interface to use for writing responses to cachedelivery - Delivery interface to use for posting responsespublic void quit()
private void addTrafficStatsTag(Request<?> request)
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadprivate void parseAndDeliverNetworkError(Request<?> request, VolleyError error)