Module de.carne
Package de.carne.util

Class Threads


  • public final class Threads
    extends java.lang.Object
    Utility class providing Thread related functions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkInterrupted()
      Checks whether the current Thread has been interrupted.
      static java.lang.ClassLoader getContextClassLoader()
      Gets the context ClassLoader of the current Thread or the system ClassLoader if none is set.
      static boolean sleep​(long millis)
      Causes the current Thread to sleep.
      • Methods inherited from class java.lang.Object

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

      • checkInterrupted

        public static void checkInterrupted()
                                     throws java.lang.InterruptedException
        Checks whether the current Thread has been interrupted.
        Throws:
        java.lang.InterruptedException - if the current Thread has been interrupted.
      • sleep

        public static boolean sleep​(long millis)
        Causes the current Thread to sleep.

        In addition to Thread.sleep(long) this function automatically handles possible InterruptedExceptions by handling and discarding the exception.

        Parameters:
        millis - the sleep timeout.
        Returns:
        true if the sleep operation was not interrupted.
        See Also:
        Thread.sleep(long)
      • getContextClassLoader

        public static java.lang.ClassLoader getContextClassLoader()
        Gets the context ClassLoader of the current Thread or the system ClassLoader if none is set.
        Returns:
        the context ClassLoader of the current Thread or the system ClassLoader if none is set.