Coreoz / Wisp

A simple Java Scheduler library with a minimal footprint and a straightforward API
Apache License 2.0
133 stars 23 forks source link

Wait for job to complete #3

Closed muhdkhokhar closed 5 years ago

muhdkhokhar commented 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.

amanteaux commented 5 years ago

Are you sure the job is not finished before it is scheduled again? I am almost sure there is a unit test about that.

muhdkhokhar commented 5 years ago

I am so sorry. Its working fine. It was my mistake.

amanteaux commented 5 years ago

No problem, thank you for your check :)