当前位置: 首页>>代码示例>>Java>>正文


Java ForeignExceptionSnare.rethrowException方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare.rethrowException方法的典型用法代码示例。如果您正苦于以下问题:Java ForeignExceptionSnare.rethrowException方法的具体用法?Java ForeignExceptionSnare.rethrowException怎么用?Java ForeignExceptionSnare.rethrowException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare的用法示例。


在下文中一共展示了ForeignExceptionSnare.rethrowException方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForLatch

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入方法依赖的package包/类
/**
 * Wait for latch to count to zero, ignoring any spurious wake-ups, but waking periodically to
 * check for errors
 * @param latch latch to wait on
 * @param monitor monitor to check for errors while waiting
 * @param wakeFrequency frequency to wake up and check for errors (in
 *          {@link TimeUnit#MILLISECONDS})
 * @param latchDescription description of the latch, for logging
 * @throws ForeignException type of error the monitor can throw, if the task fails
 * @throws InterruptedException if we are interrupted while waiting on latch
 */
public static void waitForLatch(CountDownLatch latch, ForeignExceptionSnare monitor,
    long wakeFrequency, String latchDescription) throws ForeignException,
    InterruptedException {
  boolean released = false;
  while (!released) {
    if (monitor != null) {
      monitor.rethrowException();
    }
    /*
    ForeignExceptionDispatcher.LOG.debug("Waiting for '" + latchDescription + "' latch. (sleep:"
        + wakeFrequency + " ms)"); */
    released = latch.await(wakeFrequency, TimeUnit.MILLISECONDS);
  }
  // check error again in case an error raised during last wait
  if (monitor != null) {
    monitor.rethrowException();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:Procedure.java

示例2: waitForLatch

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入方法依赖的package包/类
/**
 * Wait for latch to count to zero, ignoring any spurious wake-ups, but waking periodically to
 * check for errors
 * @param latch latch to wait on
 * @param monitor monitor to check for errors while waiting
 * @param wakeFrequency frequency to wake up and check for errors (in
 *          {@link TimeUnit#MILLISECONDS})
 * @param latchDescription description of the latch, for logging
 * @throws ForeignException type of error the monitor can throw, if the task fails
 * @throws InterruptedException if we are interrupted while waiting on latch
 */
public static void waitForLatch(CountDownLatch latch, ForeignExceptionSnare monitor,
    long wakeFrequency, String latchDescription) throws ForeignException,
    InterruptedException {
  boolean released = false;
  while (!released) {
    if (monitor != null) {
      monitor.rethrowException();
    }
    /*
    ForeignExceptionDispatcher.LOG.debug("Waiting for '" + latchDescription + "' latch. (sleep:"
        + wakeFrequency + " ms)"); */
    released = latch.await(wakeFrequency, TimeUnit.MILLISECONDS);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:Procedure.java

示例3: addRegionToSnapshot

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入方法依赖的package包/类
/**
 * Complete taking the snapshot on the region. Writes the region info and adds references to the
 * working snapshot directory. TODO for api consistency, consider adding another version with no
 * {@link ForeignExceptionSnare} arg. (In the future other cancellable HRegion methods could
 * eventually add a {@link ForeignExceptionSnare}, or we could do something fancier).
 * @param desc snasphot description object
 * @param exnSnare ForeignExceptionSnare that captures external exeptions in case we need to bail
 *          out. This is allowed to be null and will just be ignored in that case.
 * @throws IOException if there is an external or internal error causing the snapshot to fail
 */
public void addRegionToSnapshot(SnapshotDescription desc, ForeignExceptionSnare exnSnare)
    throws IOException {
  // This should be "fast" since we don't rewrite store files but instead
  // back up the store files by creating a reference
  Path rootDir = FSUtils.getRootDir(this.rsServices.getConfiguration());
  Path snapshotRegionDir =
      TakeSnapshotUtils.getRegionSnapshotDirectory(desc, rootDir, regionInfo.getEncodedName());

  // 1. dump region meta info into the snapshot directory
  LOG.debug("Storing region-info for snapshot.");
  checkRegioninfoOnFilesystem(snapshotRegionDir);

  // 2. iterate through all the stores in the region
  LOG.debug("Creating references for hfiles");

  // This ensures that we have an atomic view of the directory as long as we have < ls limit
  // (batch size of the files in a directory) on the namenode. Otherwise, we get back the files in
  // batches and may miss files being added/deleted. This could be more robust (iteratively
  // checking to see if we have all the files until we are sure), but the limit is currently 1000
  // files/batch, far more than the number of store files under a single column family.
  for (Store store : stores.values()) {
    // 2.1. build the snapshot reference directory for the store
    Path dstStoreDir =
        TakeSnapshotUtils.getStoreSnapshotDirectory(snapshotRegionDir,
          Bytes.toString(store.getFamily().getName()));
    List<StoreFile> storeFiles = store.getStorefiles();
    if (LOG.isDebugEnabled()) {
      LOG.debug("Adding snapshot references for " + storeFiles + " hfiles");
    }

    // 2.2. iterate through all the store's files and create "references".
    int sz = storeFiles.size();
    for (int i = 0; i < sz; i++) {
      if (exnSnare != null) {
        exnSnare.rethrowException();
      }
      StoreFile storeFile = storeFiles.get(i);
      Path file = storeFile.getPath();

      LOG.debug("Creating reference for file (" + (i + 1) + "/" + sz + ") : " + file);
      Path referenceFile = new Path(dstStoreDir, file.getName());
      boolean success = true;
      if (storeFile.isReference()) {
        // write the Reference object to the snapshot
        storeFile.getReference().write(fs, referenceFile);
      } else {
        // create "reference" to this store file. It is intentionally an empty file -- all
        // necessary information is captured by its fs location and filename. This allows us to
        // only figure out what needs to be done via a single nn operation (instead of having to
        // open and read the files as well).
        success = HBaseFileSystem.createNewFileOnFileSystem(fs, referenceFile);
      }
      if (!success) {
        throw new IOException("Failed to create reference file:" + referenceFile);
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:69,代码来源:HRegion.java

示例4: addRegionToSnapshot

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入方法依赖的package包/类
/**
 * Complete taking the snapshot on the region. Writes the region info and adds references to the
 * working snapshot directory.
 *
 * TODO for api consistency, consider adding another version with no {@link ForeignExceptionSnare}
 * arg.  (In the future other cancellable HRegion methods could eventually add a
 * {@link ForeignExceptionSnare}, or we could do something fancier).
 *
 * @param desc snasphot description object
 * @param exnSnare ForeignExceptionSnare that captures external exeptions in case we need to
 *   bail out.  This is allowed to be null and will just be ignored in that case.
 * @throws IOException if there is an external or internal error causing the snapshot to fail
 */
public void addRegionToSnapshot(SnapshotDescription desc,
    ForeignExceptionSnare exnSnare) throws IOException {
  // This should be "fast" since we don't rewrite store files but instead
  // back up the store files by creating a reference
  Path rootDir = FSUtils.getRootDir(this.rsServices.getConfiguration());
  Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);

  // 1. dump region meta info into the snapshot directory
  LOG.debug("Storing region-info for snapshot.");
  HRegionFileSystem snapshotRegionFs = HRegionFileSystem.createRegionOnFileSystem(conf,
      this.fs.getFileSystem(), snapshotDir, getRegionInfo());

  // 2. iterate through all the stores in the region
  LOG.debug("Creating references for hfiles");

  // This ensures that we have an atomic view of the directory as long as we have < ls limit
  // (batch size of the files in a directory) on the namenode. Otherwise, we get back the files in
  // batches and may miss files being added/deleted. This could be more robust (iteratively
  // checking to see if we have all the files until we are sure), but the limit is currently 1000
  // files/batch, far more than the number of store files under a single column family.
  for (Store store : stores.values()) {
    // 2.1. build the snapshot reference directory for the store
    Path dstStoreDir = snapshotRegionFs.getStoreDir(store.getFamily().getNameAsString());
    List<StoreFile> storeFiles = new ArrayList<StoreFile>(store.getStorefiles());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Adding snapshot references for " + storeFiles  + " hfiles");
    }

    // 2.2. iterate through all the store's files and create "references".
    int sz = storeFiles.size();
    for (int i = 0; i < sz; i++) {
      if (exnSnare != null) {
        exnSnare.rethrowException();
      }
      StoreFile storeFile = storeFiles.get(i);
      Path file = storeFile.getPath();

      LOG.debug("Creating reference for file (" + (i+1) + "/" + sz + ") : " + file);
      Path referenceFile = new Path(dstStoreDir, file.getName());
      boolean success = true;
      if (storeFile.isReference()) {
        // write the Reference object to the snapshot
        storeFile.getFileInfo().getReference().write(fs.getFileSystem(), referenceFile);
      } else {
        // create "reference" to this store file.  It is intentionally an empty file -- all
        // necessary information is captured by its fs location and filename.  This allows us to
        // only figure out what needs to be done via a single nn operation (instead of having to
        // open and read the files as well).
        success = fs.getFileSystem().createNewFile(referenceFile);
      }
      if (!success) {
        throw new IOException("Failed to create reference file:" + referenceFile);
      }
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:70,代码来源:HRegion.java

示例5: addRegionToSnapshot

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入方法依赖的package包/类
/**
 * Complete taking the snapshot on the region. Writes the region info and adds references to the
 * working snapshot directory.
 *
 * TODO for api consistency, consider adding another version with no {@link ForeignExceptionSnare}
 * arg.  (In the future other cancellable HRegion methods could eventually add a
 * {@link ForeignExceptionSnare}, or we could do something fancier).
 *
 * @param desc snasphot description object
 * @param exnSnare ForeignExceptionSnare that captures external exeptions in case we need to
 *   bail out.  This is allowed to be null and will just be ignored in that case.
 * @throws IOException if there is an external or internal error causing the snapshot to fail
 */
public void addRegionToSnapshot(SnapshotDescription desc,
    ForeignExceptionSnare exnSnare) throws IOException {
  // This should be "fast" since we don't rewrite store files but instead
  // back up the store files by creating a reference
  Path rootDir = FSUtils.getRootDir(this.rsServices.getConfiguration());
  Path snapshotRegionDir = TakeSnapshotUtils.getRegionSnapshotDirectory(desc, rootDir,
    regionInfo.getEncodedName());

  // 1. dump region meta info into the snapshot directory
  LOG.debug("Storing region-info for snapshot.");
  checkRegioninfoOnFilesystem(snapshotRegionDir);

  // 2. iterate through all the stores in the region
  LOG.debug("Creating references for hfiles");

  // This ensures that we have an atomic view of the directory as long as we have < ls limit
  // (batch size of the files in a directory) on the namenode. Otherwise, we get back the files in
  // batches and may miss files being added/deleted. This could be more robust (iteratively
  // checking to see if we have all the files until we are sure), but the limit is currently 1000
  // files/batch, far more than the number of store files under a single column family.
  for (Store store : stores.values()) {
    // 2.1. build the snapshot reference directory for the store
    Path dstStoreDir = TakeSnapshotUtils.getStoreSnapshotDirectory(snapshotRegionDir,
      Bytes.toString(store.getFamily().getName()));
    List<StoreFile> storeFiles = store.getStorefiles();
    if (LOG.isDebugEnabled()) {
      LOG.debug("Adding snapshot references for " + storeFiles  + " hfiles");
    }

    // 2.2. iterate through all the store's files and create "references".
    int sz = storeFiles.size();
    for (int i = 0; i < sz; i++) {
      if (exnSnare != null) {
        exnSnare.rethrowException();
      }
      StoreFile storeFile = storeFiles.get(i);
      Path file = storeFile.getPath();

      LOG.debug("Creating reference for file (" + (i+1) + "/" + sz + ") : " + file);
      Path referenceFile = new Path(dstStoreDir, file.getName());
      boolean success = true;
      if (storeFile.isReference()) {
        // write the Reference object to the snapshot
        storeFile.getReference().write(fs, referenceFile);
      } else {
        // create "reference" to this store file.  It is intentionally an empty file -- all
        // necessary information is captured by its fs location and filename.  This allows us to
        // only figure out what needs to be done via a single nn operation (instead of having to
        // open and read the files as well).
        success = HBaseFileSystem.createNewFileOnFileSystem(fs, referenceFile);
      }
      if (!success) {
        throw new IOException("Failed to create reference file:" + referenceFile);
      }
    }
  }
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:71,代码来源:HRegion.java

示例6: addRegionToSnapshot

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入方法依赖的package包/类
/**
 * Complete taking the snapshot on the region. Writes the region info and adds references to the
 * working snapshot directory.
 *
 * TODO for api consistency, consider adding another version with no {@link ForeignExceptionSnare}
 * arg.  (In the future other cancellable HRegion methods could eventually add a
 * {@link ForeignExceptionSnare}, or we could do something fancier).
 *
 * @param desc snasphot description object
 * @param exnSnare ForeignExceptionSnare that captures external exeptions in case we need to
 *   bail out.  This is allowed to be null and will just be ignored in that case.
 * @throws IOException if there is an external or internal error causing the snapshot to fail
 */
public void addRegionToSnapshot(SnapshotDescription desc,
    ForeignExceptionSnare exnSnare) throws IOException {
  // This should be "fast" since we don't rewrite store files but instead
  // back up the store files by creating a reference
  Path rootDir = FSUtils.getRootDir(this.rsServices.getConfiguration());
  Path snapshotRegionDir = TakeSnapshotUtils.getRegionSnapshotDirectory(desc, rootDir,
    regionInfo.getEncodedName());

  // 1. dump region meta info into the snapshot directory
  LOG.debug("Storing region-info for snapshot.");
  checkRegioninfoOnFilesystem(snapshotRegionDir);

  // 2. iterate through all the stores in the region
  LOG.debug("Creating references for hfiles");

  // This ensures that we have an atomic view of the directory as long as we have < ls limit
  // (batch size of the files in a directory) on the namenode. Otherwise, we get back the files in
  // batches and may miss files being added/deleted. This could be more robust (iteratively
  // checking to see if we have all the files until we are sure), but the limit is currently 1000
  // files/batch, far more than the number of store files under a single column family.
  for (Store store : stores.values()) {
    // 2.1. build the snapshot reference directory for the store
    Path dstStoreDir = TakeSnapshotUtils.getStoreSnapshotDirectory(snapshotRegionDir,
      Bytes.toString(store.getFamily().getName()));
    List<StoreFile> storeFiles = store.getStorefiles();
    if (LOG.isDebugEnabled()) {
      LOG.debug("Adding snapshot references for " + storeFiles  + " hfiles");
    }

    // 2.2. iterate through all the store's files and create "references".
    int sz = storeFiles.size();
    for (int i = 0; i < sz; i++) {
      if (exnSnare != null) {
        exnSnare.rethrowException();
      }
      Path file = storeFiles.get(i).getPath();
      // create "reference" to this store file.  It is intentionally an empty file -- all
      // necessary infomration is captured by its fs location and filename.  This allows us to
      // only figure out what needs to be done via a single nn operation (instead of having to
      // open and read the files as well).
      LOG.debug("Creating reference for file (" + (i+1) + "/" + sz + ") : " + file);
      Path referenceFile = new Path(dstStoreDir, file.getName());
      boolean success = HBaseFileSystem.createNewFileOnFileSystem(fs, referenceFile);
      if (!success) {
        throw new IOException("Failed to create reference file:" + referenceFile);
      }
    }
  }
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:63,代码来源:HRegion.java


注:本文中的org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare.rethrowException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。