FileDocCategorySizeDatePackage
ExecutorDelivery.javaAPI DocAndroid 5.1 API3881Thu Mar 12 22:22:56 GMT 2015com.android.volley

ExecutorDelivery

public class ExecutorDelivery extends Object implements ResponseDelivery
Delivers responses and errors.

Fields Summary
private final Executor
mResponsePoster
Used for posting responses, typically to the main thread.
Constructors Summary
public ExecutorDelivery(android.os.Handler handler)
Creates a new response delivery interface.

param
handler {@link Handler} to post responses on

        // Make an Executor that just wraps the handler.
        mResponsePoster = new Executor() {
            @Override
            public void execute(Runnable command) {
                handler.post(command);
            }
        };
    
public ExecutorDelivery(Executor executor)
Creates a new response delivery interface, mockable version for testing.

param
executor For running delivery tasks

        mResponsePoster = executor;
    
Methods Summary
public voidpostError(Request request, VolleyError error)

        request.addMarker("post-error");
        Response<?> response = Response.error(error);
        mResponsePoster.execute(new ResponseDeliveryRunnable(request, response, null));
    
public voidpostResponse(Request request, Response response)

        postResponse(request, response, null);
    
public voidpostResponse(Request request, Response response, java.lang.Runnable runnable)

        request.markDelivered();
        request.addMarker("post-response");
        mResponsePoster.execute(new ResponseDeliveryRunnable(request, response, runnable));