org.modeshape.jcr.query.engine.process

## Class RestartableSequence

- java.lang.Object
- - org.modeshape.jcr.query.NodeSequence
  - - org.modeshape.jcr.query.engine.process.RestartableSequence

- All Implemented Interfaces:
    NodeSequence.Restartable

      public class RestartableSequence
      extends NodeSequence
      implements NodeSequence.Restartable

  A `NodeSequence` that captures the buffers as they are used (or all at once) so that the sequence can be restarted.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static interface` | `RestartableSequence.BatchSequence`
    `protected class` | `RestartableSequence.QueueBufferSupplier`

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.query.NodeSequence

      `NodeSequence.AlternateSizeBatch, NodeSequence.Batch, NodeSequence.LimitBatch, NodeSequence.MultiWidthBatch, NodeSequence.Restartable, NodeSequence.RowAccessor, NodeSequence.RowFilter, NodeSequence.SingleWidthBatch`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `actualNumRowsInMemory`
    `protected AtomicLong` | `batchSize`
    `protected Queue<NodeSequence.Batch>` | `inMemoryBatches`
    `protected boolean` | `loadedAll`
    `protected RestartableSequence.QueueBufferSupplier` | `offHeapBatchesSupplier`
    `protected NodeSequence` | `original`
    `protected AtomicLong` | `remainingRowCount`
    `protected org.mapdb.Serializer<BufferedRows.BufferedRow>` | `rowSerializer`
    `protected long` | `totalSize`
    `protected boolean` | `usedOffHeap`
    `protected int` | `width`
    `protected String` | `workspaceName`

    - ### Fields inherited from class org.modeshape.jcr.query.NodeSequence

      `LOGGER, NO_PASS_ROW_FILTER, PASS_ROW_FILTER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RestartableSequence(String workspaceName, NodeSequence original, BufferManager bufferMgr, CachedNodeSupplier nodeCache, int numRowsInMemory)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected NodeSequence.Batch` | `batchFrom(Iterator<BufferedRows.BufferedRow> rows, long maxBatchSize)`
    `void` | `close()` Signal that this node sequence is no longer needed.
    `protected BufferedRows.BufferedRow` | `createRow(NodeSequence.Batch currentRow)`
    `long` | `getRowCount()` Get the number of rows in this sequence.
    `boolean` | `isEmpty()` Determine whether this results is known to be empty.
    `protected long` | `loadBatch(NodeSequence.Batch batch, boolean loadIntoMemory, AtomicReference<NodeSequence.Batch> copyOutput)`
    `protected void` | `loadRemaining()` Load all of the remaining rows from the supplied sequence into the buffer.
    `NodeSequence.Batch` | `nextBatch()` Get the next batch of `NodeKey` instances.
    `void` | `restart()`
    `protected void` | `restartBatches()`
    `String` | `toString()`
    `int` | `width()` Get the number of nodes in each row.

    - ### Methods inherited from class org.modeshape.jcr.query.NodeSequence

      `append, batchFilteredWith, batchOf, batchOf, batchOf, batchOfKeys, batchOfKeys, batchOfKeys, batchOfKeys, batchWithCount, copy, emptyBatch, emptySequence, filter, keyFor, limit, limit, merging, requireBoth, requireEither, skip, slice, slicingBatch, withBatch, withBatches, withBatches, withNode, withNodeKeys, withNodeKeys, withNodeKeys, withNodeKeys, withNodes, withNodes`

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

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

- - ### Field Detail

    - #### original

          protected final NodeSequence original

    - #### rowSerializer

          protected final org.mapdb.Serializer<BufferedRows.BufferedRow> rowSerializer

    - #### inMemoryBatches

          protected final Queue<NodeSequence.Batch> inMemoryBatches

    - #### offHeapBatchesSupplier

          protected final RestartableSequence.QueueBufferSupplier offHeapBatchesSupplier

    - #### workspaceName

          protected final String workspaceName

    - #### remainingRowCount

          protected final AtomicLong remainingRowCount

    - #### width

          protected final int width

    - #### batchSize

          protected final AtomicLong batchSize

    - #### actualNumRowsInMemory

          protected int actualNumRowsInMemory

    - #### totalSize

          protected long totalSize

    - #### loadedAll

          protected boolean loadedAll

    - #### usedOffHeap

          protected boolean usedOffHeap

  - ### Constructor Detail

    - #### RestartableSequence

          public RestartableSequence(String workspaceName,
                             NodeSequence original,
                             BufferManager bufferMgr,
                             CachedNodeSupplier nodeCache,
                             int numRowsInMemory)

  - ### Method Detail

    - #### width

          public int width()

      Description copied from class: `NodeSequence`
      Get the number of nodes in each row.
      Specified by:
        `width` in class `NodeSequence`
      Returns:
        the width of each row; always positive

    - #### getRowCount

          public long getRowCount()

      Description copied from class: `NodeSequence`
      Get the number of rows in this sequence. If the actual number of rows is not known, this method returns -1.
      Specified by:
        `getRowCount` in class `NodeSequence`
      Returns:
        the number of rows, or -1 if the number of rows is not known or cannot be found with significant overhead

    - #### isEmpty

          public boolean isEmpty()

      Description copied from class: `NodeSequence`
      Determine whether this results is known to be empty.
      Specified by:
        `isEmpty` in class `NodeSequence`
      Returns:
        the true if there are no results, or false if there is at least some or if the number of rows is not known

    - #### nextBatch

          public NodeSequence.Batch nextBatch()

      Description copied from class: `NodeSequence`
      Get the next batch of `NodeKey` instances.
      Specified by:
        `nextBatch` in class `NodeSequence`
      Returns:
        the next batch, or null if there are no more batches.

    - #### restart

          public void restart()

      Specified by:
        `restart` in interface `NodeSequence.Restartable`

    - #### restartBatches

          protected void restartBatches()

    - #### close

          public void close()

      Description copied from class: `NodeSequence`
      Signal that this node sequence is no longer needed.
      Specified by:
        `close` in class `NodeSequence`

    - #### loadRemaining

          protected void loadRemaining()

      Load all of the remaining rows from the supplied sequence into the buffer.

    - #### loadBatch

          protected long loadBatch(NodeSequence.Batch batch,
                       boolean loadIntoMemory,
                       AtomicReference<NodeSequence.Batch> copyOutput)

    - #### createRow

          protected BufferedRows.BufferedRow createRow(NodeSequence.Batch currentRow)

    - #### batchFrom

          protected NodeSequence.Batch batchFrom(Iterator<BufferedRows.BufferedRow> rows,
                                     long maxBatchSize)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.