Class DaemonExecutors
java.lang.Object
ActiverseUtils.DaemonExecutors
Shared factory for daemon
ExecutorServices so game code does not repeat thread boilerplate.-
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorServicenewFixedDaemonThreadPool(int nThreads, String threadName) Creates a fixed-size daemon thread pool.static ExecutorServicenewSingleDaemonThreadExecutor(String threadName) Creates a single-thread daemon executor.
-
Method Details
-
newSingleDaemonThreadExecutor
Creates a single-thread daemon executor.Daemon threads do not prevent JVM shutdown, which is useful for background save/flush tasks during game exit.
- Parameters:
threadName- Thread name to assign- Returns:
- Single-thread daemon executor
-
newFixedDaemonThreadPool
Creates a fixed-size daemon thread pool.- Parameters:
nThreads- Number of worker threadsthreadName- Base thread name- Returns:
- Fixed daemon thread pool
-