@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; }