类org.apache.hadoop.io.file.tfile.BCFile.Writer.BlockAppender源码实例Demo

下面列出了怎么用org.apache.hadoop.io.file.tfile.BCFile.Writer.BlockAppender的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: hadoop   文件: TFile.java
/**
 * Close the Writer. Resources will be released regardless of the exceptions
 * being thrown. Future close calls will have no effect.
 * 
 * The underlying FSDataOutputStream is not closed.
 */
@Override
public void close() throws IOException {
  if ((state == State.CLOSED)) {
    return;
  }
  try {
    // First try the normal finish.
    // Terminate upon the first Exception.
    if (errorCount == 0) {
      if (state != State.READY) {
        throw new IllegalStateException(
            "Cannot close TFile in the middle of key-value insertion.");
      }

      finishDataBlock(true);

      // first, write out data:TFile.meta
      BlockAppender outMeta =
          writerBCF
              .prepareMetaBlock(TFileMeta.BLOCK_NAME, COMPRESSION_NONE);
      try {
        tfileMeta.write(outMeta);
      } finally {
        outMeta.close();
      }

      // second, write out data:TFile.index
      BlockAppender outIndex =
          writerBCF.prepareMetaBlock(TFileIndex.BLOCK_NAME);
      try {
        tfileIndex.write(outIndex);
      } finally {
        outIndex.close();
      }

      writerBCF.close();
    }
  } finally {
    IOUtils.cleanup(LOG, blkAppender, writerBCF);
    blkAppender = null;
    writerBCF = null;
    state = State.CLOSED;
  }
}
 
源代码2 项目: big-c   文件: TFile.java
/**
 * Close the Writer. Resources will be released regardless of the exceptions
 * being thrown. Future close calls will have no effect.
 * 
 * The underlying FSDataOutputStream is not closed.
 */
@Override
public void close() throws IOException {
  if ((state == State.CLOSED)) {
    return;
  }
  try {
    // First try the normal finish.
    // Terminate upon the first Exception.
    if (errorCount == 0) {
      if (state != State.READY) {
        throw new IllegalStateException(
            "Cannot close TFile in the middle of key-value insertion.");
      }

      finishDataBlock(true);

      // first, write out data:TFile.meta
      BlockAppender outMeta =
          writerBCF
              .prepareMetaBlock(TFileMeta.BLOCK_NAME, COMPRESSION_NONE);
      try {
        tfileMeta.write(outMeta);
      } finally {
        outMeta.close();
      }

      // second, write out data:TFile.index
      BlockAppender outIndex =
          writerBCF.prepareMetaBlock(TFileIndex.BLOCK_NAME);
      try {
        tfileIndex.write(outIndex);
      } finally {
        outIndex.close();
      }

      writerBCF.close();
    }
  } finally {
    IOUtils.cleanup(LOG, blkAppender, writerBCF);
    blkAppender = null;
    writerBCF = null;
    state = State.CLOSED;
  }
}
 
源代码3 项目: RDFS   文件: TFile.java
/**
 * Close the Writer. Resources will be released regardless of the exceptions
 * being thrown. Future close calls will have no effect.
 * 
 * The underlying FSDataOutputStream is not closed.
 */
public void close() throws IOException {
  if ((state == State.CLOSED)) {
    return;
  }
  try {
    // First try the normal finish.
    // Terminate upon the first Exception.
    if (errorCount == 0) {
      if (state != State.READY) {
        throw new IllegalStateException(
            "Cannot close TFile in the middle of key-value insertion.");
      }

      finishDataBlock(true);

      // first, write out data:TFile.meta
      BlockAppender outMeta =
          writerBCF
              .prepareMetaBlock(TFileMeta.BLOCK_NAME, COMPRESSION_NONE);
      try {
        tfileMeta.write(outMeta);
      } finally {
        outMeta.close();
      }

      // second, write out data:TFile.index
      BlockAppender outIndex =
          writerBCF.prepareMetaBlock(TFileIndex.BLOCK_NAME);
      try {
        tfileIndex.write(outIndex);
      } finally {
        outIndex.close();
      }

writerBCF.close();
    }
  } finally {
    IOUtils.cleanup(LOG, blkAppender, writerBCF);
    blkAppender = null;
    writerBCF = null;
    state = State.CLOSED;
  }
}
 
源代码4 项目: hadoop-gpu   文件: TFile.java
/**
 * Close the Writer. Resources will be released regardless of the exceptions
 * being thrown. Future close calls will have no effect.
 * 
 * The underlying FSDataOutputStream is not closed.
 */
public void close() throws IOException {
  if ((state == State.CLOSED)) {
    return;
  }
  try {
    // First try the normal finish.
    // Terminate upon the first Exception.
    if (errorCount == 0) {
      if (state != State.READY) {
        throw new IllegalStateException(
            "Cannot close TFile in the middle of key-value insertion.");
      }

      finishDataBlock(true);

      // first, write out data:TFile.meta
      BlockAppender outMeta =
          writerBCF
              .prepareMetaBlock(TFileMeta.BLOCK_NAME, COMPRESSION_NONE);
      try {
        tfileMeta.write(outMeta);
      } finally {
        outMeta.close();
      }

      // second, write out data:TFile.index
      BlockAppender outIndex =
          writerBCF.prepareMetaBlock(TFileIndex.BLOCK_NAME);
      try {
        tfileIndex.write(outIndex);
      } finally {
        outIndex.close();
      }

writerBCF.close();
    }
  } finally {
    IOUtils.cleanup(LOG, blkAppender, writerBCF);
    blkAppender = null;
    writerBCF = null;
    state = State.CLOSED;
  }
}
 
 类所在包
 类方法
 同包方法