Klasse ExecutorsUtils

java.lang.Object
ch.framedev.simplejavautils.ExecutorsUtils

public class ExecutorsUtils extends Object
  • Konstruktordetails

    • ExecutorsUtils

      public ExecutorsUtils()
  • Methodendetails

    • createScheduledThreadPool

      public ScheduledExecutorService createScheduledThreadPool(int threads, Runnable runnable, int delay, int period, TimeUnit timeUnit)
      Creates a new scheduled thread pool with the given number of threads.
      Parameter:
      threads - Number of threads in the pool.
      runnable - Task to execute.
      delay - Initial delay before execution starts.
      period - Interval between executions.
      timeUnit - Time unit for delay and period.
      Gibt zurück:
      A new ScheduledExecutorService.
    • createSingleThreadScheduledExecutor

      public ScheduledExecutorService createSingleThreadScheduledExecutor(Runnable runnable, int delay, int period, TimeUnit timeUnit)
      Creates a new single-threaded scheduled executor.
      Parameter:
      runnable - Task to execute.
      delay - Initial delay before execution starts.
      period - Interval between executions.
      timeUnit - Time unit for delay and period.
      Gibt zurück:
      A new ScheduledExecutorService.
    • shutdown

      public void shutdown()
      Shuts down the executor service gracefully.
    • shutdownNow

      public void shutdownNow()
      Shuts down the executor service immediately.
    • isRunning

      public boolean isRunning()
      Checks if the executor service is running.
      Gibt zurück:
      true if running, false otherwise.