Class TestNGFutureTask<T>

  • All Implemented Interfaces:
    java.lang.Comparable<IWorker<T>>, java.lang.Runnable, java.util.concurrent.Future<IWorker<T>>, java.util.concurrent.RunnableFuture<IWorker<T>>, IWorker<T>

    public class TestNGFutureTask<T>
    extends java.util.concurrent.FutureTask<IWorker<T>>
    implements IWorker<T>
    • Constructor Detail

      • TestNGFutureTask

        public TestNGFutureTask​(IWorker<T> worker,
                                java.util.function.BiConsumer<IWorker<T>,​java.lang.Throwable> callback)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Specified by:
        run in interface java.util.concurrent.RunnableFuture<T>
        Overrides:
        run in class java.util.concurrent.FutureTask<IWorker<T>>
      • done

        protected void done()
        Overrides:
        done in class java.util.concurrent.FutureTask<IWorker<T>>
      • getTasks

        public java.util.List<T> getTasks()
        Specified by:
        getTasks in interface IWorker<T>
        Returns:
        list of tasks this worker is working on.
      • getTimeOut

        public long getTimeOut()
        Specified by:
        getTimeOut in interface IWorker<T>
        Returns:
        the maximum time allowed for the worker to complete the task.
      • getPriority

        public int getPriority()
        Specified by:
        getPriority in interface IWorker<T>
        Returns:
        the priority of this task.
      • compareTo

        public int compareTo​(IWorker<T> o)
        Specified by:
        compareTo in interface java.lang.Comparable<T>