Class SynchronousBase

java.lang.Object
com.moesif.api.controllers.syncwrapper.SynchronousBase
Direct Known Subclasses:
APICallBackCatcher

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

    • 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 Details

    • markAsDone

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

      public void await() throws InterruptedException
      Wait until all tasks are marked as done
      Throws:
      InterruptedException - error waiting for tasks to complete
    • 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