List of utility methods to do Sleep
boolean | sleep(long time) Sleep the specified number of milliseconds. if (time <= 0) return true; try { Thread.sleep(time); return true; } catch (Exception ex) { return false; ... |
void | sleep(long timeToSleep) Sleep and wake on InterruptedException if (timeToSleep <= 0) return; try { Thread.sleep(timeToSleep); } catch (InterruptedException e) { |
void | sleep4Subscription() sleep Subscription try { Thread.currentThread().sleep(1000l); } catch (Exception ignore) { |
void | sleep_force(long timeToSleep) Sleep and ignore InterruptedException Goto sleep again if wake 1ms ealier if (timeToSleep <= 0) return; long target = System.currentTimeMillis() + timeToSleep; while (true) try { Thread.sleep(timeToSleep); timeToSleep = target - System.currentTimeMillis(); if (timeToSleep < 2) ... |
void | sleepABit(long millis) sleep A Bit try { Thread.sleep(millis); } catch (InterruptedException e) { |
long | sleepABitMore() sleep A Bit More long before = System.currentTimeMillis(); Thread.sleep(100); return System.currentTimeMillis() - before; |
void | sleepAfterListItems() sleep After List Items try { Thread.sleep(2000); } catch (InterruptedException e1) { e1.printStackTrace(); |
void | sleepAndIgnoreInterrupts(int millis) Sets the current thread to sleep. try { Thread.sleep(millis); } catch (InterruptedException e1) { |
void | sleepAtLeast(long milliseconds) Make the current thread sleep at least some time, do not care about the exception. long in = System.currentTimeMillis(), t = 0; do { sleep(milliseconds - t); t = System.currentTimeMillis() - in; } while (t < milliseconds); |
void | sleepAtLeast(long milliseconds) Sleep for a specified duration in milliseconds. long endTime = System.currentTimeMillis() + milliseconds; while (System.currentTimeMillis() <= endTime) { try { Thread.sleep(milliseconds); } catch (InterruptedException e) { |