MCPcopy Create free account
hub / github.com/traneio/future / get

Method get

future-java/src/main/java/io/trane/future/Promise.java:399–411  ·  view source on GitHub ↗
(final Duration timeout)

Source from the content-addressed store, hash-verified

397 }
398
399 @SuppressWarnings("unchecked")
400 @Override
401 public final T get(final Duration timeout) throws CheckedFutureException {
402 final Object curr = state;
403 if (curr instanceof Future && !(curr instanceof Continuation) && ((Future<T>) curr).isDefined())
404 return ((Future<T>) curr).get(Duration.ZERO);
405 else if (curr instanceof LinkedContinuation && ((LinkedContinuation<?, T>) curr).isDefined())
406 return ((LinkedContinuation<?, T>) curr).get(Duration.ZERO);
407 else {
408 join(timeout);
409 return ((Future<T>) state).get(Duration.ZERO);
410 }
411 }
412
413 // Inpired by Scala Future's CompletionLatch
414 private static final class ReleaseOnRunLatch extends AbstractQueuedSynchronizer implements Runnable {

Callers

nothing calls this directly

Calls 3

joinMethod · 0.95
isDefinedMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected