File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/main/java/com/sendgrid Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11package com .sendgrid ;
22
3+ import java .io .Closeable ;
34import java .io .IOException ;
45import java .io .PrintWriter ;
56import java .io .StringWriter ;
@@ -45,7 +46,7 @@ public HttpDeleteWithBody(final String uri) {
4546/**
4647 * Class Client allows for quick and easy access any REST or REST-like API.
4748 */
48- public class Client {
49+ public class Client implements Closeable {
4950
5051 private CloseableHttpClient httpClient ;
5152 private Boolean test ;
@@ -342,12 +343,15 @@ public Response api(Request request) throws IOException {
342343 }
343344 }
344345
346+ @ Override
347+ public void close () throws IOException {
348+ this .httpClient .close ();
349+ }
350+
345351 @ Override
346352 public void finalize () throws Throwable {
347353 try {
348- if (this .createdHttpClient ) {
349- this .httpClient .close ();
350- }
354+ close ();
351355 } catch (IOException e ) {
352356 throw new Throwable (e .getMessage ());
353357 } finally {
You can’t perform that action at this time.
0 commit comments