Esempio n. 1
0
 /** {@inheritDoc} */
 public void stop(StopContext context) {
   final T service = getValue();
   // Handle Stop
   log.debugf("Stopping Service: %s", context.getController().getName());
   try {
     Method stopMethod = service.getClass().getMethod("stop");
     ClassLoader old =
         SecurityActions.setThreadContextClassLoader(service.getClass().getClassLoader());
     try {
       stopMethod.invoke(service);
     } finally {
       SecurityActions.resetThreadContextClassLoader(old);
     }
   } catch (NoSuchMethodException e) {
   } catch (Exception e) {
     log.error("Failed to execute legacy service stop", e);
   }
 }
Esempio n. 2
0
 /** {@inheritDoc} */
 public void start(StartContext context) throws StartException {
   final T service = getValue();
   // Handle Start
   log.debugf("Starting Service: %s", context.getController().getName());
   try {
     final Method startMethod = service.getClass().getMethod("start");
     ClassLoader old =
         SecurityActions.setThreadContextClassLoader(service.getClass().getClassLoader());
     try {
       startMethod.invoke(service);
     } finally {
       SecurityActions.resetThreadContextClassLoader(old);
     }
   } catch (NoSuchMethodException e) {
   } catch (Exception e) {
     throw new StartException("Failed to execute legacy service start", e);
   }
 }