for (String className : defaultCPClasses) { className = className.trim(); if (findCoprocessor(className) != null) { E env = checkAndLoadInstance(implClass, priority, conf); if (env != null) { this.coprocEnvironments.add(env); abortServer(className, t);
/** * @param implClass Implementation class * @param priority priority * @param conf configuration * @throws java.io.IOException Exception */ public E checkAndLoadInstance(Class<?> implClass, int priority, Configuration conf) throws IOException { // create the instance C impl; try { impl = checkAndGetInstance(implClass); if (impl == null) { LOG.error("Cannot load coprocessor " + implClass.getSimpleName()); return null; } } catch (InstantiationException|IllegalAccessException e) { throw new IOException(e); } // create the environment E env = createEnvironment(impl, priority, loadSequence.incrementAndGet(), conf); assert env instanceof BaseEnvironment; ((BaseEnvironment<C>) env).startup(); // HBASE-4014: maintain list of loaded coprocessors for later crash analysis // if server (master or regionserver) aborts. coprocessorNames.add(implClass.getName()); return env; }
/** * The set of loaded coprocessors is stored in a static set. Since it's * statically allocated, it does not require that HMaster's cpHost be * initialized prior to accessing it. * @return a String representation of the set of names of the loaded coprocessors. */ public static String getLoadedCoprocessors() { return CoprocessorHost.getLoadedCoprocessors().toString(); }
if (skipLoadDuplicateCoprocessor && findCoprocessor(className) != null) { E cpInstance = checkAndLoadInstance(implClass, priority, conf); return cpInstance; } finally {
for (String className : defaultCPClasses) { className = className.trim(); if (findCoprocessor(className) != null) { this.coprocessors.add(loadInstance(implClass, Coprocessor.PRIORITY_SYSTEM, conf)); LOG.info("System coprocessor " + className + " was loaded " + "successfully with priority (" + priority++ + ")."); } catch (Throwable t) { abortServer(className, t);
abortServer(env, e); } else { shutdown(env); } catch (Exception x) { LOG.error("Uncaught exception when shutting down coprocessor '"
observerOperation.callObserver(); } catch (Throwable e) { handleCoprocessorThrowable(env, e); } finally { currentThread.setContextClassLoader(cl);
protected void abortServer(final E environment, final Throwable e) { abortServer(environment.getInstance().getClass().getName(), e); }
for (String className : defaultCPClasses) { className = className.trim(); if (findCoprocessor(className) != null) { continue; try { implClass = cl.loadClass(className); configured.add(loadInstance(implClass, Coprocessor.PRIORITY_SYSTEM, conf)); LOG.info("System coprocessor " + className + " was loaded " + "successfully with priority (" + priority++ + ").");
E env = createEnvironment(implClass, impl, priority, loadSequence.incrementAndGet(), conf); if (env instanceof Environment) { ((Environment)env).startup();
/** * @param implClass Implementation class * @param priority priority * @param conf configuration * @throws java.io.IOException Exception */ public void load(Class<?> implClass, int priority, Configuration conf) throws IOException { E env = loadInstance(implClass, priority, conf); coprocessors.add(env); }
.put(region, ((CoprocessorHost) region.getCoprocessorHost()).getExternalClassLoaders());
abortServer(env, e); } else { LOG.error("Removing coprocessor '" + env.toString() + "' from " + coprocessors.remove(env); try { shutdown(env); } catch (Exception x) { LOG.error("Uncaught exception when shutting down coprocessor '"
observerOperation.callObserver(); } catch (Throwable e) { handleCoprocessorThrowable(env, e); } finally { currentThread.setContextClassLoader(cl);
protected void abortServer(final CoprocessorEnvironment environment, final Throwable e) { abortServer(environment.getInstance().getClass().getName(), e); }
/** * @param implClass Implementation class * @param priority priority * @param conf configuration * @throws java.io.IOException Exception */ public E loadInstance(Class<?> implClass, int priority, Configuration conf) throws IOException { // create the instance Coprocessor impl; Object o = null; try { o = implClass.newInstance(); impl = (Coprocessor)o; } catch (InstantiationException e) { throw new IOException(e); } catch (IllegalAccessException e) { throw new IOException(e); } // create the environment E env = createEnvironment(implClass, impl, priority, ++loadSequence, conf); if (env instanceof Environment) { ((Environment)env).startup(); } // HBASE-4014: maintain list of loaded coprocessors for later crash analysis // if server (master or regionserver) aborts. coprocessorNames.add(implClass.getName()); return env; }
/** * @param implClass Implementation class * @param priority priority * @param conf configuration * @throws java.io.IOException Exception */ public void load(Class<?> implClass, int priority, Configuration conf) throws IOException { E env = loadInstance(implClass, priority, conf); coprocessors.add(env); }
.put(region, ((CoprocessorHost) region.getCoprocessorHost()).getExternalClassLoaders());
CoprocessorHost.getLoadedCoprocessors());
@Override protected void handleCoprocessorThrowable(final PhoenixMetaDataControllerEnvironment env, final Throwable e) throws IOException { if (e instanceof IOException) { if (e.getCause() instanceof DoNotRetryIOException) { throw (IOException)e.getCause(); } } super.handleCoprocessorThrowable(env, e); }