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


Java ForeignExceptionSnare类代码示例

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


ForeignExceptionSnare类属于org.apache.hadoop.hbase.errorhandling包,在下文中一共展示了ForeignExceptionSnare类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SnapshotManifest

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入依赖的package包/类
private SnapshotManifest(final Configuration conf, final FileSystem fs,
    final Path workingDir, final SnapshotDescription desc,
    final ForeignExceptionSnare monitor) {
  this.monitor = monitor;
  this.desc = desc;
  this.workingDir = workingDir;
  this.conf = conf;
  this.fs = fs;

  this.manifestSizeLimit = conf.getInt(SNAPSHOT_MANIFEST_SIZE_LIMIT_CONF_KEY, 64 * 1024 * 1024);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:SnapshotManifest.java

示例3: 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

示例4: SnapshotManifest

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入依赖的package包/类
private SnapshotManifest(final Configuration conf, final FileSystem fs,
    final Path workingDir, final SnapshotDescription desc,
    final ForeignExceptionSnare monitor) {
  this.monitor = monitor;
  this.desc = desc;
  this.workingDir = workingDir;
  this.conf = conf;
  this.fs = fs;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:10,代码来源:SnapshotManifest.java

示例5: getErrorCheckable

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入依赖的package包/类
/**
 * exposed for testing.
 */
ForeignExceptionSnare getErrorCheckable() {
  return this.monitor;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:Subprocedure.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();
      }
      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

示例7: 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

示例8: 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

示例9: 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

示例10: 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     snapshot description object
 * @param exnSnare ForeignExceptionSnare that captures external exceptions 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 {
  Path rootDir = FSUtils.getRootDir(conf);
  Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);

  SnapshotManifest manifest =
      SnapshotManifest.create(conf, getFilesystem(), snapshotDir, desc, exnSnare);
  manifest.addRegion(this);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:HRegion.java

示例11: 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.
 * <p/>
 * 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     snapshot description object
 * @param exnSnare ForeignExceptionSnare that captures external exceptions 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 {
    Path rootDir = FSUtils.getRootDir(conf);
    Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);

    SnapshotManifest manifest = SnapshotManifest.create(conf, getFilesystem(),
            snapshotDir, desc, exnSnare);
    manifest.addRegion(this);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:23,代码来源:HRegion.java

示例12: create

import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; //导入依赖的package包/类
/**
 * Return a SnapshotManifest instance, used for writing a snapshot.
 *
 * There are two usage pattern:
 *  - The Master will create a manifest, add the descriptor, offline regions
 *    and consolidate the snapshot by writing all the pending stuff on-disk.
 *      manifest = SnapshotManifest.create(...)
 *      manifest.addRegion(tableDir, hri)
 *      manifest.consolidate()
 *  - The RegionServer will create a single region manifest
 *      manifest = SnapshotManifest.create(...)
 *      manifest.addRegion(region)
 */
public static SnapshotManifest create(final Configuration conf, final FileSystem fs,
    final Path workingDir, final SnapshotDescription desc,
    final ForeignExceptionSnare monitor) {
  return new SnapshotManifest(conf, fs, workingDir, desc, monitor);

}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:SnapshotManifest.java

示例13: 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 snapshot description object
 * @param exnSnare ForeignExceptionSnare that captures external exceptions 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 {
  Path rootDir = FSUtils.getRootDir(conf);
  Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);

  SnapshotManifest manifest = SnapshotManifest.create(conf, getFilesystem(),
          snapshotDir, desc, exnSnare);
  manifest.addRegion(this);
}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:HRegion.java


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