Skip to content

Add per-connection attachment storage to HttpConnectionInternal #6234

Description

@Harshal96

Describe the feature

vert-x3/vertx-web#2910 needs per-connection state (announced Alt-Svc origins) that
must not leak after the connection closes. Current workaround lives entirely in
vertx-web: a WeakHashMap<HttpConnection, T> (see HttpConnectionLocal.java in that PR).
vert-x3/vertx-web#2910 (comment) (comment by @vietj):
"actually I meant I would add a map like structure on vertx internal HTTP connection
object in vertx-core which would solve the issue more directly"

Proposal

Add attachment storage to the HttpConnectionInternal contract (new interface,
following the existing HttpServerRequestInternal / HttpClientRequestInternal
pattern in io.vertx.core.internal.http), scoped to the connection's lifecycle so
entries are cleared automatically on close:

    <T> T get(Object key);
    void set(Object key, Object value);

Downstream modules (vertx-web, etc.) can then stash per-connection state via this
contract instead of each reinventing weak-map/close-handler bookkeeping.

Contribution

Myself

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions