java.lang.Object | |
↳ | com.android.volley.RequestQueue |
A request dispatch queue with a thread pool of dispatchers.
Calling add(Request)
will enqueue the given Request for dispatch,
resolving from either cache or network on a worker thread, and then delivering
a parsed response on the main thread.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | RequestQueue.RequestFilter | A simple predicate or filter interface for Requests, for use by
cancelAll(RequestFilter) . |
|||||||||
interface | RequestQueue.RequestFinishedListener<T> | Callback interface for completed requests. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RequestQueue(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery)
Creates the worker pool.
| |||||||||||
RequestQueue(Cache cache, Network network, int threadPoolSize)
Creates the worker pool.
| |||||||||||
RequestQueue(Cache cache, Network network)
Creates the worker pool.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
<T> Request<T> |
add(Request<T> request)
Adds a Request to the dispatch queue.
| ||||||||||
<T> void | addRequestFinishedListener(RequestFinishedListener<T> listener) | ||||||||||
void |
cancelAll(RequestQueue.RequestFilter filter)
Cancels all requests in this queue for which the given filter applies.
| ||||||||||
void |
cancelAll(Object tag)
Cancels all requests in this queue with the given tag.
| ||||||||||
Cache |
getCache()
Gets the
Cache instance being used. | ||||||||||
int |
getSequenceNumber()
Gets a sequence number.
| ||||||||||
<T> void |
removeRequestFinishedListener(RequestFinishedListener<T> listener)
Remove a RequestFinishedListener.
| ||||||||||
void |
start()
Starts the dispatchers in this queue.
| ||||||||||
void |
stop()
Stops the cache and network dispatchers.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates the worker pool. Processing will not begin until start()
is called.
cache | A Cache to use for persisting responses to disk |
---|---|
network | A Network interface for performing HTTP requests |
threadPoolSize | Number of network dispatcher threads to create |
delivery | A ResponseDelivery interface for posting responses and errors |
Creates the worker pool. Processing will not begin until start()
is called.
cache | A Cache to use for persisting responses to disk |
---|---|
network | A Network interface for performing HTTP requests |
threadPoolSize | Number of network dispatcher threads to create |
Creates the worker pool. Processing will not begin until start()
is called.
cache | A Cache to use for persisting responses to disk |
---|---|
network | A Network interface for performing HTTP requests |
Adds a Request to the dispatch queue.
request | The request to service |
---|
Cancels all requests in this queue for which the given filter applies.
filter | The filtering function to use |
---|
Cancels all requests in this queue with the given tag. Tag must be non-null and equality is by identity.
Gets a sequence number.
Remove a RequestFinishedListener. Has no effect if listener was not previously added.
Starts the dispatchers in this queue.
Stops the cache and network dispatchers.