类 RequestQueue
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.-
嵌套类概要
嵌套类修饰符和类型类说明static interfaceA simple predicate or filter interface for Requests, for use bycancelAll(RequestFilter).static interfaceCallback interface for completed requests. -
构造器概要
构造器构造器说明RequestQueue(Cache cache, Network network) Creates the worker pool.RequestQueue(Cache cache, Network network, int threadPoolSize) Creates the worker pool.RequestQueue(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) Creates the worker pool. -
方法概要
修饰符和类型方法说明<T> Request<T>Adds a Request to the dispatch queue.<T> voidvoidcancelAll(RequestQueue.RequestFilter filter) Cancels all requests in this queue for which the given filter applies.voidCancels all requests in this queue with the given tag.getCache()Gets theCacheinstance being used.intGets a sequence number.<T> voidRemove a RequestFinishedListener.voidstart()Starts the dispatchers in this queue.voidstop()Stops the cache and network dispatchers.
-
构造器详细资料
-
RequestQueue
Creates the worker pool. Processing will not begin untilstart()is called.- 参数:
cache- A Cache to use for persisting responses to disknetwork- A Network interface for performing HTTP requeststhreadPoolSize- Number of network dispatcher threads to createdelivery- A ResponseDelivery interface for posting responses and errors
-
RequestQueue
Creates the worker pool. Processing will not begin untilstart()is called.- 参数:
cache- A Cache to use for persisting responses to disknetwork- A Network interface for performing HTTP requeststhreadPoolSize- Number of network dispatcher threads to create
-
RequestQueue
Creates the worker pool. Processing will not begin untilstart()is called.- 参数:
cache- A Cache to use for persisting responses to disknetwork- A Network interface for performing HTTP requests
-
-
方法详细资料
-
start
public void start()Starts the dispatchers in this queue. -
stop
public void stop()Stops the cache and network dispatchers. -
getSequenceNumber
public int getSequenceNumber()Gets a sequence number. -
getCache
Gets theCacheinstance being used. -
cancelAll
Cancels all requests in this queue for which the given filter applies.- 参数:
filter- The filtering function to use
-
cancelAll
Cancels all requests in this queue with the given tag. Tag must be non-null and equality is by identity. -
add
Adds a Request to the dispatch queue.- 参数:
request- The request to service- 返回:
- The passed-in request
-
addRequestFinishedListener
-
removeRequestFinishedListener
Remove a RequestFinishedListener. Has no effect if listener was not previously added.
-