Sample use:
BatchRequest batch = new BatchRequest(transport, httpRequestInitializer); batch.queue(volumesList, Volumes.class, GoogleJsonErrorContainer.class, new BatchCallback<Volumes, GoogleJsonErrorContainer>() { public void onSuccess(Volumes volumes, GoogleHeaders responseHeaders) { log("Success"); printVolumes(volumes.getItems()); } public void onFailure(GoogleJsonErrorContainer e, GoogleHeaders responseHeaders) { log(e.getError().getMessage()); } }); batch.queue(volumesList, Volumes.class, GoogleJsonErrorContainer.class, new BatchCallback<Volumes, GoogleJsonErrorContainer>() { public void onSuccess(Volumes volumes, GoogleHeaders responseHeaders) { log("Success"); printVolumes(volumes.getItems()); } public void onFailure(GoogleJsonErrorContainer e, GoogleHeaders responseHeaders) { log(e.getError().getMessage()); } }); batch.execute();
The content of each individual response is stored in memory. There is thus a potential of encountering an {@link OutOfMemoryError} for very large responses.
Redirects are currently not followed in {@link BatchRequest}.
Implementation is not thread-safe.
@since 1.9 @author rmistry@google.com (Ravi Mistry)
|
|
|
|
|
|