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

项目:hadoop-oss    文件: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;
  }
}
项目: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;
  }
}
项目:aliyun-oss-hadoop-fs    文件: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;
  }
}
项目: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;
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件: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;
  }
}
项目:hadoop-EAR    文件: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;
  }
}
项目:hadoop-plus    文件: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;
  }
}
项目:hops    文件: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;
  }
}
项目:hadoop-TCP    文件: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;
  }
}
项目:hadoop-on-lustre    文件: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;
  }
}
项目:hardfs    文件: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;
  }
}
项目:hadoop-on-lustre2    文件: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;
  }
}
项目: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;
  }
}
项目:hadoop-0.20    文件: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;
  }
}
项目:hortonworks-extension    文件: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;
  }
}
项目:hortonworks-extension    文件: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;
  }
}
项目: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;
  }
}