@SuppressWarnings("FieldAccessNotGuarded") @Override public ListenableFuture<?> isDestroyed() { return nonCancellationPropagating(destroyed); }
private synchronized ListenableFuture<?> abortInternal() { // the callbacks in statement performed on another thread so are safe return nonCancellationPropagating(Futures.allAsList(connectorIdToMetadata.values().stream() .map(connection -> finishingExecutor.submit(() -> safeAbort(connection))) .collect(toList()))); }
@Override public synchronized ListenableFuture<?> whenSplitQueueHasSpace(int threshold) { return nonCancellationPropagating(whenSplitQueueHasSpace); }
@Override public ListenableFuture<?> asyncCommit(TransactionId transactionId) { return nonCancellationPropagating(Futures.transformAsync(removeTransactionMetadataAsFuture(transactionId), TransactionMetadata::asyncCommit, directExecutor())); }
@Override public ListenableFuture<?> asyncAbort(TransactionId transactionId) { return nonCancellationPropagating(Futures.transformAsync(removeTransactionMetadataAsFuture(transactionId), TransactionMetadata::asyncAbort, directExecutor())); }
private void updateSignalAndStatusFutures() { dataSignalFuture = whenAnyComplete(dataRequests); statusFuture = toCompletableFuture(nonCancellationPropagating(dataSignalFuture)); }
private CompletableFuture<PrestoThriftPageResult> sendDataRequestInternal() { long start = System.nanoTime(); ListenableFuture<PrestoThriftPageResult> rowsBatchFuture = client.getRows( splitId, columnNames, maxBytesPerResponse, new PrestoThriftNullableToken(nextToken)); rowsBatchFuture = catchingThriftException(rowsBatchFuture); rowsBatchFuture.addListener(() -> readTimeNanos.addAndGet(System.nanoTime() - start), directExecutor()); return toCompletableFuture(nonCancellationPropagating(rowsBatchFuture)); }
final ListenableFuture<T> outputFuture = Futures.nonCancellationPropagating(taskFuture);
log.error(throwable, "Read-only connector should not throw exception on commit"); }); return nonCancellationPropagating(future); ListenableFuture<?> readOnlyCommitFuture = Futures.transformAsync(commitFuture, ignored -> commitReadOnlyConnectors.get(), directExecutor()); addExceptionCallback(readOnlyCommitFuture, this::abortInternal); return nonCancellationPropagating(readOnlyCommitFuture);
public void testNonCancellationPropagating_failure() throws Exception { SettableFuture<Foo> input = SettableFuture.create(); ListenableFuture<Foo> wrapper = nonCancellationPropagating(input); Throwable failure = new Throwable("thrown"); assertFalse(wrapper.isDone()); input.setException(failure); try { getDone(wrapper); fail(); } catch (ExecutionException expected) { assertSame(failure, expected.getCause()); } }
statusFuture = toCompletableFuture(nonCancellationPropagating(splitFuture)); statusFuture = toCompletableFuture(nonCancellationPropagating(splitFuture)); return false;
false, overallNewTasks.build(), nonCancellationPropagating(whenAnyComplete(overallBlockedFutures)), blockedReason, overallSplitAssignmentCount);
public void testNonCancellationPropagating_successful() throws Exception { SettableFuture<Foo> input = SettableFuture.create(); ListenableFuture<Foo> wrapper = nonCancellationPropagating(input); Foo foo = new Foo(); assertFalse(wrapper.isDone()); input.set(foo); assertTrue(wrapper.isDone()); assertSame(foo, getDone(wrapper)); }
public void testNonCancellationPropagating_delegateCancelled() throws Exception { SettableFuture<Foo> input = SettableFuture.create(); ListenableFuture<Foo> wrapper = nonCancellationPropagating(input); assertFalse(wrapper.isDone()); assertTrue(input.cancel(false)); assertTrue(wrapper.isCancelled()); }
public void testNonCancellationPropagating_doesNotPropagate() throws Exception { SettableFuture<Foo> input = SettableFuture.create(); ListenableFuture<Foo> wrapper = nonCancellationPropagating(input); assertTrue(wrapper.cancel(true)); assertTrue(wrapper.isCancelled()); assertTrue(wrapper.isDone()); assertFalse(input.isCancelled()); assertFalse(input.isDone()); }
@Override public synchronized ListenableFuture<?> whenSplitQueueHasSpace(int threshold) { return nonCancellationPropagating(whenSplitQueueHasSpace); }
private synchronized ListenableFuture<?> abortInternal() { // the callbacks in statement performed on another thread so are safe return nonCancellationPropagating(Futures.allAsList(connectorIdToMetadata.values().stream() .map(connection -> finishingExecutor.submit(() -> safeAbort(connection))) .collect(toList()))); }
@Override public ListenableFuture<?> asyncAbort(TransactionId transactionId) { return nonCancellationPropagating(Futures.transformAsync(removeTransactionMetadataAsFuture(transactionId), TransactionMetadata::asyncAbort, directExecutor())); }
@Override public ListenableFuture<?> asyncCommit(TransactionId transactionId) { return nonCancellationPropagating(Futures.transformAsync(removeTransactionMetadataAsFuture(transactionId), TransactionMetadata::asyncCommit, directExecutor())); }
public void testNonCancellationPropagating_delegateCancelled() throws Exception { SettableFuture<Foo> input = SettableFuture.create(); ListenableFuture<Foo> wrapper = nonCancellationPropagating(input); assertFalse(wrapper.isDone()); assertTrue(input.cancel(false)); assertTrue(wrapper.isCancelled()); }