コード例 #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;
  }