private void waitForMinimumWorkers() { ListenableFuture<?> minimumWorkerFuture = clusterSizeMonitor.waitForMinimumWorkers(); addSuccessCallback(minimumWorkerFuture, this::startExecution); addExceptionCallback(minimumWorkerFuture, stateMachine::transitionToFailed); }
.map(transactionMetadata -> finishingExecutor.submit(transactionMetadata::commit)) .collect(toList())); addExceptionCallback(future, throwable -> { abortInternal(); log.error(throwable, "Read-only connector should not throw exception on commit"); .map(transactionMetadata -> finishingExecutor.submit(transactionMetadata::commit)) .collect(toList())); addExceptionCallback(future, throwable -> log.error(throwable, "Read-only connector should not throw exception on commit")); return future; }; ListenableFuture<?> commitFuture = finishingExecutor.submit(writeConnector::commit); ListenableFuture<?> readOnlyCommitFuture = Futures.transformAsync(commitFuture, ignored -> commitReadOnlyConnectors.get(), directExecutor()); addExceptionCallback(readOnlyCommitFuture, this::abortInternal); return nonCancellationPropagating(readOnlyCommitFuture);
public static <T> void addExceptionCallback(ListenableFuture<T> future, Runnable exceptionCallback) { requireNonNull(exceptionCallback, "exceptionCallback is null"); addExceptionCallback(future, t -> exceptionCallback.run()); }
public static <T> void addExceptionCallback(ListenableFuture<T> future, Runnable exceptionCallback) { requireNonNull(exceptionCallback, "exceptionCallback is null"); addExceptionCallback(future, t -> exceptionCallback.run()); }
private void waitForMinimumWorkers() { ListenableFuture<?> minimumWorkerFuture = clusterSizeMonitor.waitForMinimumWorkers(); addSuccessCallback(minimumWorkerFuture, () -> queryExecutor.submit(this::startExecution)); addExceptionCallback(minimumWorkerFuture, throwable -> queryExecutor.submit(() -> stateMachine.transitionToFailed(throwable))); }
private void waitForMinimumWorkers() { ListenableFuture<?> minimumWorkerFuture = clusterSizeMonitor.waitForMinimumWorkers(); addSuccessCallback(minimumWorkerFuture, this::startExecution); addExceptionCallback(minimumWorkerFuture, stateMachine::transitionToFailed); }
.map(transactionMetadata -> finishingExecutor.submit(transactionMetadata::commit)) .collect(toList())); addExceptionCallback(future, throwable -> { abortInternal(); log.error(throwable, "Read-only connector should not throw exception on commit"); .map(transactionMetadata -> finishingExecutor.submit(transactionMetadata::commit)) .collect(toList())); addExceptionCallback(future, throwable -> log.error(throwable, "Read-only connector should not throw exception on commit")); return future; }; ListenableFuture<?> commitFuture = finishingExecutor.submit(writeConnector::commit); ListenableFuture<?> readOnlyCommitFuture = Futures.transformAsync(commitFuture, ignored -> commitReadOnlyConnectors.get(), directExecutor()); addExceptionCallback(readOnlyCommitFuture, this::abortInternal); return nonCancellationPropagating(readOnlyCommitFuture);
.map(transactionMetadata -> finishingExecutor.submit(transactionMetadata::commit)) .collect(toList())); addExceptionCallback(future, throwable -> { abortInternal(); log.error(throwable, "Read-only connector should not throw exception on commit"); .map(transactionMetadata -> finishingExecutor.submit(transactionMetadata::commit)) .collect(toList())); addExceptionCallback(future, throwable -> log.error(throwable, "Read-only connector should not throw exception on commit")); return future; }; ListenableFuture<?> commitFuture = finishingExecutor.submit(writeConnector::commit); ListenableFuture<?> readOnlyCommitFuture = Futures.transformAsync(commitFuture, ignored -> commitReadOnlyConnectors.get(), directExecutor()); addExceptionCallback(readOnlyCommitFuture, this::abortInternal); return nonCancellationPropagating(readOnlyCommitFuture);
private synchronized void enqueueMissingShards() { try { for (ShardMetadata shard : getMissingShards()) { stats.incrementBackgroundShardRecovery(); ListenableFuture<?> future = shardQueue.submit(new MissingShard(shard.getShardUuid(), shard.getCompressedSize(), shard.getXxhash64(), false)); addExceptionCallback(future, t -> log.warn(t, "Error recovering shard: %s", shard.getShardUuid())); } } catch (Throwable t) { log.error(t, "Error creating shard recovery tasks"); } }
private synchronized void enqueueMissingShards() { try { for (ShardMetadata shard : getMissingShards()) { stats.incrementBackgroundShardRecovery(); ListenableFuture<?> future = shardQueue.submit(new MissingShard(shard.getShardUuid(), shard.getCompressedSize(), shard.getXxhash64(), false)); addExceptionCallback(future, t -> log.warn(t, "Error recovering shard: %s", shard.getShardUuid())); } } catch (Throwable t) { log.error(t, "Error creating shard recovery tasks"); } }