I am using spring scheduler using @Scheduled annotation to schedule a job that runs a file generation service. The application is deployed on 5 separate nodes of tomcat in clustered environment for load balancing and fail over. Because of this, service is scheduled 5 times which is never expected. Is there a way to configure the scheduler to be run only on the current node?
There is an approach that uses database to figure out the current alive node and invoking the scheduler for that particular instance here
Another approach is to use quartz scheduler
Since I could not make major changes to the deployed application, is there a simple solution to the issue? Please advise.