Class SynchronousBase

  • Direct Known Subclasses:
    APICallBackCatcher

    public class SynchronousBase
    extends Object
    Base class to help convert an asynchronous callback to synchronous one
    • Constructor Detail

      • SynchronousBase

        public SynchronousBase​(int count)
        Initiate class with a task count
        Parameters:
        count - Number of tasks we will wait on
      • SynchronousBase

        public SynchronousBase()
        Initiate class with a count down of one only
    • Method Detail

      • markAsDone

        protected void markAsDone()
        Mark as done one task
      • await

        public boolean await​(long timeout,
                             TimeUnit unit)
                      throws InterruptedException
        Wait until all tasks are marked as done or timeout after given time
        Parameters:
        timeout - Time to wait
        unit - Unit for time
        Returns:
        true if done
        Throws:
        InterruptedException - error waiting for tasks to complete