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
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
HttpConnectionInternalcontract (new interface,following the existing
HttpServerRequestInternal/HttpClientRequestInternalpattern in
io.vertx.core.internal.http), scoped to the connection's lifecycle soentries are cleared automatically on close:
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