First of all, do you really need a wait loop? You can usually solve your problems using the correct notifications, that is, have an object, call wait () and notify () on it or other means (for example, a blocking queue or Semaphore.acquire () in your case).
However, if you really need a polling cycle (which you really don't need to do if you don't need it), I would stick with Thread.sleep (). There is not much there, as the documentation says, except that you have the option to abort Thread.sleep (). Do not get rid of the opportunity to do this.
Note that in the case of Thread.sleep (), you will have to catch this exception - if you are very lazy, you will probably stick with SystemClock.sleep ().
EboMike
source share