docs: private ChunkStatus getNextChunkStatusBasedOnPrevious() {
  
          // If this is the first chunk
          if (currentChunkStatus == null) {
              return new ChunkStatus();
          }
  
          ChunkStatus nextChunkStatus = null;
  
          // At this point the 'current' status is the previous chunk's status.
          if (currentChunkStatus.wasMarkedForRollbackWithRetry()) {
  
              // Re-position reader & writer
              getTransactionManager().begin();
              positionReaderAtCheckpoint();
              positionWriterAtCheckpoint();
              getTransactionManager().commit();
  
              nextChunkStatus = new ChunkStatus(ChunkStatusType.RETRY_AFTER_ROLLBACK);
  
              // What happens if we get a retry-with-rollback on a single item that we were processing
              // after a prior retry with rollback?   We don't want to revert to normal processing
              // after completing only the single item of the "single item chunk".  We want to complete
              // the full portion of the original chunk.  So be careful to propagate this number if
              // it already exists.
              int numToProcessOneByOne = currentChunkStatus.getItemsToProcessOneByOneAfterRollback();
              if (numToProcessOneByOne > 0) {
                  // Retry after rollback AFTER a previous retry after rollback
                  nextChunkStatus.setItemsToProcessOneByOneAfterRollback(numToProcessOneByOne);
              } else {
                  // "Normal" (i.e. the first) retry after rollback.
                  nextChunkStatus.setItemsToProcessOneByOneAfterRollback(currentChunkStatus.getItemsTouchedInCurrentChunk());
              }
          } else if (currentChunkStatus.isRetryingAfterRollback()) {
              // In this case the 'current' (actually the last) chunk was a single-item retry after rollback chunk,
              // so we have to see if it's time to revert to normal processing.
              int numToProcessOneByOne = currentChunkStatus.getItemsToProcessOneByOneAfterRollback();
              if (numToProcessOneByOne == 1) {
                  // we're done, revert to normal
                  nextChunkStatus = new ChunkStatus();
              } else {
                  nextChunkStatus = new ChunkStatus(ChunkStatusType.RETRY_AFTER_ROLLBACK);
                  nextChunkStatus.setItemsToProcessOneByOneAfterRollback(numToProcessOneByOne - 1);
              }
          } else {
              nextChunkStatus = new ChunkStatus();
          }
  
          return nextChunkStatus;
      }