Skip to content

"Closable" HTTP client instance #449

Open
@kachayev

Description

@kachayev

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions