Esempio n. 1
0
  @Override
  public boolean hasNext() {
    if (currentIndex >= items.size()) return false;

    if (currentCursor == null) return false;

    if (currentCursor.hasNext()) return true;

    while (true) {
      try {
        boolean ret = loadNext();
        if (!ret) return false;

        if (currentCursor.hasNext()) return true;
      } catch (IOException e) {
        logger.warn("kraken logstorage: cannot fetch next index from merged cursor, skipping", e);
      }
    }
  }
Esempio n. 2
0
  private boolean loadNext() throws IOException {
    if (currentCursor != null) {
      currentCursor.close();
      currentCursor = null;
    }

    if (currentIndex >= items.size() - 1) return false;

    load(++currentIndex);
    return true;
  }
Esempio n. 3
0
 @Override
 public void close() {
   if (currentCursor != null) currentCursor.close();
 }
Esempio n. 4
0
  @Override
  public LogIndexItem next() {
    if (!hasNext()) throw new NoSuchElementException();

    return currentCursor.next();
  }