The ScheduledExecutorService can create a single-threaded executor that can schedule commands to run after a given delay, or to execute periodically,which should work for you and the overhead is tiny.
ScheduledExecutorService executor= Executors.newSingleThreadScheduledExecutor;
//do your work evry 30 seconds,and you could define the delayed time to start
executor.scheduleAtFixedRate(new CustomeTask(), YOUR_DELAY_TIME, 30, TimeUnit.SECONDS);
private static class CustomeTaskimplements Runnable {
@Override
public void run() {
//Do any work you want
}
}
If you do not want to use the Executors. You may do something like Thread.sleep(30000); in the while(true) loop in your method of Run()
to achieve that.