Package oracle.kv

# Interface ParallelScanIterator<K>

All Superinterfaces:
  `Iterator<K>`

All Known Subinterfaces:
  `TableIterator<K>`

public interface ParallelScanIterator<K> extends Iterator<K>
Interface to the specialized Iterator type returned by the `Parallel Scan version` of storeIterator().

This Iterator adds the ability to close (terminate) a ParallelScan as well gather per-partition and per-shard statistics about the scan.

Iterators implementing this interface can only be used safely by one thread at a time unless synchronized externally.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close (terminate) a Parallel Scan.
  `List<DetailedMetrics>`
  `getPartitionMetrics()`
  Gets the per-partition metrics for this Parallel Scan.
  `List<DetailedMetrics>`
  `getShardMetrics()`
  Gets the per-shard metrics for this Parallel Scan.
  `K`
  `next()`
  Returns the next element in the iteration.

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining, hasNext, remove`

- ## Method Details

  - ### close

    void close()
    Close (terminate) a Parallel Scan. This shutdowns down all related threads and tasks, and awaits up to 60 seconds for threads to exit.

  - ### getPartitionMetrics

    List<DetailedMetrics> getPartitionMetrics()
    Gets the per-partition metrics for this Parallel Scan. This may be called at any time during the iteration in order to obtain metrics to that point or it may be called at the end to obtain metrics for the entire scan. If there are no metrics available yet for a particular partition, then there will not be an entry in the list.
    Returns:
      the per-partition metrics for this Parallel Scan.

  - ### getShardMetrics

    List<DetailedMetrics> getShardMetrics()
    Gets the per-shard metrics for this Parallel Scan. This may be called at any time during the iteration in order to obtain metrics to that point or it may be called at the end to obtain metrics for the entire scan. If there are no metrics available yet for a particular shard, then there will not be an entry in the list.
    Returns:
      the per-shard metrics for this Parallel Scan.

  - ### next

    K next()
    Returns the next element in the iteration.
    Specified by:
      `next` in interface `Iterator<K>`
    Returns:
      the next element in the iteration.
    Throws:
      `NoSuchElementException` - - iteration has no more elements.
      `StoreIteratorException` - - an exception occurred during a retrieval as part of a multi-record iteration method. This exception does not necessarily close or invalidate the iterator. Repeated calls to next() may or may not cause an exception to be thrown. It is incumbent on the caller to determine the type of exception and act accordingly.