Class ThreadUtil


  • public class ThreadUtil
    extends java.lang.Object
    • Nested Class Summary

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

      Constructors 
      Constructor Description
      ThreadUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean join​(java.lang.Thread thread, int millis)
      simple join wrapper that catches its exception
      static void notify​(java.lang.Object mutex)
      simple notify that catches any and all exceptions
      static void notifyAll​(java.lang.Object mutex)
      simple notify that catches any and all exceptions
      static boolean sleep​(int millis)
      simple sleep wrapper that catches its exception
      static boolean wait​(java.lang.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 Detail

      • ThreadUtil

        public ThreadUtil()
    • Method Detail

      • 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​(java.lang.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​(java.lang.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​(java.lang.Object mutex)
        simple notify that catches any and all exceptions
        Parameters:
        mutex - the mutex to notify
      • notify

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