protected String runTask()

in priam/src/main/java/com/netflix/priam/cluster/management/Flush.java [54:83]


    protected String runTask() throws Exception {
        List<String> flushed = new ArrayList<>();

        // Get keyspaces to flush
        deriveKeyspaces();

        if (this.keyspaces == null || this.keyspaces.isEmpty()) {
            logger.warn("NO op on requested \"flush\" as there are no keyspaces.");
            return flushed.toString();
        }

        // If flush is for certain keyspaces, validate keyspace exist
        for (String keyspace : keyspaces) {
            if (!cassandraOperations.getKeyspaces().contains(keyspace)) {
                throw new IllegalArgumentException("Keyspace [" + keyspace + "] does not exist.");
            }

            if (SchemaConstant.isSystemKeyspace(keyspace)) // no need to flush system keyspaces.
            continue;

            try {
                cassandraOperations.forceKeyspaceFlush(keyspace);
                flushed.add(keyspace);
            } catch (IOException | ExecutionException | InterruptedException e) {
                throw new Exception("Exception during flushing keyspace: " + keyspace, e);
            }
        }

        return flushed.toString();
    }