While designing and implementing a test that has to wait for multiple sequential asynchronous steps to occur, it became apparent that JXM is a very good solution to sleeps in tests to avoid the flakey and long running test problem. It not only provides an alternative means of communication both into and out of the system, but it also provides event notification. This solution will work nicely for both integration and acceptance tests. After the test code executes whatever is necessary to cause asynchronous executions, it can go into a timeout loop waiting for completion events via JMX. Upon receiving the appropriate events and/or inspecting appropriate state following those events, the test should immediately proceed with any queries and assertions. The JMX solution involves creating a JMX MBean interface for the threads and registering them during thread startup initialization. The threads will increment counters indicating particular actions and fire appropriate events. The test ...