Java 类org.apache.hadoop.hbase.coprocessor.SingletonCoprocessorService 实例源码

项目:ditb    文件:RegionServerCoprocessorHost.java   
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="BC_UNCONFIRMED_CAST",
    justification="Intentional; FB has trouble detecting isAssignableFrom")
public RegionServerEnvironment(final Class<?> implClass,
    final Coprocessor impl, final int priority, final int seq,
    final Configuration conf, final RegionServerServices services) {
  super(impl, priority, seq, conf);
  this.regionServerServices = services;
  for (Object itf : ClassUtils.getAllInterfaces(implClass)) {
    Class<?> c = (Class<?>) itf;
    if (SingletonCoprocessorService.class.isAssignableFrom(c)) {// FindBugs: BC_UNCONFIRMED_CAST
      this.regionServerServices.registerService(
        ((SingletonCoprocessorService) impl).getService());
      break;
    }
  }
}
项目:hbase    文件:RegionServerCoprocessorHost.java   
@Override
public RegionServerCoprocessor checkAndGetInstance(Class<?> implClass)
    throws InstantiationException, IllegalAccessException {
  if (RegionServerCoprocessor.class.isAssignableFrom(implClass)) {
    return (RegionServerCoprocessor)implClass.newInstance();
  } else if (SingletonCoprocessorService.class.isAssignableFrom(implClass)) {
    // For backward compatibility with old CoprocessorService impl which don't extend
    // RegionCoprocessor.
    return new CoprocessorServiceBackwardCompatiblity.RegionServerCoprocessorService(
        (SingletonCoprocessorService)implClass.newInstance());
  } else {
    LOG.error(implClass.getName() + " is not of type RegionServerCoprocessor. Check the "
        + "configuration " + CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
    return null;
  }
}
项目:pbase    文件:RegionServerCoprocessorHost.java   
public RegionServerEnvironment(final Class<?> implClass,
    final Coprocessor impl, final int priority, final int seq,
    final Configuration conf, final RegionServerServices services) {
  super(impl, priority, seq, conf);
  this.regionServerServices = services;
  for (Class c : implClass.getInterfaces()) {
    if (SingletonCoprocessorService.class.isAssignableFrom(c)) {
      this.regionServerServices.registerService(((SingletonCoprocessorService) impl).getService());
      break;
    }
  }
}