Class ConcurrentExecutionTracker

java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.util.ConcurrentExecutionTracker

@Dependent public class ConcurrentExecutionTracker extends Object
Utility bean to track the number of concurrent executions of a method

The method being tracked needs to call executionStarted() when it starts and executionEnded() when it's about to end.

 try {
     tracker.executionStarted();
     // whatever the method is meant to do
 }
 finally {
     tracker.executionEnded()
 }
 

Another method can then call waitForRunningExecutions(int) to wait for the expected number of executions to start.

  • Constructor Details

    • ConcurrentExecutionTracker

      public ConcurrentExecutionTracker()
  • Method Details

    • waitForRunningExecutions

      public void waitForRunningExecutions(int executions)
      Wait for the given number of method executions to be running

      This method will wait three seconds before returning an exception

      Parameters:
      executions - number of executions
    • executionStarted

      public void executionStarted()
    • executionEnded

      public void executionEnded()