public void process(OutputBuffer delegate) { if (futureResult.isDone()) { return; } try { ListenableFuture<BufferResult> result = delegate.get(bufferId, startingSequenceId, maxSize); futureResult.setAsync(result); } catch (Exception e) { futureResult.setException(e); } } }
public void process(OutputBuffer delegate) { if (futureResult.isDone()) { return; } try { ListenableFuture<BufferResult> result = delegate.get(bufferId, startingSequenceId, maxSize); futureResult.setAsync(result); } catch (Exception e) { futureResult.setException(e); } } }
public void process(OutputBuffer delegate) { if (futureResult.isDone()) { return; } try { ListenableFuture<BufferResult> result = delegate.get(bufferId, startingSequenceId, maxSize); futureResult.setAsync(result); } catch (Exception e) { futureResult.setException(e); } } }
setException(e.getCause()); setException(e);
setException(e.getCause()); setException(e);
@Test public void testSetException() throws Exception { ExtendedSettableFuture<String> future = ExtendedSettableFuture.create(); future.setException(new Exception("")); assertTrue(future.isDone()); assertFalse(future.isCancelled()); assertFalse(future.checkWasInterrupted()); assertThrows(ExecutionException.class, future::get); }
@Test public void testSetException() throws Exception { ExtendedSettableFuture<String> future = ExtendedSettableFuture.create(); future.setException(new Exception("")); assertTrue(future.isDone()); assertFalse(future.isCancelled()); assertFalse(future.checkWasInterrupted()); assertThrows(ExecutionException.class, future::get); }
toFuture = SettableFuture.create(); mirror(fromFuture, toFuture, true); fromFuture.setException(new RuntimeException()); assertThrows(ExecutionException.class, toFuture::get);
toFuture = SettableFuture.create(); mirror(fromFuture, toFuture, true); fromFuture.setException(new RuntimeException()); assertThrows(ExecutionException.class, toFuture::get);
toFuture = ExtendedSettableFuture.create(); toFuture.setAsync(fromFuture); fromFuture.setException(new RuntimeException()); assertThrows(ExecutionException.class, toFuture::get);
toFuture = ExtendedSettableFuture.create(); toFuture.setAsync(fromFuture); fromFuture.setException(new RuntimeException()); assertThrows(ExecutionException.class, toFuture::get);