Documentation of 'edu.jas.util.ThreadPool' Java class
ThreadPool
edu.jas.util

Class ThreadPool



  • public class ThreadPool
    extends java.lang.Object
    Thread pool using stack / list workpile.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ThreadPool()
      Constructs a new ThreadPool with strategy StrategyEnumeration.FIFO and size DEFAULT_SIZE.
      ThreadPool(int size)
      Constructs a new ThreadPool with strategy StrategyEnumeration.FIFO.
      ThreadPool(StrategyEnumeration strategy)
      Constructs a new ThreadPool with size DEFAULT_SIZE.
      ThreadPool(StrategyEnumeration strategy, int size)
      Constructs a new ThreadPool.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addJob(java.lang.Runnable job)
      adds a job to the workpile.
      int cancel()
      Cancels the threads.
      int getNumber()
      number of worker threads.
      StrategyEnumeration getStrategy()
      get used strategy.
      boolean hasJobs()
      check if there are jobs for processing.
      boolean hasJobs(int n)
      check if there are more than n jobs for processing.
      void init()
      thread initialization and start.
      void terminate()
      Terminates the threads.
      java.lang.String toString()
      toString.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ThreadPool

        public ThreadPool()
        Constructs a new ThreadPool with strategy StrategyEnumeration.FIFO and size DEFAULT_SIZE.
      • ThreadPool

        public ThreadPool(StrategyEnumeration strategy)
        Constructs a new ThreadPool with size DEFAULT_SIZE.
        Parameters:
        strategy - for job processing.
      • ThreadPool

        public ThreadPool(int size)
        Constructs a new ThreadPool with strategy StrategyEnumeration.FIFO.
        Parameters:
        size - of the pool.
      • ThreadPool

        public ThreadPool(StrategyEnumeration strategy,
                          int size)
        Constructs a new ThreadPool.
        Parameters:
        strategy - for job processing.
        size - of the pool.
    • Method Detail

      • init

        public void init()
        thread initialization and start.
      • toString

        public java.lang.String toString()
        toString.
        Overrides:
        toString in class java.lang.Object
      • getNumber

        public int getNumber()
        number of worker threads.
      • terminate

        public void terminate()
        Terminates the threads.
      • cancel

        public int cancel()
        Cancels the threads.
      • addJob

        public void addJob(java.lang.Runnable job)
        adds a job to the workpile.
        Parameters:
        job -
      • hasJobs

        public boolean hasJobs()
        check if there are jobs for processing.
      • hasJobs

        public boolean hasJobs(int n)
        check if there are more than n jobs for processing.
        Parameters:
        n - Integer
        Returns:
        true, if there are possibly more than n jobs.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.