SAP / SapMachine

An OpenJDK release maintained and supported by SAP
https://sapmachine.io
GNU General Public License v2.0
504 stars 92 forks source link

Provide a mechanism to augment the Http KeepAliveCache key #1646

Closed RealCLanger closed 5 months ago

RealCLanger commented 5 months ago

A customer is accessing an HttpServer backend via HttpURLConnection through JAX-WS. Connections get authenticated by some special mechanism on a per-socket base and subsequent HTTP requests need to happen on the authenticated connection. So the matching authenticated connection has to be retrieved from the cache. To achieve this, we add a field of type ThreadLocal to sun.net.www.http.KeepAliveCache that can be armed with a value and serves as an additional part of the KeepAliveCache key.

We have thought about alternative solutions for the customer but at the moment there seem to be none. The feature does not affect the API and is only enabled when system property com.sap.jvm.UseHttpKeepAliveCacheKeyExtension is set to true. To use this feature, client code needs an export statement like --add-exports java.base/sun.net.www.http=ALL-UNNAMED.