@Override public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { ScheduledFuture<?> curr; synchronized (this.triggerContextMonitor) { curr = obtainCurrentFuture(); } return curr.get(timeout, unit); }
@Override public Object get() throws InterruptedException, ExecutionException { ScheduledFuture<?> curr; synchronized (this.triggerContextMonitor) { curr = obtainCurrentFuture(); } return curr.get(); }
@Override public Object get() throws InterruptedException, ExecutionException { ScheduledFuture<?> curr; synchronized (this.triggerContextMonitor) { curr = obtainCurrentFuture(); } return curr.get(); }
@Override public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { ScheduledFuture<?> curr; synchronized (this.triggerContextMonitor) { curr = obtainCurrentFuture(); } return curr.get(timeout, unit); }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
private void checkFailures() { if (executorFuture != null && executorFuture.isDone()) { try { executorFuture.get(); } catch (InterruptedException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex); } catch (ExecutionException ex) { LOG.error("Got exception ", ex); throw new FailedException(ex.getCause()); } } }
return localFuture.get(min(currentDelay.plus(callTimeout).toMillis(), overallTimeoutsLeft), MILLISECONDS); } catch (ConfigException e) { throw e;
public void testFailOnExceptionFromRun() throws Exception { TestService service = new TestService(); service.runException = new Exception(); service.startAsync().awaitRunning(); service.runFirstBarrier.await(); service.runSecondBarrier.await(); try { future.get(); fail(); } catch (CancellationException expected) { } // An execution exception holds a runtime exception (from throwables.propogate) that holds our // original exception. assertEquals(service.runException, service.failureCause()); assertEquals(Service.State.FAILED, service.state()); }
idleFuture.get(callTimeout, TimeUnit.MILLISECONDS); } catch (TimeoutException ex) { LOG.warn("Timeout while trying to cancel closing of idle file. Idle" +
@Test public void testTriggerHoldsLock() throws Exception { final Object lock = new Object(); final AtomicReference<Throwable> errorRef = new AtomicReference<>(); final SystemProcessingTimeService timer = new SystemProcessingTimeService( new ReferenceSettingExceptionHandler(errorRef), lock); try { assertEquals(0, timer.getNumTasksScheduled()); // schedule something ScheduledFuture<?> future = timer.registerTimer(System.currentTimeMillis(), new ProcessingTimeCallback() { @Override public void onProcessingTime(long timestamp) { assertTrue(Thread.holdsLock(lock)); } }); // wait until the execution is over future.get(); assertEquals(0, timer.getNumTasksScheduled()); // check that no asynchronous error was reported if (errorRef.get() != null) { throw new Exception(errorRef.get()); } } finally { timer.shutdownService(); } }
@Override public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.get(timeout, unit); } }
if (writerClosedFuture != null){ writerClosedFuture.get();
scheduledFuture.get(); fail("scheduled future is not cancelled");
if (writerClosedFuture != null){ writerClosedFuture.get();
if (writerClosedFuture != null){ writerClosedFuture.get();
if (writerClosedFuture != null){ writerClosedFuture.get();
protected void finishHealthchecks() { for (ScheduledFuture<?> future : healthchecker.getHealthCheckFutures()) { try { future.get(); } catch (CancellationException ce) { // ignore, expected due to highly concurrent. } catch (InterruptedException e) { return; } catch (ExecutionException e) { throw Throwables.propagate(e); } } }