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.

Leave a Reply

Your email address will not be published. Required fields are marked *