Class FutureFinishChecker


  • public class FutureFinishChecker
    extends java.lang.Object
    Allows monitoring a number of tasks (futures) and get a notification when set to finished (no more new tasks) and all tasks have been processed (futures notified).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected IResultListener delegate
      The delegate to be notified.
      protected boolean finished
      Flag, if set to finished (no more tasks allowed and notfication when all tasks finished).
      protected boolean notified
      Flag to remember that delegate was notified.
      protected java.util.List tasks
      The list of future tasks to observe.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTask​(Future future)
      Add a task.
      void check()
      Check if completed.
      void finished()
      Set to finished.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        protected IResultListener delegate
        The delegate to be notified.
      • tasks

        protected java.util.List tasks
        The list of future tasks to observe.
      • finished

        protected boolean finished
        Flag, if set to finished (no more tasks allowed and notfication when all tasks finished).
      • notified

        protected boolean notified
        Flag to remember that delegate was notified.
    • Constructor Detail

      • FutureFinishChecker

        public FutureFinishChecker​(IResultListener delegate)
        Create a new checker.
    • Method Detail

      • addTask

        public void addTask​(Future future)
        Add a task.
      • finished

        public void finished()
        Set to finished.
      • check

        public void check()
        Check if completed.