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();
   }
 }
 @Override
 public void stop(StopContext context) {
   String prettyVersion = environment.getProductConfig().getPrettyVersionString();
   processState.setStopping();
   ServerLogger.AS_ROOT_LOGGER.serverStopped(
       prettyVersion, Integer.valueOf((int) (context.getElapsedTime() / 1000000L)));
 }
  @Override
  public void stop(final StopContext context) {
    serverInventory = null;
    extensionRegistry.clear();
    super.stop(context);

    context.asynchronous();
    Thread executorShutdown =
        new Thread(
            new Runnable() {
              @Override
              public void run() {
                try {
                  pingScheduler.shutdownNow();
                } finally {
                  try {
                    proxyExecutor.shutdown();
                  } finally {
                    context.complete();
                  }
                }
              }
            },
            DomainModelControllerService.class.getSimpleName()
                + " ExecutorService Shutdown Thread");
    executorShutdown.start();
  }
Пример #4
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 run() {
      try {
        zooKeeperServer.getServerCnxnFactory().closeSession(tickTime);
        zooKeeperServer.getServerCnxnFactory().closeAll();
        zooKeeperServer.getServerCnxnFactory().shutdown();
        zooKeeperServer.shutdown();
      } finally {
        stopContext.complete();
      }

      log.info("Zookeeper stopped");
    }
  @Override
  public void stop(final StopContext context) {
    final ExecutorService executor = executorInjector.getValue();
    final AccessControlContext accessControlContext =
        AccessController.doPrivileged(GetAccessControlContextAction.getInstance());
    final Runnable task =
        new Runnable() {
          // run async in a background thread
          @Override
          public void run() {
            PrivilegedAction<Void> privilegedAction =
                new PrivilegedAction<Void>() {
                  // run as security privileged action
                  @Override
                  public Void run() {

                    if (phaseOnePersistenceUnitServiceInjectedValue.getOptionalValue() != null) {
                      JPA_LOGGER.stoppingPersistenceUnitService(
                          2, pu.getScopedPersistenceUnitName());
                    } else {
                      JPA_LOGGER.stoppingService(
                          "Persistence Unit", pu.getScopedPersistenceUnitName());
                    }
                    if (entityManagerFactory != null) {
                      WritableServiceBasedNamingStore.pushOwner(deploymentUnitServiceName);
                      try {
                        entityManagerFactory.close();
                      } catch (Throwable t) {
                        JPA_LOGGER.failedToStopPUService(t, pu.getScopedPersistenceUnitName());
                      } finally {
                        entityManagerFactory = null;
                        pu.setTempClassLoaderFactory(null);
                        WritableServiceBasedNamingStore.popOwner();
                        persistenceUnitRegistry.remove(getScopedPersistenceUnitName());
                      }
                    }
                    if (proxyBeanManager != null) {
                      proxyBeanManager.setDelegate(null);
                      proxyBeanManager = null;
                    }
                    context.complete();
                    return null;
                  }
                };
            WildFlySecurityManager.doChecked(privilegedAction, accessControlContext);
          }
        };
    context.asynchronous();
    executor.execute(task);
  }
 @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();
     }
   }
 }
Пример #8
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());
     }
   }
 }
Пример #9
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);
   }
 }
 @Override
 public synchronized void stop(final StopContext context) {
   Thread executorShutdown =
       new Thread(
           new Runnable() {
             @Override
             public void run() {
               try {
                 executorService.shutdown();
               } finally {
                 executorService = null;
                 context.complete();
               }
             }
           },
           "HostController ExecutorService Shutdown Thread");
   executorShutdown.start();
   context.asynchronous();
 }
Пример #11
0
  public void stop(final StopContext context) {
    controller = null;

    context.asynchronous();
    Runnable r =
        new Runnable() {
          @Override
          public void run() {
            try {
              stopAsynchronous(context);
            } finally {
              try {
                authorizer.shutdown();
              } finally {
                context.complete();
              }
            }
          }
        };
    injectedExecutorService.getValue().execute(r);
  }
 public void stop(final StopContext stopContext) {
   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();
   }
 }
  /**
   * 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);
    }
  }
Пример #14
0
  @Override
  public synchronized void stop(final StopContext context) {
    final Runnable task =
        new Runnable() {
          @Override
          public void run() {
            try {
              bridge.stop();
              MessagingLogger.MESSAGING_LOGGER.stoppedService("JMS Bridge", bridgeName);

              context.complete();
            } catch (Exception e) {
              MESSAGING_LOGGER.failedToDestroy("bridge", bridgeName);
            }
          }
        };
    try {
      executorInjector.getValue().execute(task);
    } catch (RejectedExecutionException e) {
      task.run();
    } finally {
      context.asynchronous();
    }
  }
Пример #15
0
 @Override
 public void stop(StopContext context) {
   JacORBLogger.ROOT_LOGGER.debugServiceStop(context.getController().getName().getCanonicalName());
   // destroy the created POA.
   this.poa.destroy(false, false);
 }
 @Override
 public synchronized void stop(StopContext context) {
   ServiceController<?> controller = context.getController();
   LOGGER.tracef("Stopping: %s in mode %s", controller.getName(), controller.getMode());
 }
Пример #17
0
 @Override
 public void stop(StopContext context) {
   log.debugf("Stopping Service " + context.getController().getName().getCanonicalName());
   // destroy the created POA.
   this.poa.destroy(false, false);
 }
Пример #18
0
 @Override
 public synchronized void stop(StopContext context) {
   context.getController().setMode(Mode.REMOVE);
   arqService.unregisterArquillianConfig(this);
 }
Пример #19
0
 @Override
 public synchronized void stop(final StopContext context) {
   context.asynchronous();
   executor.getValue().execute(new ZooKeeperServerDestroyer(zooKeeperServer, context));
 }