Package arc.util
Class Threads
java.lang.Object
arc.util.Threads
Utilities for threaded programming.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
await
(ExecutorService exec) Shuts down the executor and waits for its termination indefinitely.static <T> T
static void
static ExecutorService
boundedExecutor
(String name, int max) static Thread
Starts a new daemon thread.static Thread
Starts a new daemon thread.static ExecutorService
executor()
static ExecutorService
executor
(int threads) static ExecutorService
static ExecutorService
static <T> ThreadLocal<T>
static void
sleep
(long ms) static void
sleep
(long ms, int ns) static Thread
Starts a new non-daemon thread.static Thread
Starts a new non-daemon thread.static void
Throws an exception in the main game thread.static ExecutorService
static ExecutorService
unboundedExecutor
(String name) static ExecutorService
unboundedExecutor
(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.
-