public final class ThreadPool
extends java.lang.Thread
Modifier and Type | Method and Description |
---|---|
static void |
addPurifier(ThreadPurifier purifier)
add a thread purifier
|
static java.lang.String |
getName(java.lang.Runnable runner)
What is the scheduled runner current name ?
|
static java.lang.String |
getStats()
get the stats
|
static boolean |
isAlive(java.lang.Runnable runner)
is the scheduled runner alive ?
|
static boolean |
purify()
Purify the thread before placing back in the pool
|
static void |
recordState()
record the state of the thread before we start.
|
void |
run()
run the scheduled runner.
|
static void |
schedule(java.lang.Runnable runner)
schedule a runner.
|
static void |
schedule(java.lang.Runnable runner,
java.lang.String name)
schedule a runner.
|
static boolean |
threadsAvailable()
make sure we have a thread to run our task
|
static void |
waitFor(java.lang.Runnable runner)
Wait for a scheduled runner.
|
static void |
waitFor(java.lang.Runnable runner,
long timeout)
Wait for a scheduled runner.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static void schedule(@Nonnull java.lang.Runnable runner)
runner
- the runner to be scheduled@CheckReturnValue public static boolean threadsAvailable()
public static void schedule(@Nonnull java.lang.Runnable runner, java.lang.String name)
runner
- the runner to be scheduledname
- the name of the thread to be scheduledpublic static void waitFor(@Nonnull java.lang.Runnable runner)
runner
- the runner to wait for.public static void waitFor(@Nonnull java.lang.Runnable runner, long timeout)
runner
- the runner to wait for.timeout
- the maximum time to wait in milliseconds.@CheckReturnValue public static boolean isAlive(@Nonnull java.lang.Runnable runner)
runner
- the runner to check@CheckReturnValue public static java.lang.String getName(@Nonnull java.lang.Runnable runner)
runner
- the runner to checkpublic static void recordState()
public static void addPurifier(@Nonnull ThreadPurifier purifier)
purifier
- a purifier to be called.public static boolean purify()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
@CheckReturnValue @Nonnull public static java.lang.String getStats()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.