betweenGo

Sleep

by 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.

Share

Related posts:

  1. Encode URI
  2. How to schedule tasks or perform tasks repeatedly
  3. Unit Test for Threaded Logging
  4. ServletException root cause
  5. Accessing the class from a static method which the class owns

:

Leave a Reply

 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!