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

"Closable" HTTP client instance #449

Open
kachayev opened this issue Dec 16, 2018 · 0 comments
Open

"Closable" HTTP client instance #449

kachayev opened this issue Dec 16, 2018 · 0 comments

Comments

@kachayev
Copy link
Collaborator

In some cases, you need to be able to clean up all resources allocated by the HTTP client: close all open connections, shutdown appropriate threads etc. It's useful and desirable e.g. when your application has some kind of lifecycle management or when implementing a library that targets to be a good citizen for your JVM.

All of that is kinda tricky with Aleph, as we do not have any specific notion of "client instance" at all, at least in a way we do for the server. By default, HTTP request goes to a default shared connections pool and operates on shared Netty's threads group. But we can expose another API that creates a reified Closable instance that you can use to call .close when necessary (like we do to shut down a server), uses provided instance of a connection pool or newly created one (but never shared), spawns separate Netty's group to shutdown it when necessary.

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

No branches or pull requests

1 participant