Class ThreadUtil

java.lang.Object
org.cip4.jdflib.util.ThreadUtil

public class ThreadUtil extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Deprecated.
    use org.cip4.jdflib.util.thread.MyMutex
    static class 
    Deprecated.
    use the local class
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    join(Thread thread, int millis)
    simple join wrapper that catches its exception
    static void
    notify(Object mutex)
    simple notify that catches any and all exceptions
    static void
    simple notify that catches any and all exceptions
    static boolean
    sleep(int millis)
    simple sleep wrapper that catches its exception
    static boolean
    wait(Object mutex, int millis)
    simple wait wrapper that synchronizes catches its exception

    Methods inherited from class java.lang.Object

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

    • ThreadUtil

      public ThreadUtil()
  • Method Details

    • sleep

      public static boolean sleep(int millis)
      simple sleep wrapper that catches its exception
      Parameters:
      millis -
      Returns:
      true if normal exit, false if interupted
    • join

      public static boolean join(Thread thread, int millis)
      simple join wrapper that catches its exception
      Parameters:
      thread - the thread to join
      millis -
      Returns:
      true if normal exit, false if interupted
    • wait

      public static boolean wait(Object mutex, int millis)
      simple wait wrapper that synchronizes catches its exception
      Parameters:
      mutex - the object that will wait, if null we assume we need not wait
      millis - milliseconds to wait, 0 or lower: indefinite wait
      Returns:
      true if normal exit, false if interupted or mutex is null
    • notifyAll

      public static void notifyAll(Object mutex)
      simple notify that catches any and all exceptions
      Parameters:
      mutex - the mutex to notify
    • notify

      public static void notify(Object mutex)
      simple notify that catches any and all exceptions
      Parameters:
      mutex - the mutex to notify