public void deActivate() { // passivate the activation service only if the ActiveMQ server is deactivated when it fails back // and *not* during AS7 service container shutdown or reload (AS7-6840 / AS7-6881) if (activeMQActivationController != null) { if (!activeMQActivationController.getState().in(STOPPING, REMOVED)) { // [WFLY-4597] When Artemis is deactivated during failover, we block until its // activation controller is REMOVED before giving back control to Artemis. // This allow to properly stop any service depending on the activation controller // and avoid spurious warning messages because the resources used by the services // are stopped outside the control of the services. final CountDownLatch latch = new CountDownLatch(1); activeMQActivationController.compareAndSetMode(ACTIVE, REMOVE); activeMQActivationController.addListener(new LifecycleListener() { @Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) { latch.countDown(); } } }); try { latch.await(5, TimeUnit.SECONDS); } catch (InterruptedException e) { } activeMQActivationController = null; } } } });
public void deActivate() { // passivate the activation service only if the ActiveMQ server is deactivated when it fails back // and *not* during AS7 service container shutdown or reload (AS7-6840 / AS7-6881) if (activeMQActivationController != null) { if (!activeMQActivationController.getState().in(STOPPING, REMOVED)) { // [WFLY-4597] When Artemis is deactivated during failover, we block until its // activation controller is REMOVED before giving back control to Artemis. // This allow to properly stop any service depending on the activation controller // and avoid spurious warning messages because the resources used by the services // are stopped outside the control of the services. final CountDownLatch latch = new CountDownLatch(1); activeMQActivationController.compareAndSetMode(ACTIVE, REMOVE); activeMQActivationController.addListener(new LifecycleListener() { @Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) { latch.countDown(); } } }); try { latch.await(5, TimeUnit.SECONDS); } catch (InterruptedException e) { } activeMQActivationController = null; } } } });
@Override protected void performRuntime( OperationContext context, ModelNode operation, ModelNode model ) throws OperationFailedException { String repositoryName = null; for (ServiceName serviceName : servicesToRemove(context, operation, model)) { ServiceController<?> serviceController = context.getServiceRegistry(false).getService(serviceName); //only remove a service if it's up an running if (serviceController != null && serviceController.getState().in(ServiceController.State.UP)) { context.removeService(serviceController); removedServices().put(serviceName, serviceController.getService()); if (log.isDebugEnabled()) { if (repositoryName == null) { repositoryName = repositoryName(operation); } log.debugf("service '%s' removed for repository '%s'", serviceName, repositoryName); } } } }