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); } } }