Package arc.util
Class Threads
java.lang.Object
arc.util.Threads
Utilities for threaded programming.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidawait(ExecutorService exec) Shuts down the executor and waits for its termination indefinitely.static <T> Tstatic voidstatic ExecutorServiceboundedExecutor(String name, int max) static ThreadStarts a new daemon thread.static ThreadStarts a new daemon thread.static ExecutorServiceexecutor()static ExecutorServiceexecutor(int threads) static ExecutorServicestatic ExecutorServicestatic <T> ThreadLocal<T>static voidsleep(long ms) static voidsleep(long ms, int ns) static ThreadStarts a new non-daemon thread.static ThreadStarts a new non-daemon thread.static voidThrows an exception in the main game thread.static ExecutorServicestatic ExecutorServiceunboundedExecutor(String name) static ExecutorServiceunboundedExecutor(String name, int min)
-
Constructor Details
-
Threads
public Threads()
-
-
Method Details
-
local
-
await
-
awaitAll
-
executor
- Returns:
- an executor with a fixed number of threads which do not expire
-
executor
- Returns:
- an executor with a fixed number of threads which do not expire
-
executor
- See Also:
-
executor
- See Also:
-
unboundedExecutor
- Parameters:
min- the number of threads to keep alive at all times after they are first started- Returns:
- an executor with no max thread count. threads expire after 1 minute of inactivity
-
unboundedExecutor
- See Also:
-
unboundedExecutor
- See Also:
-
boundedExecutor
- Parameters:
max- maximum number of threads to create- Returns:
- an executor with a max thread count. threads expire after 1 minute of inactivity
-
await
Shuts down the executor and waits for its termination indefinitely. -
sleep
public static void sleep(long ms) -
sleep
public static void sleep(long ms, int ns) -
throwAppException
Throws an exception in the main game thread. -
thread
Starts a new non-daemon thread. -
thread
Starts a new non-daemon thread. -
daemon
Starts a new daemon thread. -
daemon
Starts a new daemon thread.
-