Refactored batch tests to use CountDownLatch instead of boolean static variables to monitor execution.