private AbstractIterator toPartitionKeys()

in spark-job/src/main/java/org/apache/cassandra/diff/DiffCluster.java [134:148]


    private AbstractIterator<PartitionKey> toPartitionKeys(ResultSet resultSet) {
        return new AbstractIterator<PartitionKey>() {
            Iterator<Row> rows = resultSet.iterator();

            protected PartitionKey computeNext() {
                if (session.isClosed())
                    throw new RuntimeException("Session was closed, cannot get next partition key");

                if (stopped.get())
                    throw new RuntimeException("Job was stopped, cannot get next partition key");

                return rows.hasNext() ? new PartitionKey(rows.next()) : endOfData();
            }
        };
    }