Class Executer

    • Constructor Summary

      Constructors

      Constructor and Description
      Executer(int capacity, int threadNumber)
      Create a new executer with a blocking queue of size capacity and threadNumber threads in the thread-pool for execution.
    • Constructor Detail

      • Executer

        public Executer(int capacity,
                        int threadNumber)
        Create a new executer with a blocking queue of size capacity and threadNumber threads in the thread-pool for execution. Use queue to add Tasks and finish to let the executer die after everything has been executed. Use join to join to the time when everything's actually finished.
        Parameters:
        capacity - the number of places in the queue.
        threadNumber - the number of threads to use in the thread-pool.
    • Method Detail

      • queue

        public void queue(Runnable task)
        Parameters:
        task - the task to queue
      • finish

        public void finish()
        after a call of this, all threads are going to finish after their execution.
      • cancel

        public void cancel()
        Cancel the execution. i.e. clear the queue of queued tasks and let each thread finish at the next possible point in time.
      • pauseOrResume

        public void pauseOrResume()
        Pause / Resume the execution
      • join

        public void join()
        Join on finished all tasks.
      • run

        public void run()