예제 #1
0
  private boolean step() {
    if (next != NONE) return true;

    while (next == NONE) {
      if (buffer.isEmpty()) {
        if (completed) {
          return false;
        } else if (sourceIter.hasNext()) {
          Object iter = null;
          if (multi) iter = xf.applyTo(RT.cons(null, sourceIter.next()));
          else iter = xf.invoke(null, sourceIter.next());

          if (RT.isReduced(iter)) {
            xf.invoke(null);
            completed = true;
          }
        } else {
          xf.invoke(null);
          completed = true;
        }
      } else {
        next = buffer.remove();
      }
    }
    return true;
  }
  protected void sync() throws IOException {
    if (buffer.isEmpty()) return;

    columnFamily = null;
    put(buffer);
    buffer = new Buffer();
    currentSize = 0;
    columnFamily = getColumnFamily();
    buffer.setFirstInsertedKey(currentKey);
  }
  private void sync() throws IOException {
    if (buffer.isEmpty()) return;

    checkForWriterException();

    try {
      writeQueue.put(buffer);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    buffer = new Buffer();
    currentSize = 0;
  }