Closed muhdkhokhar closed 5 years ago
I have a job to run every 5 seconds but I want to wait for it finish before going next run
public class CustomJob implements Runnable {
private JobVO jobVO; public CustomJob(JobVO jobVO) { this.jobVO = jobVO; } public void run() { System.out.println("Job is running..." + jobVO.getName()); try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } }
}
It ignore thread.sleep and run again.
Are you sure the job is not finished before it is scheduled again? I am almost sure there is a unit test about that.
I am so sorry. Its working fine. It was my mistake.
No problem, thank you for your check :)
I have a job to run every 5 seconds but I want to wait for it finish before going next run
public class CustomJob implements Runnable {
}
It ignore thread.sleep and run again.