Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch requests should allow null callbacks #634

Closed
wonderfly opened this issue Jan 10, 2015 · 8 comments
Closed

Batch requests should allow null callbacks #634

wonderfly opened this issue Jan 10, 2015 · 8 comments
Assignees
Labels
imported priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@wonderfly
Copy link
Contributor

From jasonhall@google.com on October 01, 2012 09:31:59

Version of google-api-java-client (e.g. 1.5.0-beta)? HEAD Java environment (e.g. Java 6, Android 2.3, App Engine)? App Engine Describe the problem. I'd like to perform a batch request, but I don't particularly care about the respective responses. I essentially want to "fire and forget" a series of API requests.

Currently I'm calling:

BatchRequest batch = compute.batch();
for (...) {
compute.instances().insert(...).queue(batch, null);
}
batch.execute();

This results in an NPE because of a Preconditions.checkNotNull check on the callback:
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:193)
at com.google.api.client.googleapis.batch.BatchRequest.queue(BatchRequest.java:161)
at com.google.api.services.compute.Compute$Instances$Insert.queue(Compute.java:2642) How would you expect it to be fixed? Either remove the checkNotNull check, or provide another queue() method that doesn't take a callback. Ideally requests that don't configure a callback would also skip parsing of the response entirely, since nothing downstream requires any details of the response.

This would lead to clearer more succinct code than the current working alternative, which is to define a no-op JsonBatchCallback instance that does nothing.

Original issue: http://code.google.com/p/google-api-java-client/issues/detail?id=620

@wonderfly wonderfly added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. imported priority: p2 Moderately-important priority. Fix may not be included in next release. Component-HTTP labels Jan 10, 2015
@wonderfly wonderfly self-assigned this Jan 10, 2015
@wonderfly
Copy link
Contributor Author

From yan...@google.com on October 01, 2012 18:53:55

Status: Accepted
Labels: Milestone-Version1.13.0

@wonderfly
Copy link
Contributor Author

From rmis...@google.com on December 12, 2012 06:41:06

Labels: -Milestone-Version1.13.0 Milestone-Version1.14.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on January 22, 2013 08:14:54

Labels: -Type-Defect -Milestone-Version1.14.0 Type-Enhancement Milestone-Version2.1.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on February 06, 2013 16:05:10

Labels: -Milestone-Version2.1.0 Milestone-Version1.16.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on June 10, 2013 06:29:23

Owner: pele...@google.com
Cc: ngmic...@google.com
Labels: Component-HTTP

@wonderfly
Copy link
Contributor Author

From yan...@google.com on June 21, 2013 07:06:17

Labels: -Milestone-Version1.16.0 Milestone-Version1.17.0

@wonderfly
Copy link
Contributor Author

From pele...@google.com on July 28, 2013 23:08:22

Labels: -Milestone-Version1.17.0 Milestone-Version1.18.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on September 27, 2013 05:03:13

Labels: -Milestone-Version1.18.0

@wonderfly wonderfly removed their assignment May 19, 2016
@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants