@InterfaceStability.Evolving public class ThreadUtil extends Object
| Constructor and Description |
|---|
ThreadUtil() |
| Modifier and Type | Method and Description |
|---|---|
static InputStream |
getResourceAsStream(ClassLoader cl,
String resourceName)
Convenience method that returns a resource as inputstream from the
classpath using given classloader.
|
static InputStream |
getResourceAsStream(String resourceName)
Convenience method that returns a resource as inputstream from the
classpath.
|
static void |
joinUninterruptibly(Thread toJoin)
Join a thread as uninterruptible.
|
static void |
sleepAtLeastIgnoreInterrupts(long millis)
Cause the current thread to sleep as close as possible to the provided
number of milliseconds.
|
public static void sleepAtLeastIgnoreInterrupts(long millis)
InterruptedException encountered.millis - the number of milliseconds for the current thread to sleeppublic static void joinUninterruptibly(Thread toJoin)
InterruptedException then will re-interrupt
the thread.toJoin - the thread to Join on.public static InputStream getResourceAsStream(String resourceName) throws IOException
Uses the Thread's context classloader to load resource.
resourceName - resource to retrieve.IOException - thrown if resource cannot be loadedpublic static InputStream getResourceAsStream(ClassLoader cl, String resourceName) throws IOException
cl - ClassLoader to be used to retrieve resource.resourceName - resource to retrieve.IOException - thrown if resource cannot be loadedCopyright © 2008–2022 Apache Software Foundation. All rights reserved.