public void destroy() { stop(); destroyed = true; }
if(getConfig() == null) { throw new ClusterViewManagerException( "This instance of cluster view manager has no configuration !!!"); if(getState().equals(State.STOPPED)) { setState(State.STARTING); this.componentManager = new ComponentManager(getConfig().getComponents()); if (getConfig().isAutoConfigureComponents()) { getComponentManager().initComponents(); } catch (ComponentException e) { throw new ClusterViewManagerException("Cannot init components", e); getComponentManager().startComponents(); } catch (ComponentException e) { throw new ClusterViewManagerException("Cannot start components", e); getEventDispatcher().start(); CMIEventComponent eventComponent = getComponent(CMIEventComponent.class); if (eventComponent != null) { eventComponent.registerCMIManagedObject(this, getEventDispatcher()); if(getConfig().isAdminEnabled()) { return starting();
public synchronized final void stop() { if(getState().equals(State.STARTED) || getState().equals(State.AVAILABLE)) { setState(State.STOPPING); stopping(); if(getConfig().isAdminEnabled()) { // Unregister the CMI MBean try { MBeanUtils.unregisterCMIMBean(); } catch (CMIMBeanConfigException e) { LOGGER.error("Cannot unregister CMIMBean", e); } } setState(State.STOPPED); LOGGER.info("Cluster view manager stopped."); } }
/** * Updates a policy of load-balancing for a object with the given name. * @param objectName a name of object * @throws ObjectNotFoundException if none object has the given name * @throws PolicyFactoryException if the policy cannot be updated */ protected final void updatePolicy(final String objectName) throws ObjectNotFoundException, PolicyFactoryException { LOGGER.debug("Updating policy for {0}", objectName); PolicyFactory<CMIReference> policyFactory = new PolicyFactory<CMIReference>(this); IPolicy<CMIReference> policy = policyFactory.getPolicy(objectName); setPolicy(objectName, policy); }