public synchronized void stop() throws Exception { if (this.status == LifeCycleMBean.STARTED) { this.status = LifeCycleMBean.STOPPED; // Stop endpoints Exception exception = null; for (Endpoint endpoint : getEndpoints()) { try { endpoint.stop(); } catch (Exception e) { exception = e; } } if (exception != null) { throw exception; } } }
public synchronized void start() throws Exception { if (this.status == LifeCycleMBean.STOPPED) { // Activate endpoints List<Endpoint> activated = new ArrayList<Endpoint>(); try { for (Endpoint endpoint : getEndpoints()) { endpoint.start(); } this.status = LifeCycleMBean.STARTED; } catch (Exception e) { // Deactivate activated endpoints for (Endpoint endpoint : activated) { try { endpoint.stop(); } catch (Exception e2) { // do nothing } } throw e; } } }
public synchronized void removeEndpoint(Endpoint endpoint) throws DeploymentException { String key = endpoint.getKey(); if (this.endpoints.remove(key) == null) { throw new DeploymentException("Endpoint not found in the SU for key: " + EndpointSupport.getKey(endpoint)); } if (this.status == LifeCycleMBean.STOPPED) { try { component.prepareShutdown(endpoint); endpoint.deactivate(); } catch (Exception e) { throw new DeploymentException(e); } } else if (this.status == LifeCycleMBean.STARTED) { try { endpoint.stop(); component.prepareShutdown(endpoint); endpoint.deactivate(); } catch (Exception e) { throw new DeploymentException(e); } } }
ep.stop(); ep.deactivate();