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


Java RegionCoprocessorHost.findCoprocessor方法代码示例

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


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

示例1: initHRegion

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
Region initHRegion (TableName tableName, String callingMethod,
    Configuration conf, Class<?> [] implClasses, byte [][] families)
    throws IOException {
  HTableDescriptor htd = new HTableDescriptor(tableName);
  for(byte [] family : families) {
    htd.addFamily(new HColumnDescriptor(family));
  }
  HRegionInfo info = new HRegionInfo(tableName, null, null, false);
  Path path = new Path(DIR + callingMethod);
  HRegion r = HRegion.createHRegion(info, path, conf, htd);

  // this following piece is a hack.
  RegionCoprocessorHost host = new RegionCoprocessorHost(r, null, conf);
  r.setCoprocessorHost(host);

  for (Class<?> implClass : implClasses) {
    host.load(implClass, Coprocessor.PRIORITY_USER, conf);
    Coprocessor c = host.findCoprocessor(implClass.getName());
    assertNotNull(c);
  }

  // Here we have to call pre and postOpen explicitly.
  host.preOpen();
  host.postOpen();
  return r;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestCoprocessorInterface.java

示例2: verifyMethodResult

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
private void verifyMethodResult(Class c, String methodName[], byte[] tableName,
                                Object value[]) throws IOException {
  try {
    for (JVMClusterUtil.RegionServerThread t : cluster.getRegionServerThreads()) {
      for (HRegionInfo r : t.getRegionServer().getOnlineRegions()) {
        if (!Arrays.equals(r.getTableName(), tableName)) {
          continue;
        }
        RegionCoprocessorHost cph = t.getRegionServer().getOnlineRegion(r.getRegionName()).
            getCoprocessorHost();

        Coprocessor cp = cph.findCoprocessor(c.getName());
        assertNotNull(cp);
        for (int i = 0; i < methodName.length; ++i) {
          Method m = c.getMethod(methodName[i]);
          Object o = m.invoke(cp);
          assertTrue("Result of " + c.getName() + "." + methodName[i]
              + " is expected to be " + value[i].toString()
              + ", while we get " + o.toString(), o.equals(value[i]));
        }
      }
    }
  } catch (Exception e) {
    throw new IOException(e.toString());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:TestRegionObserverInterface.java

示例3: initHRegion

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
HRegion initHRegion (byte [] tableName, String callingMethod,
    Configuration conf, Class<?> [] implClasses, byte [][] families)
    throws IOException {
  HTableDescriptor htd = new HTableDescriptor(tableName);
  for(byte [] family : families) {
    htd.addFamily(new HColumnDescriptor(family));
  }
  HRegionInfo info = new HRegionInfo(tableName, null, null, false);
  Path path = new Path(DIR + callingMethod);
  HRegion r = HRegion.createHRegion(info, path, conf, htd);

  // this following piece is a hack.
  RegionCoprocessorHost host = new RegionCoprocessorHost(r, null, conf);
  r.setCoprocessorHost(host);

  for (Class<?> implClass : implClasses) {
    host.load(implClass, Coprocessor.PRIORITY_USER, conf);
    Coprocessor c = host.findCoprocessor(implClass.getName());
    assertNotNull(c);
  }

  // Here we have to call pre and postOpen explicitly.
  host.preOpen();
  host.postOpen();
  return r;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:TestCoprocessorInterface.java

示例4: initHRegion

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
HRegion initHRegion (TableName tableName, String callingMethod,
    Configuration conf, Class<?> [] implClasses, byte [][] families)
    throws IOException {
  HTableDescriptor htd = new HTableDescriptor(tableName);
  for(byte [] family : families) {
    htd.addFamily(new HColumnDescriptor(family));
  }
  HRegionInfo info = new HRegionInfo(tableName, null, null, false);
  Path path = new Path(DIR + callingMethod);
  HRegion r = HRegion.createHRegion(info, path, conf, htd);

  // this following piece is a hack.
  RegionCoprocessorHost host = new RegionCoprocessorHost(r, null, conf);
  r.setCoprocessorHost(host);

  for (Class<?> implClass : implClasses) {
    host.load(implClass, Coprocessor.PRIORITY_USER, conf);
    Coprocessor c = host.findCoprocessor(implClass.getName());
    assertNotNull(c);
  }

  // Here we have to call pre and postOpen explicitly.
  host.preOpen();
  host.postOpen();
  return r;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:27,代码来源:TestCoprocessorInterface.java

示例5: verifyMethodResult

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
private void verifyMethodResult(Class c, String methodName[], byte[] tableName,
                                Object value[]) throws IOException {
  try {
    for (JVMClusterUtil.RegionServerThread t : cluster.getRegionServerThreads()) {
      for (HRegionInfo r : ProtobufUtil.getOnlineRegions(t.getRegionServer())) {
        if (!Arrays.equals(r.getTableName(), tableName)) {
          continue;
        }
        RegionCoprocessorHost cph = t.getRegionServer().getOnlineRegion(r.getRegionName()).
            getCoprocessorHost();

        Coprocessor cp = cph.findCoprocessor(c.getName());
        assertNotNull(cp);
        for (int i = 0; i < methodName.length; ++i) {
          Method m = c.getMethod(methodName[i]);
          Object o = m.invoke(cp);
          assertTrue("Result of " + c.getName() + "." + methodName[i]
              + " is expected to be " + value[i].toString()
              + ", while we get " + o.toString(), o.equals(value[i]));
        }
      }
    }
  } catch (Exception e) {
    throw new IOException(e.toString());
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:27,代码来源:TestRegionObserverInterface.java

示例6: verifyMethodResult

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
private void verifyMethodResult(Class<?> c, String methodName[], TableName tableName,
                                Object value[]) throws IOException {
  try {
    for (JVMClusterUtil.RegionServerThread t : cluster.getRegionServerThreads()) {
      if (!t.isAlive() || t.getRegionServer().isAborted() || t.getRegionServer().isStopping()){
        continue;
      }
      for (HRegionInfo r : ProtobufUtil.getOnlineRegions(t.getRegionServer().getRSRpcServices())) {
        if (!r.getTable().equals(tableName)) {
          continue;
        }
        RegionCoprocessorHost cph = t.getRegionServer().getOnlineRegion(r.getRegionName()).
            getCoprocessorHost();

        Coprocessor cp = cph.findCoprocessor(c.getName());
        assertNotNull(cp);
        for (int i = 0; i < methodName.length; ++i) {
          Method m = c.getMethod(methodName[i]);
          Object o = m.invoke(cp);
          assertTrue("Result of " + c.getName() + "." + methodName[i]
              + " is expected to be " + value[i].toString()
              + ", while we get " + o.toString(), o.equals(value[i]));
        }
      }
    }
  } catch (Exception e) {
    throw new IOException(e.toString());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:TestRegionObserverInterface.java

示例7: testRegionObserverStacking

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
public void testRegionObserverStacking() throws Exception {
  byte[] ROW = Bytes.toBytes("testRow");
  byte[] TABLE = Bytes.toBytes(this.getClass().getSimpleName());
  byte[] A = Bytes.toBytes("A");
  byte[][] FAMILIES = new byte[][] { A } ;

  Configuration conf = HBaseConfiguration.create();
  HRegion region = initHRegion(TABLE, getClass().getName(),
    conf, FAMILIES);
  RegionCoprocessorHost h = region.getCoprocessorHost();
  h.load(ObserverA.class, Coprocessor.PRIORITY_HIGHEST, conf);
  h.load(ObserverB.class, Coprocessor.PRIORITY_USER, conf);
  h.load(ObserverC.class, Coprocessor.PRIORITY_LOWEST, conf);

  Put put = new Put(ROW);
  put.add(A, A, A);
  region.put(put);

  Coprocessor c = h.findCoprocessor(ObserverA.class.getName());
  long idA = ((ObserverA)c).id;
  c = h.findCoprocessor(ObserverB.class.getName());
  long idB = ((ObserverB)c).id;
  c = h.findCoprocessor(ObserverC.class.getName());
  long idC = ((ObserverC)c).id;

  assertTrue(idA < idB);
  assertTrue(idB < idC);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:TestRegionObserverStacking.java

示例8: testRegionObserverStacking

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
public void testRegionObserverStacking() throws Exception {
  byte[] ROW = Bytes.toBytes("testRow");
  byte[] TABLE = Bytes.toBytes(getClass().getName());
  byte[] A = Bytes.toBytes("A");
  byte[][] FAMILIES = new byte[][] { A } ;

  Configuration conf = HBaseConfiguration.create();
  HRegion region = initHRegion(TABLE, getClass().getName(),
    conf, FAMILIES);
  RegionCoprocessorHost h = region.getCoprocessorHost();
  h.load(ObserverA.class, Coprocessor.PRIORITY_HIGHEST, conf);
  h.load(ObserverB.class, Coprocessor.PRIORITY_USER, conf);
  h.load(ObserverC.class, Coprocessor.PRIORITY_LOWEST, conf);

  Put put = new Put(ROW);
  put.add(A, A, A);
  int lockid = region.obtainRowLock(ROW);
  region.put(put, lockid);
  region.releaseRowLock(lockid);

  Coprocessor c = h.findCoprocessor(ObserverA.class.getName());
  long idA = ((ObserverA)c).id;
  c = h.findCoprocessor(ObserverB.class.getName());
  long idB = ((ObserverB)c).id;
  c = h.findCoprocessor(ObserverC.class.getName());
  long idC = ((ObserverC)c).id;

  assertTrue(idA < idB);
  assertTrue(idB < idC);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:31,代码来源:TestRegionObserverStacking.java

示例9: verifyMethodResult

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
private void verifyMethodResult(Class<?> c, String methodName[], TableName tableName,
                                Object value[]) throws IOException {
  try {
    for (JVMClusterUtil.RegionServerThread t : cluster.getRegionServerThreads()) {
      if (!t.isAlive() || t.getRegionServer().isAborted() || t.getRegionServer().isStopping()){
        continue;
      }
      for (HRegionInfo r : ProtobufUtil.getOnlineRegions(t.getRegionServer())) {
        if (!r.getTable().equals(tableName)) {
          continue;
        }
        RegionCoprocessorHost cph = t.getRegionServer().getOnlineRegion(r.getRegionName()).
            getCoprocessorHost();

        Coprocessor cp = cph.findCoprocessor(c.getName());
        assertNotNull(cp);
        for (int i = 0; i < methodName.length; ++i) {
          Method m = c.getMethod(methodName[i]);
          Object o = m.invoke(cp);
          assertTrue("Result of " + c.getName() + "." + methodName[i]
              + " is expected to be " + value[i].toString()
              + ", while we get " + o.toString(), o.equals(value[i]));
        }
      }
    }
  } catch (Exception e) {
    throw new IOException(e.toString());
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:30,代码来源:TestRegionObserverInterface.java

示例10: verifyMethodResult

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
private void verifyMethodResult(Class<?> coprocessor, String methodName[], TableName tableName,
    Object value[]) throws IOException {
  try {
    for (JVMClusterUtil.RegionServerThread t : cluster.getRegionServerThreads()) {
      if (!t.isAlive() || t.getRegionServer().isAborted() || t.getRegionServer().isStopping()) {
        continue;
      }
      for (RegionInfo r : ProtobufUtil
          .getOnlineRegions(t.getRegionServer().getRSRpcServices())) {
        if (!r.getTable().equals(tableName)) {
          continue;
        }
        RegionCoprocessorHost cph =
            t.getRegionServer().getOnlineRegion(r.getRegionName()).getCoprocessorHost();

        Coprocessor cp = cph.findCoprocessor(coprocessor.getName());
        assertNotNull(cp);
        for (int i = 0; i < methodName.length; ++i) {
          Method m = coprocessor.getMethod(methodName[i]);
          Object o = m.invoke(cp);
          assertTrue("Result of " + coprocessor.getName() + "." + methodName[i]
                  + " is expected to be " + value[i].toString() + ", while we get "
                  + o.toString(), o.equals(value[i]));
        }
      }
    }
  } catch (Exception e) {
    throw new IOException(e.toString());
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:31,代码来源:TestRegionObserverInterface.java

示例11: initHRegion

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
HRegion initHRegion (TableName tableName, String callingMethod,
    Configuration conf, Class<?> [] implClasses, byte [][] families)
    throws IOException {
  HTableDescriptor htd = new HTableDescriptor(tableName);
  for(byte [] family : families) {
    htd.addFamily(new HColumnDescriptor(family));
  }
  ChunkCreator.initialize(MemStoreLABImpl.CHUNK_SIZE_DEFAULT, false, 0, 0, 0, null);
  RegionInfo info = RegionInfoBuilder.newBuilder(tableName)
      .setStartKey(null)
      .setEndKey(null)
      .setSplit(false)
      .build();
  Path path = new Path(DIR + callingMethod);
  HRegion r = HBaseTestingUtility.createRegionAndWAL(info, path, conf, htd);

  // this following piece is a hack.
  RegionCoprocessorHost host =
      new RegionCoprocessorHost(r, Mockito.mock(RegionServerServices.class), conf);
  r.setCoprocessorHost(host);

  for (Class<?> implClass : implClasses) {
    host.load((Class<? extends RegionCoprocessor>) implClass, Coprocessor.PRIORITY_USER, conf);
    Coprocessor c = host.findCoprocessor(implClass.getName());
    assertNotNull(c);
  }

  // Here we have to call pre and postOpen explicitly.
  host.preOpen();
  host.postOpen();
  return r;
}
 
开发者ID:apache,项目名称:hbase,代码行数:33,代码来源:TestCoprocessorInterface.java

示例12: testRegionObserverStacking

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
public void testRegionObserverStacking() throws Exception {
  byte[] ROW = Bytes.toBytes("testRow");
  byte[] TABLE = Bytes.toBytes(this.getClass().getSimpleName());
  byte[] A = Bytes.toBytes("A");
  byte[][] FAMILIES = new byte[][] { A } ;

  Configuration conf = TEST_UTIL.getConfiguration();
  HRegion region = initHRegion(TABLE, getClass().getName(),
    conf, FAMILIES);
  RegionCoprocessorHost h = region.getCoprocessorHost();
  h.load(ObserverA.class, Coprocessor.PRIORITY_HIGHEST, conf);
  h.load(ObserverB.class, Coprocessor.PRIORITY_USER, conf);
  h.load(ObserverC.class, Coprocessor.PRIORITY_LOWEST, conf);

  Put put = new Put(ROW);
  put.addColumn(A, A, A);
  region.put(put);

  Coprocessor c = h.findCoprocessor(ObserverA.class.getName());
  long idA = ((ObserverA)c).id;
  c = h.findCoprocessor(ObserverB.class.getName());
  long idB = ((ObserverB)c).id;
  c = h.findCoprocessor(ObserverC.class.getName());
  long idC = ((ObserverC)c).id;

  assertTrue(idA < idB);
  assertTrue(idB < idC);
  HBaseTestingUtility.closeRegionAndWAL(region);
}
 
开发者ID:apache,项目名称:hbase,代码行数:30,代码来源:TestRegionObserverStacking.java

示例13: postRollBackSplit

import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; //导入方法依赖的package包/类
@Override
public void postRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException{
    try {
        RegionCoprocessorEnvironment rce=ctx.getEnvironment();
        start(rce);
        RegionCoprocessorHost coprocessorHost=rce.getRegion().getCoprocessorHost();
        Coprocessor coprocessor=coprocessorHost.findCoprocessor(SpliceIndexEndpoint.class.getName());
        coprocessor.start(rce);
        super.postRollBackSplit(ctx);
    } catch (Throwable t) {
        throw CoprocessorUtils.getIOException(t);
    }
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:14,代码来源:SpliceIndexObserver.java


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