public abstract class AsyncNetwork extends java.lang.Object implements Network
Network to perform requests.
WARNING: This API is experimental and subject to breaking changes. Please see https://github.com/google/volley/wiki/Asynchronous-Volley for more details.
| Modifier and Type | Class and Description |
|---|---|
static interface |
AsyncNetwork.OnRequestComplete
Interface for callback to be called after request is processed.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AsyncNetwork() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.concurrent.ExecutorService |
getBlockingExecutor()
Gets blocking executor to perform any potentially blocking tasks.
|
protected java.util.concurrent.ExecutorService |
getNonBlockingExecutor()
Gets non-blocking executor to perform any non-blocking tasks.
|
protected java.util.concurrent.ScheduledExecutorService |
getNonBlockingScheduledExecutor()
Gets scheduled executor to perform any non-blocking tasks that need to be scheduled.
|
NetworkResponse |
performRequest(Request<?> request)
Blocking method to perform network request.
|
abstract void |
performRequest(Request<?> request,
AsyncNetwork.OnRequestComplete callback)
Non-blocking method to perform the specified request.
|
void |
setBlockingExecutor(java.util.concurrent.ExecutorService executor)
This method sets the blocking executor to be used by the network for potentially blocking
tasks.
|
void |
setNonBlockingExecutor(java.util.concurrent.ExecutorService executor)
This method sets the non blocking executor to be used by the network for non-blocking tasks.
|
void |
setNonBlockingScheduledExecutor(java.util.concurrent.ScheduledExecutorService executor)
This method sets the scheduled executor to be used by the network for non-blocking tasks to
be scheduled.
|
public abstract void performRequest(Request<?> request, AsyncNetwork.OnRequestComplete callback)
request - Request to processcallback - to be called once NetworkResponse is receivedpublic NetworkResponse performRequest(Request<?> request) throws VolleyError
performRequest in interface Networkrequest - Request to processVolleyError - in the event of an errorpublic void setNonBlockingExecutor(java.util.concurrent.ExecutorService executor)
This method must be called before performing any requests.
public void setBlockingExecutor(java.util.concurrent.ExecutorService executor)
This method must be called before performing any requests.
public void setNonBlockingScheduledExecutor(java.util.concurrent.ScheduledExecutorService executor)
This method must be called before performing any requests.
protected java.util.concurrent.ExecutorService getBlockingExecutor()
protected java.util.concurrent.ExecutorService getNonBlockingExecutor()
protected java.util.concurrent.ScheduledExecutorService getNonBlockingScheduledExecutor()