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 1 commit
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
Next Next commit
feat: add isShutdown in HttpTransport
  • Loading branch information
JoeWang1127 committed Nov 22, 2023
commit 6438e7eae11849d9821388ba451696e391b2ba82
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* <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
* HttpURLConnection} is simply an abstraction layer on top of URL Fetch. By implementing
* 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
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 @@ -157,5 +157,11 @@ public boolean isMtls() {
* @throws IOException I/O exception
* @since 1.4
*/
public void shutdown() throws IOException {}
public void shutdown() throws IOException {

}

public boolean isShutdown() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,20 @@
/**
* Thread-safe HTTP low-level transport based on the {@code java.net} package.
*
* <p>Users should consider modifying the keep alive property on {@link NetHttpTransport} to control
* <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