sendgrid / sendgrid-java

The Official Twilio SendGrid Led, Community Driven Java API Library
https://sendgrid.com
MIT License
486 stars 408 forks source link

Please provide a method to shutdown thread pool used in com.sendgrid.BaseInterface.attempt #731

Open taksatou opened 2 years ago

taksatou commented 2 years ago

Issue Summary

Please provide a method to shutdown thread pool used in com.sendgrid.BaseInterface.attempt. Even after com.sendgrid.SendGrid instance is discarded, the thread pool is still alive and it prevents the JVM process from exiting.

Steps to Reproduce

Just call com.sendgrid.BaseInterface.attempt, and then, the JVM process won't exit.

Technical details:

jackcviers commented 4 weeks ago

Agreed it should implement AutoCloseable. The close method can use awaitTermination while catching the InterruptedException to implement the close method, just like in the example under ExecutorService.