use of org.apache.cassandra.concurrent.FutureTask in project cassandra by apache.
the class Gossiper method runInGossipStageBlocking.
public static void runInGossipStageBlocking(Runnable runnable) {
// run immediately if we're already in the gossip stage
if (isInGossipStage()) {
runnable.run();
return;
}
FutureTask<?> task = new FutureTask<>(runnable);
Stage.GOSSIP.execute(task);
try {
task.get();
} catch (InterruptedException e) {
throw new UncheckedInterruptedException(e);
} catch (ExecutionException e) {
throw new AssertionError(e);
}
}
use of org.apache.cassandra.concurrent.FutureTask in project cassandra by apache.
the class PendingAntiCompaction method run.
public Future<List<Void>> run() {
List<FutureTask<AcquireResult>> tasks = new ArrayList<>(tables.size());
for (ColumnFamilyStore cfs : tables) {
cfs.forceBlockingFlush();
FutureTask<AcquireResult> task = new FutureTask<>(getAcquisitionCallable(cfs, tokenRanges.ranges(), prsId, acquireRetrySeconds, acquireSleepMillis));
executor.submit(task);
tasks.add(task);
}
Future<List<AcquireResult>> acquisitionResults = FutureCombiner.successfulOf(tasks);
return acquisitionResults.flatMap(getAcquisitionCallback(prsId, tokenRanges));
}
Aggregations