Skip to content

Make HttpClient Disposable #88

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

Closed
nebhale opened this issue May 6, 2017 · 1 comment
Closed

Make HttpClient Disposable #88

nebhale opened this issue May 6, 2017 · 1 comment

Comments

@nebhale
Copy link
Contributor

nebhale commented May 6, 2017

Currently, when finished with an HttpClient, there is no way to close the (optional) LoopResources and PoolResources contained within it. You can work around this issue by maintaining references to the configured instances of each of these and disposing them manually yourself, but it would be easier if there was a Disposable#dispose() method on the HttpClient itself, allowing a single call that would clean up all resources maintained by the HttpClient.

nebhale added a commit to cloudfoundry/cf-java-client that referenced this issue May 6, 2017
This change adds a dispose() method on the DefaultConnectionContext in order
to cleanup any cached resources like connection and thread pools. This method
is also marked as @PreDestroy so any DefaultConnectionContext created as a
Spring (or EJB) bean will be automatically disposed as part of the standard
application lifecycle.  This implementation is a temporary solution until
reactor/reactor-netty#88 is implemented and
available.

[resolves #745]
@nebhale
Copy link
Contributor Author

nebhale commented May 10, 2017

It appears that since the defaults, if not configured, are shared across the entire JVM, closing them automatically is wrong. Therefore, there is a reasonable expectation that all custom configured pool and loop resources should be managed by their creator. Therefore this is disposal on HttpClient is not a reasonable requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant