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


Java BaseRegionObserver类代码示例

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


BaseRegionObserver类属于org.apache.hadoop.hbase.coprocessor包,在下文中一共展示了BaseRegionObserver类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetSetRemoveCP

import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; //导入依赖的package包/类
/**
 * Test cps in the table description
 * @throws Exception
 */
@Test
public void testGetSetRemoveCP() throws Exception {
  HTableDescriptor desc = new HTableDescriptor("table");
  // simple CP
  String className = BaseRegionObserver.class.getName();
  // add and check that it is present
  desc.addCoprocessor(className);
  assertTrue(desc.hasCoprocessor(className));
  // remove it and check that it is gone
  desc.removeCoprocessor(className);
  assertFalse(desc.hasCoprocessor(className));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:TestHTableDescriptor.java

示例2: testSetListRemoveCP

import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; //导入依赖的package包/类
/**
 * Test cps in the table description
 * @throws Exception
 */
@Test
public void testSetListRemoveCP() throws Exception {
  HTableDescriptor desc = new HTableDescriptor("testGetSetRemoveCP");
  // simple CP
  String className1 = BaseRegionObserver.class.getName();
  String className2 = SampleRegionWALObserver.class.getName();
  // Check that any coprocessor is present.
  assertTrue(desc.getCoprocessors().size() == 0);

  // Add the 1 coprocessor and check if present.
  desc.addCoprocessor(className1);
  assertTrue(desc.getCoprocessors().size() == 1);
  assertTrue(desc.getCoprocessors().contains(className1));

  // Add the 2nd coprocessor and check if present.
  // remove it and check that it is gone
  desc.addCoprocessor(className2);
  assertTrue(desc.getCoprocessors().size() == 2);
  assertTrue(desc.getCoprocessors().contains(className2));

  // Remove one and check
  desc.removeCoprocessor(className1);
  assertTrue(desc.getCoprocessors().size() == 1);
  assertFalse(desc.getCoprocessors().contains(className1));
  assertTrue(desc.getCoprocessors().contains(className2));

  // Remove the last and check
  desc.removeCoprocessor(className2);
  assertTrue(desc.getCoprocessors().size() == 0);
  assertFalse(desc.getCoprocessors().contains(className1));
  assertFalse(desc.getCoprocessors().contains(className2));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:37,代码来源:TestHTableDescriptor.java

示例3: testGetSetRemoveCP

import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; //导入依赖的package包/类
/**
 * Test cps in the table description
 * @throws Exception
 */
@Test
public void testGetSetRemoveCP() throws Exception {
  HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
  // simple CP
  String className = BaseRegionObserver.class.getName();
  // add and check that it is present
  desc.addCoprocessor(className);
  assertTrue(desc.hasCoprocessor(className));
  // remove it and check that it is gone
  desc.removeCoprocessor(className);
  assertFalse(desc.hasCoprocessor(className));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:TestHTableDescriptor.java

示例4: testSetListRemoveCP

import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; //导入依赖的package包/类
/**
 * Test cps in the table description
 * @throws Exception
 */
@Test
public void testSetListRemoveCP() throws Exception {
  HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("testGetSetRemoveCP"));
  // simple CP
  String className1 = BaseRegionObserver.class.getName();
  String className2 = SampleRegionWALObserver.class.getName();
  // Check that any coprocessor is present.
  assertTrue(desc.getCoprocessors().size() == 0);

  // Add the 1 coprocessor and check if present.
  desc.addCoprocessor(className1);
  assertTrue(desc.getCoprocessors().size() == 1);
  assertTrue(desc.getCoprocessors().contains(className1));

  // Add the 2nd coprocessor and check if present.
  // remove it and check that it is gone
  desc.addCoprocessor(className2);
  assertTrue(desc.getCoprocessors().size() == 2);
  assertTrue(desc.getCoprocessors().contains(className2));

  // Remove one and check
  desc.removeCoprocessor(className1);
  assertTrue(desc.getCoprocessors().size() == 1);
  assertFalse(desc.getCoprocessors().contains(className1));
  assertTrue(desc.getCoprocessors().contains(className2));

  // Remove the last and check
  desc.removeCoprocessor(className2);
  assertTrue(desc.getCoprocessors().size() == 0);
  assertFalse(desc.getCoprocessors().contains(className1));
  assertFalse(desc.getCoprocessors().contains(className2));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:37,代码来源:TestHTableDescriptor.java

示例5: RegionCoprocessorHost

import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; //导入依赖的package包/类
/**
 * Constructor
 * @param region the region
 * @param rsServices interface to available region server functionality
 * @param conf the configuration
 */
public RegionCoprocessorHost(final Region region,
    final RegionServerServices rsServices, final Configuration conf) {
  super(rsServices);
  this.conf = conf;
  this.rsServices = rsServices;
  this.region = region;
  this.pathPrefix = Integer.toString(this.region.getRegionInfo().hashCode());

  // load system default cp's from configuration.
  loadSystemCoprocessors(conf, REGION_COPROCESSOR_CONF_KEY);

  // load system default cp's for user tables from configuration.
  if (!region.getRegionInfo().getTable().isSystemTable()) {
    loadSystemCoprocessors(conf, USER_REGION_COPROCESSOR_CONF_KEY);
  }

  // load Coprocessor From HDFS
  loadTableCoprocessors(conf);

  // now check whether any coprocessor implements postScannerFilterRow
  boolean hasCustomPostScannerFilterRow = false;
  out: for (RegionEnvironment env: coprocessors) {
    if (env.getInstance() instanceof RegionObserver) {
      Class<?> clazz = env.getInstance().getClass();
      for(;;) {
        if (clazz == null) {
          // we must have directly implemented RegionObserver
          hasCustomPostScannerFilterRow = true;
          break out;
        }
        if (clazz == BaseRegionObserver.class) {
          // we reached BaseRegionObserver, try next coprocessor
          break;
        }
        try {
          clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class,
            InternalScanner.class, byte[].class, int.class, short.class, boolean.class);
          // this coprocessor has a custom version of postScannerFilterRow
          hasCustomPostScannerFilterRow = true;
          break out;
        } catch (NoSuchMethodException ignore) {
        }
        clazz = clazz.getSuperclass();
      }
    }
  }
  this.hasCustomPostScannerFilterRow = hasCustomPostScannerFilterRow;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:55,代码来源:RegionCoprocessorHost.java


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