com.thinkaurelius.titan.diskstorage.util

## Class MetricInstrumentedIterator

- java.lang.Object
- - com.thinkaurelius.titan.diskstorage.util.MetricInstrumentedIterator

- All Implemented Interfaces:
    KeyIterator, RecordIterator<StaticBuffer>, Closeable, AutoCloseable, Iterator<StaticBuffer>

      public class MetricInstrumentedIterator
      extends Object
      implements KeyIterator

  This class is used by `MetricInstrumentedStore` to measure wallclock time, method invocation counts, and exceptions thrown by the methods on `RecordIterator` instances returned from `MetricInstrumentedStore.getSlice(com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeySliceQuery, com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction)`.
  Author:
    Dan LaRocque

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `RecordIterator<Entry>` | `getEntries()` Returns an iterator over all entries associated with the current key that match the column range specified in the query.
    `boolean` | `hasNext()`
    `StaticBuffer` | `next()`
    `static MetricInstrumentedIterator` | `of(KeyIterator keyIterator, String... prefix)` If the iterator argument is non-null, then return a new `MetricInstrumentedIterator` wrapping it.
    `void` | `remove()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### of

          public static MetricInstrumentedIterator of(KeyIterator keyIterator,
                                      String... prefix)

      If the iterator argument is non-null, then return a new `MetricInstrumentedIterator` wrapping it. Metrics for method calls on the wrapped instance will be prefixed with the string `prefix` which must be non-null. If the iterator argument is null, then return null.
      Parameters:
        `keyIterator` - the iterator to wrap with Metrics measurements
        `prefix` - the Metrics name prefix string
      Returns:
        a wrapper around `keyIterator` or null if `keyIterator` is null

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<StaticBuffer>`

    - #### next

          public StaticBuffer next()

      Specified by:
        `next` in interface `Iterator<StaticBuffer>`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### getEntries

          public RecordIterator<Entry> getEntries()

      Description copied from interface: `KeyIterator`
      Returns an iterator over all entries associated with the current key that match the column range specified in the query. Closing the returned sub-iterator has no effect on this iterator. Calling `Iterator.next()` might close previously returned RecordIterators depending on the implementation, hence it is important to iterate over (and close) the RecordIterator before calling `Iterator.next()` or `Iterator.hasNext()`.
      Specified by:
        `getEntries` in interface `KeyIterator`
      Returns:

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator<StaticBuffer>`

Copyright © 2012–2014. All rights reserved.