Class JobPool

java.lang.Object
ch.nolix.base.programcontrol.jobpool.JobPool

public final class JobPool extends Object
A JobPool runs jobs in the background. A JobPool uses an optimal number of Workers to run several jobs efficiently.
Author:
Silvan Wyss
  • Constructor Details

    • JobPool

      public JobPool()
  • Method Details

    • enqueue

      public IFuture enqueue(Runnable job)
      Enqueues the given job to the current JobPool.
      Parameters:
      job -
      Returns:
      a IFuture for the given job.
      Throws:
      RuntimeException - if the given job is null.
    • containsWaitingJobs

      public boolean containsWaitingJobs()
      Returns:
      true if the current JobPool contains waiting jobs, false otherwise.
    • isIdle

      public boolean isIdle()
      Returns:
      true if the current JobPool is idle, false otherwise.