Class DaemonExecutors

java.lang.Object
ActiverseUtils.DaemonExecutors

public final class DaemonExecutors extends Object
Shared factory for daemon ExecutorServices so game code does not repeat thread boilerplate.
  • Method Details

    • newSingleDaemonThreadExecutor

      public static ExecutorService newSingleDaemonThreadExecutor(String threadName)
      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

      public static ExecutorService newFixedDaemonThreadPool(int nThreads, String threadName)
      Creates a fixed-size daemon thread pool.
      Parameters:
      nThreads - Number of worker threads
      threadName - Base thread name
      Returns:
      Fixed daemon thread pool