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(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();
  }
  @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 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();
 }
  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();
   }
 }
Exemplo n.º 7
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();
    }
  }
 @Override
 public synchronized void stop(final StopContext context) {
   context.asynchronous();
   executor.getValue().execute(new ZooKeeperServerDestroyer(zooKeeperServer, context));
 }