public void stop(final StopContext stopContext) {
   final ServiceController<?> serviceController =
       stopContext
           .getController()
           .getServiceContainer()
           .getService(CommonDeploymentService.getServiceName(jndiName));
   if (serviceController != null) {
     serviceController.setMode(ServiceController.Mode.REMOVE);
   }
   ExecutorService executorService = executor.getValue();
   Runnable r =
       new Runnable() {
         @Override
         public void run() {
           try {
             stopService();
           } finally {
             stopContext.complete();
           }
         }
       };
   try {
     executorService.execute(r);
   } catch (RejectedExecutionException e) {
     r.run();
   } finally {
     stopContext.asynchronous();
   }
 }
Exemplo n.º 2
0
 @Override
 public synchronized void stop(StopContext context) {
   context.getController().setMode(Mode.REMOVE);
   arqService.unregisterArquillianConfig(this);
   for (String testClass : testClasses) {
     ServiceTargetAssociation.clearServiceTarget(testClass);
   }
 }
 @Override
 public void stop(StopContext context) {
   JPA_LOGGER.stoppingService("Persistence Unit", pu.getScopedPersistenceUnitName());
   if (entityManagerFactory != null) {
     WritableServiceBasedNamingStore.pushOwner(
         context.getController().getServiceContainer().subTarget());
     try {
       entityManagerFactory.close();
     } finally {
       entityManagerFactory = null;
       pu.setTempClassLoaderFactory(null);
       WritableServiceBasedNamingStore.popOwner();
     }
   }
 }
Exemplo n.º 4
0
 /**
  * Unbind the entry from the injected context.
  *
  * @param context The stop context
  */
 public synchronized void stop(StopContext context) {
   final ServiceBasedNamingStore namingStore = namingStoreValue.getValue();
   namingStore.remove(context.getController().getName());
   if (deploymentServiceName != null) {
     // remove the service name from the related deployment runtime bindings management service,
     final Set<ServiceName> duBindingReferences =
         (Set<ServiceName>)
             controller
                 .getServiceContainer()
                 .getService(JndiNamingDependencyProcessor.serviceName(deploymentServiceName))
                 .getValue();
     if (duBindingReferences != null) {
       // the set is null if the binder service was stopped by the deployment unit undeploy
       duBindingReferences.remove(controller.getName());
     }
   }
 }
Exemplo n.º 5
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);
   }
 }
  /**
   * Uninstall the Bundle associated with this deployment.
   *
   * @param context The stop context.
   */
  public synchronized void stop(StopContext context) {
    log.tracef("Uninstalling deployment: %s", deployment);
    try {
      BundleManager bundleManager = injectedBundleManager.getValue();
      bundleManager.uninstallBundle(deployment);

      ServiceController<?> controller = context.getController();
      ServiceContainer serviceContainer = controller.getServiceContainer();
      controller.setMode(Mode.REMOVE);

      // [JBAS-8801] Undeployment leaks root deployment service
      // [TODO] remove this workaround
      ServiceName serviceName = Services.deploymentUnitName(controller.getName().getSimpleName());
      ServiceController<?> deploymentController = serviceContainer.getService(serviceName);
      if (deploymentController != null) {
        deploymentController.setMode(Mode.REMOVE);
      }
    } catch (Throwable t) {
      log.errorf(t, "Failed to uninstall deployment: %s", deployment);
    }
  }
 @Override
 public synchronized void stop(StopContext context) {
   ServiceController<?> controller = context.getController();
   LOGGER.tracef("Stopping: %s in mode %s", controller.getName(), controller.getMode());
 }
Exemplo n.º 8
0
 @Override
 public synchronized void stop(StopContext context) {
   context.getController().setMode(Mode.REMOVE);
   arqService.unregisterArquillianConfig(this);
 }
Exemplo n.º 9
0
 @Override
 public void stop(StopContext context) {
   log.debugf("Stopping Service " + context.getController().getName().getCanonicalName());
   // destroy the created POA.
   this.poa.destroy(false, false);
 }
Exemplo n.º 10
0
 @Override
 public void stop(StopContext context) {
   JacORBLogger.ROOT_LOGGER.debugServiceStop(context.getController().getName().getCanonicalName());
   // destroy the created POA.
   this.poa.destroy(false, false);
 }