intermediateScheduling with @Scheduled
If you deploy 3 replicas of a service with a nightly @Scheduled job, how many times does it actually run?
Three times — once per instance, independently — since @Scheduled has no built-in cluster coordination. Running a job exactly once across a cluster requires a distributed lock (via Redis or a database row) or a dedicated clustered scheduler like Quartz.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response