@Override public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.get(timeout, unit); }
@Override public V get() throws InterruptedException, ExecutionException { return delegate.get(); }
public void testListenerCalledOnException() throws Exception { throwException = true; // Start up the task and unblock the latch to finish the task. exec.execute(task); runLatch.await(); taskLatch.countDown(); try { task.get(5, TimeUnit.SECONDS); fail("Should have propagated the failure."); } catch (ExecutionException e) { assertEquals(IllegalStateException.class, e.getCause().getClass()); } assertTrue(listenerLatch.await(5, TimeUnit.SECONDS)); assertTrue(task.isDone()); assertFalse(task.isCancelled()); }
public void testListenerDoesNotRunUntilTaskCompletes() throws Exception { // Test default state of not started. assertEquals(1, listenerLatch.getCount()); assertFalse(task.isDone()); assertFalse(task.isCancelled()); // Start the task to put it in the RUNNING state. Have to use a separate // thread because the task will block on the task latch after unblocking // the run latch. exec.execute(task); runLatch.await(); assertEquals(1, listenerLatch.getCount()); assertFalse(task.isDone()); assertFalse(task.isCancelled()); // Finish the task by unblocking the task latch. Then wait for the // listener to be called by blocking on the listener latch. taskLatch.countDown(); assertEquals(25, task.get().intValue()); assertTrue(listenerLatch.await(5, TimeUnit.SECONDS)); assertTrue(task.isDone()); assertFalse(task.isCancelled()); }
@Override public V get() throws InterruptedException, ExecutionException { return delegate.get(); }
@Override public V get() throws InterruptedException, ExecutionException { return delegate.get(); }
@Override public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.get(timeout, unit); }
@Override public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.get(timeout, unit); }
@Override public UploadMediaItemResponse get() throws InterruptedException, ExecutionException { return futureTask.get(); }
@Override public UploadMediaItemResponse get(long l, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { return futureTask.get(l, timeUnit); } }
blobIdRetriever.get(); } catch (ExecutionException e) { LOG.warn("Error occurred while fetching all the blobIds from the BlobStore");
blobIdRetriever.get(); } catch (ExecutionException e) { LOG.warn("Error occurred while fetching all the blobIds from the BlobStore");
blobIdRetriever.get(); } catch (ExecutionException e) { LOG.warn("Error occurred while fetching all the blobIds from the BlobStore");
public void testListenerCalledOnException() throws Exception { throwException = true; // Start up the task and unblock the latch to finish the task. exec.execute(task); runLatch.await(); taskLatch.countDown(); try { task.get(5, TimeUnit.SECONDS); fail("Should have propagated the failure."); } catch (ExecutionException e) { assertEquals(IllegalStateException.class, e.getCause().getClass()); } assertTrue(listenerLatch.await(5, TimeUnit.SECONDS)); assertTrue(task.isDone()); assertFalse(task.isCancelled()); }
public void testListenerDoesNotRunUntilTaskCompletes() throws Exception { // Test default state of not started. assertEquals(1, listenerLatch.getCount()); assertFalse(task.isDone()); assertFalse(task.isCancelled()); // Start the task to put it in the RUNNING state. Have to use a separate // thread because the task will block on the task latch after unblocking // the run latch. exec.execute(task); runLatch.await(); assertEquals(1, listenerLatch.getCount()); assertFalse(task.isDone()); assertFalse(task.isCancelled()); // Finish the task by unblocking the task latch. Then wait for the // listener to be called by blocking on the listener latch. taskLatch.countDown(); assertEquals(25, task.get().intValue()); assertTrue(listenerLatch.await(5, TimeUnit.SECONDS)); assertTrue(task.isDone()); assertFalse(task.isCancelled()); }