@Test void get() throws ExecutionException, InterruptedException { final GenericCommand<String> command = new GenericCommand<>(() -> "end"); command.run(); final String s1 = command.get(); final String s2 = command.get(); Assertions.assertNotNull(s1); Assertions.assertEquals(s1, s2); }
@Override public R get() throws InterruptedException, ExecutionException { if (executionEndTime != null) { if (resultException != null) { throw new ExecutionException(resultException); } return result; } else { resultBlocker.await(); if (resultException != null) { throw new ExecutionException(resultException); } return result; } }
AbstractCanonCommand implements CanonCommand<R>, TargetRefCommand<R> { @Override public R get() throws InterruptedException, ExecutionException { if (executionEndTime != null) { if (resultException != null) { throw new ExecutionException(resultException); } return result; } else { resultBlocker.await(); if (resultException != null) { throw new ExecutionException(resultException); } return result; } } }
AbstractCanonCommand implements CanonCommand<R>, TargetRefCommand<R> { @Override public R get() throws InterruptedException, ExecutionException { if (executionEndTime != null) { if (resultException != null) { throw new ExecutionException(resultException); } return result; } else { resultBlocker.await(); if (resultException != null) { throw new ExecutionException(resultException); } return result; } } protected  AbstractCanonCommand(); protected  AbstractCanonCommand(final AbstractCanonCommand<R> toCopy); }
AbstractCanonCommand implements CanonCommand<R>, TargetRefCommand<R> { @Override public R get() throws InterruptedException, ExecutionException { if (executionEndTime != null) { if (resultException != null) { throw new ExecutionException(resultException); } return result; } else { resultBlocker.await(); if (resultException != null) { throw new ExecutionException(resultException); } return result; } } protected  AbstractCanonCommand(); protected  AbstractCanonCommand(final AbstractCanonCommand<R> toCopy); @SuppressWarnings("unchecked") @Override AbstractCanonCommand<R> copy(); @Override final void run(); @Override CanonCommand<R> setTargetRef(final EdsBaseRef targetRef); final Optional<EdsBaseRef> getTargetRef(); @Override TargetRefType getTargetRefType(); @Override Instant getCreateTime(); @Override Instant getExecutionStartTime(); @Override boolean hasExecutionStarted(); @Override Instant getExecutionEndTime(); @Override boolean hasExecutionEnded(); @Override R get(); @Override Optional<Duration> getTimeout(); @Override CanonCommand<R> setTimeout(final Duration timeout); }
AbstractCanonCommand implements CanonCommand<R>, TargetRefCommand<R> { @Override public R get() throws InterruptedException, ExecutionException { if (executionEndTime != null) { if (resultException != null) { throw new ExecutionException(resultException); } return result; } else { resultBlocker.await(); if (resultException != null) { throw new ExecutionException(resultException); } return result; } } protected  AbstractCanonCommand(); protected  AbstractCanonCommand(final AbstractCanonCommand<R> toCopy); @SuppressWarnings("unchecked") @Override AbstractCanonCommand<R> copy(); @Override final void run(); @Override CanonCommand<R> setTargetRef(final EdsBaseRef targetRef); final Optional<EdsBaseRef> getTargetRef(); @Override TargetRefType getTargetRefType(); @Override Instant getCreateTime(); @Override Instant getExecutionStartTime(); @Override boolean hasExecutionStarted(); @Override Instant getExecutionEndTime(); @Override boolean hasExecutionEnded(); @Override R get(); @Override Optional<Duration> getTimeout(); @Override CanonCommand<R> setTimeout(final Duration timeout);  }