예제 #1
0
파일: ChildWriter.java 프로젝트: robjg/dido
  @Override
  public boolean write(Object object) throws DataException {

    if (closed) {
      throw new IllegalStateException("Writer closed.");
    }

    while (writers.size() > 0) {

      DataWriter currentWriter = writers.get(0);

      boolean keep = currentWriter.write(object);

      if (keep) {
        if (logger.isTraceEnabled()) {
          logger.trace("Current writer [" + currentWriter + "] requires more data.");
        }

        return true;
      } else {
        if (logger.isTraceEnabled()) {
          logger.trace("Current writer [" + currentWriter + "] complete.");
        }

        currentWriter.close();
        writers.remove(0);
      }
    }

    return false;
  }
예제 #2
0
파일: ChildWriter.java 프로젝트: robjg/dido
  @Override
  public void close() throws DataException {

    for (DataWriter currentWriter : writers) {

      logger.trace("Closing [" + currentWriter + "]");
      currentWriter.close();
    }

    writers.clear();
    closed = true;
  }