Search in sources :

Example 1 with Holder

use of org.apache.cassandra.db.compaction.CompactionInfo.Holder in project cassandra by apache.

the class CompactionManager method forceShutdown.

/**
     * Shutdowns both compaction and validation executors, cancels running compaction / validation,
     * and waits for tasks to complete if tasks were not cancelable.
     */
public void forceShutdown() {
    // shutdown executors to prevent further submission
    executor.shutdown();
    validationExecutor.shutdown();
    // interrupt compactions and validations
    for (Holder compactionHolder : CompactionMetrics.getCompactions()) {
        compactionHolder.stop();
    }
    // until not interrupted tasks to complete.
    for (ExecutorService exec : Arrays.asList(executor, validationExecutor)) {
        try {
            if (!exec.awaitTermination(1, TimeUnit.MINUTES))
                logger.warn("Failed to wait for compaction executors shutdown");
        } catch (InterruptedException e) {
            logger.error("Interrupted while waiting for tasks to be terminated", e);
        }
    }
}
Also used : Holder(org.apache.cassandra.db.compaction.CompactionInfo.Holder)

Example 2 with Holder

use of org.apache.cassandra.db.compaction.CompactionInfo.Holder in project cassandra by apache.

the class CompactionManager method getCompactions.

public List<Map<String, String>> getCompactions() {
    List<Holder> compactionHolders = CompactionMetrics.getCompactions();
    List<Map<String, String>> out = new ArrayList<Map<String, String>>(compactionHolders.size());
    for (CompactionInfo.Holder ci : compactionHolders) out.add(ci.getCompactionInfo().asMap());
    return out;
}
Also used : Holder(org.apache.cassandra.db.compaction.CompactionInfo.Holder) Holder(org.apache.cassandra.db.compaction.CompactionInfo.Holder)

Example 3 with Holder

use of org.apache.cassandra.db.compaction.CompactionInfo.Holder in project cassandra by apache.

the class CompactionManager method getCompactionSummary.

public List<String> getCompactionSummary() {
    List<Holder> compactionHolders = CompactionMetrics.getCompactions();
    List<String> out = new ArrayList<String>(compactionHolders.size());
    for (CompactionInfo.Holder ci : compactionHolders) out.add(ci.getCompactionInfo().toString());
    return out;
}
Also used : Holder(org.apache.cassandra.db.compaction.CompactionInfo.Holder) Holder(org.apache.cassandra.db.compaction.CompactionInfo.Holder)

Aggregations

Holder (org.apache.cassandra.db.compaction.CompactionInfo.Holder)3