Sleep
by Frank Kim on Feb.26, 2009, under Java SE
I always forget how to sleep or wait in Java though it’s quite easy, just use the static method Thread.sleep.
For example:
// sleep the filter's wait interval
try {
Thread.sleep(filter.getWaitInterval() * 1000);
}
catch (InterruptedException exc) {
logger.error("unexpected interrupt", exc);
}
Sun has a tutorial calling Pausing Execution with Sleep.
Related posts: