Currently, each HealthCheck instance uses its own ScheduledExecutorService for scheduling (via scheduleAtFixedRate) and a separate executor (Executors.newCachedThreadPool()) for running the actual health check tasks.
That works but we might save some resources by sharing the scheduler among all HealthChecks
Enhancement idea:
Consider introducing a shared scheduler and/or executor service across all HealthCheck instances:
- Single shared
ScheduledExecutorService: schedule health checks for all endpoints, reducing thread footprint.
- Shared worker executor pool: power the health check logic from a common pool, avoiding too many cached pools.