Modernize Java HTTP Metrics Collector from Java 8 to Java 21
# Epic ## Outcome Move `sensors/java-http-metrics-collector` from Java 8 to Java 21 through staged, reviewable iterations while preserving the current collector behavior, startup logs, `metric_sample` output, Docker Compose path, container image path, and the prepared experimental Kubernetes deployment path. ## Modernization narrative This is not a big-bang rewrite. The migration first baselines the current Java 8 behavior and adds Java 8/Java 21 CI visibility, then prepares the Java 21 build/runtime path before applying focused language-specific modernization iterations. The implementation work should follow these separate iterations: replace `HttpURLConnection` with `java.net.http.HttpClient`, introduce virtual threads for endpoint collection, convert DTO/config models to records where safe, apply pattern matching and switch expressions in focused branching paths, migrate timestamp handling to `java.time`, and modernize tests around the migration. Throughout the migration, keep the existing Docker Compose workflow and published container image path intact. Treat `k8s-manifests/` as the prepared experimental Kubernetes deployment path and keep it understandable while Java 21 runtime validation evolves. ## Scope - [ ] Baseline current Java 8 behavior, including logs, metrics, config loading, exporters, Compose, and the current end-to-end test state. - [ ] Add CI visibility for both Java 8 and Java 21 before changing the default runtime. - [ ] Prepare Maven, dependencies, packaging, and runtime documentation for Java 21. - [ ] Complete language-specific implementation iterations as separate issues. - [ ] Validate container image, Docker Compose, and experimental Kubernetes behavior after Java 21 changes. - [ ] Make an explicit final decision about retiring Java 8 compatibility. ## Non-goals - Do not create one catch-all implementation issue for the whole Java 21 upgrade. - Do not rewrite collector behavior while modernizing language/runtime constructs. - Do not rename or remove the existing Docker Compose service path or container image path. - Do not promote `k8s-manifests/` from experimental deployment guidance to production guidance as part of this epic. ## Dependencies - Project: `gitlab-da/demo-environments/tanuki-iot-platform/sensors/java-http-metrics-collector` - Existing group description templates project: `gitlab-da/demo-environments/tanuki-iot-platform/templates` - Current CI jobs, Dockerfile, Compose stack, README, tests, and `k8s-manifests/` must remain understandable throughout the migration. ## Acceptance criteria - [ ] Current Java 8 behavior is documented before modernization begins. - [ ] CI shows Java 8 and Java 21 build/test status during the transition. - [ ] Java 21 runtime path works without breaking existing Compose and container workflows. - [ ] Language modernization is split into separate implementation issues. - [ ] `metric_sample` output, startup logs, config behavior, Tanuki API export, Prometheus export, Compose, and experimental Kubernetes docs remain understandable. - [ ] A final decision issue explicitly retires or retains Java 8 compatibility. - [ ] Required issues are linked. - [ ] Dependencies are tracked. - [ ] Documentation impact is understood.
epic