List of utility methods to do Thread Pause
void | pause(final int msec) A basic sleep where you don't care about the interrupted exception. if (msec > 0) { try { Thread.sleep(msec); } catch (final InterruptedException e) { |
void | pause() pauses a thread pause(300); |
void | pause(double seconds) pause if (seconds <= 0) return; long sleepT, waitUntil = System.currentTimeMillis() + Math.round(seconds * 1000.0); do { sleepT = waitUntil - System.currentTimeMillis(); if (sleepT > 0) { try { Thread.sleep(sleepT); ... |
void | pause(double seconds) pause if (seconds <= 0) return; try { Thread.sleep(Math.round(seconds * 1000.0)); } catch (InterruptedException e) { throw new RuntimeException(e); |
void | pause(double timeInSec) pause long start = System.currentTimeMillis(); while (System.currentTimeMillis() < (start + (timeInSec * 1000))) { |
void | pause(final long time) Causes the executing thread to pause for a period of time. final long startTime = System.currentTimeMillis(); do { try { final long sleepTime = time - (System.currentTimeMillis() - startTime); Thread.sleep(sleepTime > 0 ? sleepTime : 10); } catch (InterruptedException e) { } while ((System.currentTimeMillis() - startTime) < time); ... |
void | pause(int i, String unit) pause try { switch (unit) { case "ms": Thread.sleep(i); break; case "s": Thread.sleep(i * 1000); break; ... |
void | pause(int millis) sleeps for millis milliseconds, approximately. try { Thread.sleep(millis); } catch (InterruptedException ie) { |
boolean | pause(int millis) Puts the the thread to sleep try { Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); return false; return true; |
void | pause(int milliseconds) pause try { Thread.sleep(milliseconds); } catch (InterruptedException e) { e.printStackTrace(); |