Exemplo n.º 1
1
 /** Clean up the environment */
 protected void shutdown() {
   if (state == Coprocessor.State.ACTIVE) {
     state = Coprocessor.State.STOPPING;
     Thread currentThread = Thread.currentThread();
     ClassLoader hostClassLoader = currentThread.getContextClassLoader();
     try {
       currentThread.setContextClassLoader(this.getClassLoader());
       impl.stop(this);
       state = Coprocessor.State.STOPPED;
     } catch (IOException ioe) {
       LOG.error("Error stopping coprocessor " + impl.getClass().getName(), ioe);
     } finally {
       currentThread.setContextClassLoader(hostClassLoader);
     }
   } else {
     LOG.warn(
         "Not stopping coprocessor "
             + impl.getClass().getName()
             + " because not active (state="
             + state.toString()
             + ")");
   }
   // clean up any table references
   for (HTableInterface table : openTables) {
     try {
       ((HTableWrapper) table).internalClose();
     } catch (IOException e) {
       // nothing can be done here
       LOG.warn("Failed to close " + Bytes.toStringBinary(table.getTableName()), e);
     }
   }
 }
Exemplo n.º 2
0
 /** Initialize the environment */
 public void startup() throws IOException {
   if (state == Coprocessor.State.INSTALLED || state == Coprocessor.State.STOPPED) {
     state = Coprocessor.State.STARTING;
     Thread currentThread = Thread.currentThread();
     ClassLoader hostClassLoader = currentThread.getContextClassLoader();
     try {
       currentThread.setContextClassLoader(this.getClassLoader());
       impl.start(this);
       state = Coprocessor.State.ACTIVE;
     } finally {
       currentThread.setContextClassLoader(hostClassLoader);
     }
   } else {
     LOG.warn(
         "Not starting coprocessor "
             + impl.getClass().getName()
             + " because not inactive (state="
             + state.toString()
             + ")");
   }
 }