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

feat: add isShutdown in HttpTransport #1901

Merged
merged 8 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
*
* <p>URL Fetch is only available on Google App Engine (not on any other Java environment), and is
* the underlying HTTP transport used for App Engine. Their implementation of {@link
* HttpURLConnection} is simply an abstraction layer on top of URL Fetch. By implementing a
* transport that directly uses URL Fetch, we can optimize the behavior slightly, and can
* potentially take advantage of features in URL Fetch that are not available in {@link
* HttpURLConnection}. Furthermore, there is currently a serious bug in how HTTP headers are
* processed in the App Engine implementation of {@link HttpURLConnection}, which we are able to
* avoid using this implementation. Therefore, this is the recommended transport to use on App
* Engine.
* HttpURLConnection} is simply an abstraction layer on top of URL Fetch. By implementing transport
blakeli0 marked this conversation as resolved.
Show resolved Hide resolved
* that directly uses URL Fetch, we can optimize the behavior slightly, and can potentially take
* advantage of features in URL Fetch that are not available in {@link HttpURLConnection}.
* Furthermore, there is currently a serious bug in how HTTP headers are processed in the App Engine
* implementation of {@link HttpURLConnection}, which we are able to avoid using this
* implementation. Therefore, this is the recommended transport to use on App Engine.
*
* @since 1.10
* @author Yaniv Inbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ public HttpResponse execute() throws IOException {
span.end(OpenCensusUtils.getEndSpanOptions(response == null ? null : response.getStatusCode()));

if (response == null) {
// Retries did not help resolve the execute exception, re-throw it.
// Retries did not help resolve the executed exception, re-throw it.
throw executeException;
}
// response interceptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Thread-safe abstract HTTP transport.
*
* <p>Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
* <p>Implementation is thread-safe, and subclasses must be thread-safe. For maximum efficiency,
* applications should use a single globally-shared instance of the HTTP transport.
*
* <p>The recommended concrete implementation HTTP transport library to use depends on what
Expand Down Expand Up @@ -158,4 +158,13 @@ public boolean isMtls() {
* @since 1.4
*/
public void shutdown() throws IOException {}

/**
* Default implementation of whether the http transport is shutdown or not.
blakeli0 marked this conversation as resolved.
Show resolved Hide resolved
*
* @since 1.4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version should be latest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, changed to 1.44.0 (the next release).

*/
public boolean isShutdown() {
blakeli0 marked this conversation as resolved.
Show resolved Hide resolved
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
* <p>Users should consider modifying the keep alive property on {@link NetHttpTransport} to control
* whether the socket should be returned to a pool of connected sockets. More information is
* available <a
* href='http://docs.oracle.com/javase/7/docs/technotes/guides/net/http-keepalive.html'>here</a>.
* href="http://docs.oracle.com/javase/7/docs/technotes/guides/net/http-keepalive.html">here</a>.
*
* <p>We honor the default global caching behavior. To change the default behavior use {@link
* HttpURLConnection#setDefaultUseCaches(boolean)}.
*
* <p>Implementation is thread-safe. For maximum efficiency, applications should use a single
* globally-shared instance of the HTTP transport.
*
* @since 1.0
* @author Yaniv Inbar
* @since 1.0
*/
public final class NetHttpTransport extends HttpTransport {
private static Proxy defaultProxy() {
Expand Down
Loading