@Override public void stop(final StopContext stopContext) { // The service stop can trigger the web app context destruction which involves blocking tasks like servlet context destruction, startup servlet // destruction lifecycles and such. Hence this needs to be done asynchronously to prevent the MSC threads from blocking stopContext.asynchronous(); serverExecutor.getValue().submit(new Runnable() { @Override public void run() { try { stopContext(); } finally { stopContext.complete(); } } }); }
@Override public void stop(final StopContext context) { if (executorServicesConsumer != null) executorServicesConsumer.accept(null); if (executor != null) { context.asynchronous(); new Thread(() -> { super.shutdown(); executor = null; context.complete(); }).start(); } }
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(); } }
/** * {@inheritDoc} */ public void stop(final StopContext context) { final Runnable task = new Runnable() { @Override public void run() { try { getValue().stop(); } finally { context.complete(); } } }; try { executor.getValue().submit(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
protected void stopAsync(final StopContext context, final String deploymentName, final ServiceName serviceName) { ExecutorService executorService = getLifecycleExecutorService(); Runnable r = new Runnable() { @Override public void run() { try { DEPLOYMENT_CONNECTOR_LOGGER.debugf("Stopping service %s", serviceName); WritableServiceBasedNamingStore.pushOwner(serviceName); unregisterAll(deploymentName); } finally { WritableServiceBasedNamingStore.popOwner(); context.complete(); } } }; try { executorService.execute(r); } catch (RejectedExecutionException e) { r.run(); } finally { context.asynchronous(); } }
@Override public void stop(StopContext context) { if(binderService.release()) { //we are the last user, it needs to shut down context.asynchronous(); sharedBindingController.addListener(new LifecycleListener() { @Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { if(event == LifecycleEvent.REMOVED) { context.complete(); } } }); } }
@Override public void stop(final StopContext context) { if (this.asyncStop) { Runnable task = () -> { try { this.service.stop(context); } finally { context.complete(); } }; try { this.executor.get().execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } } else { this.service.stop(context); } } }
task.run(); } finally { context.asynchronous();
@Override public void stop(final StopContext context) { // Remove the server activity suspendControllerInjector.getValue().unRegisterActivity(serverActivity); final ExecutorService service = executorInjector.getValue(); final Runnable task = () -> { // Should already be stopped, but just to be safe we'll make one more attempt serverActivity.stopRunningJobs(false); batchEnvironment = null; classLoader = null; context.complete(); }; try { service.execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
@Override public void stop(final StopContext context) { if (this.stopAsynchronously) { Runnable task = () -> { try { this.service.stop(context); } finally { context.complete(); } }; try { this.executor.getValue().execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } } else { this.service.stop(context); } } }
/** {@inheritDoc} */ public void stop(final StopContext context) { super.stop(context); if (SarLogger.ROOT_LOGGER.isTraceEnabled()) { SarLogger.ROOT_LOGGER.tracef("Stopping Service: %s", context.getController().getName()); } final Runnable task = new Runnable() { @Override public void run() { try { invokeLifecycleMethod(stopMethod, context); } catch (Exception e) { SarLogger.ROOT_LOGGER.error(SarLogger.ROOT_LOGGER.failedExecutingLegacyMethod("stop()"), e); } finally { context.complete(); } } }; try { executorSupplier.get().submit(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
/** {@inheritDoc} */ public void stop(final StopContext context) { super.stop(context); if (SarLogger.ROOT_LOGGER.isTraceEnabled()) { SarLogger.ROOT_LOGGER.tracef("Destroying Service: %s", context.getController().getName()); } final Runnable task = new Runnable() { @Override public void run() { try { if(managedReference != null) { managedReference.release(); } invokeLifecycleMethod(destroyMethod, context); } catch (Exception e) { SarLogger.ROOT_LOGGER.error(SarLogger.ROOT_LOGGER.failedExecutingLegacyMethod("destroy()"), e); } finally { uninjectDependencies(); context.complete(); } } }; try { executorSupplier.get().submit(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }
@Override public void stop(StopContext context) { if (IIOPLogger.ROOT_LOGGER.isDebugEnabled()) { IIOPLogger.ROOT_LOGGER.debugf("Stopping service %s", context.getController().getName().getCanonicalName()); } final SocketBinding socketBinding = iiopSocketBindingInjector.getOptionalValue(); final SocketBinding sslSocketBinding = iiopSSLSocketBindingInjector.getOptionalValue(); if (socketBinding != null) { socketBinding.getSocketBindings().getNamedRegistry().unregisterBinding(socketBinding.getName()); } if (sslSocketBinding != null) { sslSocketBinding.getSocketBindings().getNamedRegistry().unregisterBinding(sslSocketBinding.getName()); } // stop the ORB asynchronously. final ORBDestroyer destroyer = new ORBDestroyer(this.orb, context); try { executorInjector.getValue().execute(destroyer); } catch (RejectedExecutionException e) { destroyer.run(); } finally { context.asynchronous(); } }
public void stop(final StopContext context) { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performUndeployment(); } finally { context.complete(); } } }); }
public void stop(final StopContext context) { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performUndeployment(); } finally { context.complete(); } } }); }
public void stop(final StopContext context) { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performUndeployment(); } finally { context.complete(); } } }); }
public void stop(final StopContext context) { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performUndeployment(); } finally { context.complete(); } } }); }
public void stop(final StopContext context) { context.asynchronous(); executorInjector.getValue().submit(new Runnable() { public void run() { try { performUndeployment(); } finally { context.complete(); } } }); }
@Override public void stop(StopContext context) { this.stopContext = context; context.asynchronous(); worker.shutdown(); worker = null; }
public void stop(final StopContext context) { final ManagedJBossThreadPoolExecutorService executor; synchronized (this) { executor = this.executor; this.executor = null; } context.asynchronous(); executor.internalShutdown(); executor.addShutdownListener(StopContextEventListener.getInstance(), context); }