@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; } } }
@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; } }
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; } } }