From 7061cec3c4ae38fe2d9606fb613aace090dc6b15 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 22 Dec 2020 09:06:22 +0530 Subject: [PATCH 1/3] closeable implemented closeable implemented to have standard java api to free up resource --- src/main/java/com/google/maps/GeoApiContext.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/maps/GeoApiContext.java b/src/main/java/com/google/maps/GeoApiContext.java index e7561b641..35fa90473 100644 --- a/src/main/java/com/google/maps/GeoApiContext.java +++ b/src/main/java/com/google/maps/GeoApiContext.java @@ -27,6 +27,9 @@ import com.google.maps.metrics.NoOpRequestMetricsReporter; import com.google.maps.metrics.RequestMetrics; import com.google.maps.metrics.RequestMetricsReporter; + +import java.io.Closeable; +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.Proxy; import java.net.URLEncoder; @@ -51,7 +54,7 @@ *

When you are finished with a GeoApiContext object, you must call {@link #shutdown()} on it to * release its resources. */ -public class GeoApiContext { +public class GeoApiContext implements Closeable { private static final String VERSION = "@VERSION@"; // Populated by the build script private static final String USER_AGENT = "GoogleGeoApiClientJava/" + VERSION; @@ -95,6 +98,15 @@ public class GeoApiContext { setExperienceId(experienceIdHeaderValue); } + /** + * standard Java API to reclaim resources + * @throws IOException + */ + @Override + public void close() throws IOException { + shutdown(); + } + /** * The service provider interface that enables requests to be handled via switchable back ends. * There are supplied implementations of this interface for both OkHttp and Google App Engine's From dc89fae0aa195797fe9e4a8a7d4b5f13ab8d14df Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 22 Dec 2020 11:14:33 +0530 Subject: [PATCH 2/3] formatting corrected --- src/main/java/com/google/maps/GeoApiContext.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/google/maps/GeoApiContext.java b/src/main/java/com/google/maps/GeoApiContext.java index 35fa90473..1ddbca0ef 100644 --- a/src/main/java/com/google/maps/GeoApiContext.java +++ b/src/main/java/com/google/maps/GeoApiContext.java @@ -100,6 +100,7 @@ public class GeoApiContext implements Closeable { /** * standard Java API to reclaim resources + * * @throws IOException */ @Override From 3e25c47d876f5527aff7817175ce8e4b65f8bfb3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 22 Dec 2020 11:25:48 +0530 Subject: [PATCH 3/3] formatting corrected --- src/main/java/com/google/maps/GeoApiContext.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/google/maps/GeoApiContext.java b/src/main/java/com/google/maps/GeoApiContext.java index 1ddbca0ef..222dacdff 100644 --- a/src/main/java/com/google/maps/GeoApiContext.java +++ b/src/main/java/com/google/maps/GeoApiContext.java @@ -27,7 +27,6 @@ import com.google.maps.metrics.NoOpRequestMetricsReporter; import com.google.maps.metrics.RequestMetrics; import com.google.maps.metrics.RequestMetricsReporter; - import java.io.Closeable; import java.io.IOException; import java.io.UnsupportedEncodingException;