In my spring mvc application. I am scheduling a job using scheduledExecutorService.
here is code :
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5);
SimpleJob simpleJob = new SimpleJob(guid);
ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(simpleJob,
Calendar.getInstance().getTimeInMillis() - calendar.getTimeInMillis()
Take for example that above a job is scheduled after 1000000 milliseconds.
Now it may happen that my web application gets a http request saying that reschdule the job for some guid
to 2000 milliseconds.
guid is a string i am passing above in the job which identifies a particular job.
Now if the job is already running or has run... i can ignore the request of recheduling.
But suppose it has yet to run.. In that case i want to rechdule it...
How to do it ?