Class ThreadUtils

java.lang.Object
overit.geocall.util.ThreadUtils

public class ThreadUtils extends Object
Collection of static utilities for managing threads.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Exception thrown if a request of interruption is sended to a Thread that has called fairSleep(long)
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    fairSleep(long millis)
    Causes the currently executing thread to sleep for the specified number of milliseconds.
    static void
    sleep(long millis)
    Causes the currently executing thread to sleep for the specified number of milliseconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sleep

      public static void sleep(long millis)
      Causes the currently executing thread to sleep for the specified number of milliseconds. The thread does not lose ownership of any monitors. In the case that an interruption is asked to the current thread, it exits immediatly leaving the interrupted flag to true.
      Parameters:
      millis - The length of time to sleep in milliseconds
    • fairSleep

      public static void fairSleep(long millis)
      Causes the currently executing thread to sleep for the specified number of milliseconds. The thread does not lose ownership of any monitors. In the case that an interruption is asked to the current thread, it immediatly throws a runtime ThreadUtils.BreakException leaving the interrupted flag to true.
      Parameters:
      millis - The length of time to sleep in milliseconds