private void waitFor(long timeoutInMillis) { try { Thread.sleep(sleepFor()); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } }
private void waitFor(long timeoutInMillis) { try { Thread.sleep(sleepFor()); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } }
@Override @SuppressWarnings("unchecked") public T get() { try { isLoaded(); return (T) this; } catch (Error e) { load(); } long end = clock.laterBy(SECONDS.toMillis(timeOutInSeconds)); while (clock.isNowBefore(end)) { try { isLoaded(); return (T) this; } catch (Error e) { // Not a problem, we could still be loading } isError(); waitFor(sleepFor()); } isLoaded(); return (T) this; }
@Override @SuppressWarnings("unchecked") public T get() { try { isLoaded(); return (T) this; } catch (Error e) { load(); } long end = clock.laterBy(SECONDS.toMillis(timeOutInSeconds)); while (clock.isNowBefore(end)) { try { isLoaded(); return (T) this; } catch (Error e) { // Not a problem, we could still be loading } isError(); waitFor(sleepFor()); } isLoaded(); return (T) this; }