accumulo icon indicating copy to clipboard operation
accumulo copied to clipboard

Add waitFor method in core. Relocate UtilWaitThread.sleep

Open EdColeman opened this issue 2 years ago • 1 comments

The test module has a convenient Wait.waitFor that could be used generally, however, that code allows for a scaling factor to allow for variations in test environments. This PR replicates that functionality for general use outside of the test module.

Rather that static methods, this uses fluent-style builder that can be concise while providing customization. It also has a signature different from the test waitFor methods to avoid confusion which wait is being used.

This also relocates the sleep method from UtilWaitThread and deletes that class. The original intent of UtilWaitThread class was to hold guava sleepUninterruptibly code that had been marked as beta at one time. Using the guava provided sleepUninterruptibly was completed in a previous PR. The relocated sleep also reestablishes the interrupt flag that can be used by callers to determine if in interrupt occurred.

EdColeman avatar Nov 30 '23 20:11 EdColeman

It is currently unused because I was waiting for some version to get approved so that I could move forward. There are other PRs that I have open where it was suggested that I use Wait.waitFor - which seemed like an improvement, so I started down this path instead.

I didn't think that the other PR changes needed to be bundled into this issue.

EdColeman avatar Dec 01 '23 19:12 EdColeman