.getJmxConnectors(); if (getConfig().isAdminEnabled() && jmxConnectors != null && jmxConnectors.getProtocols().contains(protocol)) { try { if (ctxt != null) { try { ctxt.unbind(getConfig().getClientProviderName()); } catch (NamingException e) { LOGGER.warn("Cannot unbind the instance of ClientClusterViewProvider for the protocol {0}",
this.protocol = protocol; this.replicationEnabled = clusterViewManager instanceof ServerClusterViewManager; this.dummyRegistryName = clusterViewManager.getConfig().getDummyRegistryName(); this.dummyRegistryEnabled = clusterViewManager.getConfig().isDummyRegistryEnabled(); this.remoteRegistries = clusterViewProviderUrls;
String confDir = config.getConfDir(); if(config.isAdminEnabled()) {
mbeanDomainName = config.getMbeanDomainName(); mbeanDomainName = config.getMbeanDomainName(); mbeanName = config.getMbeanName();
return false; if (sc.isServer() && cmiConfig.getClusterViewManagerFactoryConfig().getConfig().isAdminEnabled()) { MBeanUtils.setMBeanParameters(domainName, serverName, agentId);
this.componentManager = new ComponentManager(getConfig().getComponents()); if (getConfig().isAutoConfigureComponents()) { if(getConfig().isAdminEnabled()) {
/** * Returns the list of Provider URL. * * @param protocolName * a name of protocol * @return providers of the cluster view for the protocol with the given * name * @throws ServerClusterViewManagerException * if none provider exists for the protocol with the given name */ public final List<String> getProviderURLs(final String protocolName) throws ServerClusterViewManagerException { String providerName = getConfig().getClientProviderName(); ArrayList<String> providerURLs = new ArrayList<String>(); try { for (CMIReference cmiReference : getCMIReferences(providerName, protocolName)) { providerURLs.add(cmiReference.getServerRef().getProviderURL()); } } catch (ObjectNotFoundException e) { LOGGER.error( "Cannot get CMIReferences for the provider whith name {0}", providerName, e); throw new ServerClusterViewManagerException( "Cannot get CMIReferences for the provider whith name " + providerName, e); } return providerURLs; }
/** * Binds a dummy registry to enable the load-balancing of JNDI accesses to * unclustered objects. * * @param serverRef * a reference on the local registry */ private void bindDummyRegistry(final ServerId serverRef) { String bindName = getConfig().getDummyRegistryName(); // Create an instance of CMIReference for this object CMIReference cmiReference = new CMIReference(serverRef, bindName); addObjectInstance(clusteredObjectInfoForDummyRegistry, cmiReference); watch(bindName); try { updatePolicy(bindName); } catch (PolicyFactoryException e) { LOGGER.warn("Error when updating the policy for the dummy registry", e); } catch (ObjectNotFoundException e) { LOGGER.warn("Error when updating the policy for the dummy registry", e); } }
if (this.eventComponent != null) { List<Component> components = clusterViewManagerFactory.getConfig().getComponents().getComponents(); if (components != null) { for (Component cmiEventComponent : components) {
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 informations about clustering for the object with the given name. * @param objectName a name of object * @throws RemoteException * @throws ObjectNotFoundException if none object has the given name */ public void pullAndUpdateObjectInfos(final String objectName) throws RemoteException, ObjectNotFoundException { LOGGER.debug("Updating infos for: {0} - thread is {1}", objectName, Thread.currentThread().getName()); synchronized (clientClusterViewCache) { if(objectName.equals(getConfig().getClientProviderName()) && clientClusterViewCache.getClusteredObject(objectName).getCMIReferences().isEmpty()) { LOGGER.warn("No provider URLs found for the provider, trying with the initials: ", providerServerRefs); clientClusterViewCache.getClusteredObject(objectName).setCMIReferences(providerServerRefs); } pullAddUpdateReplicationInfos(objectName); pullAndUpdatePolicy(objectName); pullAndUpdateCMIReferences(objectName); } }
clusteredObjectInfoForDummyRegistry = CMIInfoExtractor.extractClusteringInfoFromAnnotatedPOJO( getConfig().getDummyRegistryName(), null, ClusteredDummyRegistry.class, false, null); } catch (CMIInfoExtractorException e) {
if (getConfig().isAdminEnabled() && jmxConnectors != null && jmxConnectors.getProtocols().contains(protocol)) { try {
String confDir = getConfig().getConfDir(); if(getConfig().isAdminEnabled()) {
String bindName = getConfig().getClientProviderName();
/** * Registers the dummy registry as an object to watch. * @throws ClientClusterViewManagerException */ private void initDataOfDummyRegistry() throws ClientClusterViewManagerException { String dummyName = getConfig().getDummyRegistryName(); ClusteredObjectInfo clusteredObjectInfo; // Extracts informations on clustering of dummy context try { clusteredObjectInfo = CMIInfoExtractor.extractClusteringInfoFromAnnotatedPOJO( dummyName, null, ClusteredDummyRegistry.class, false, null); } catch (CMIInfoExtractorException e) { LOGGER.error("Cannot get infos for dummy registry", e); throw new ClientClusterViewManagerException("Cannot get infos for dummy registry", e); } clientClusterViewCache.addClusteredObject( clusteredObjectInfo.getClusterName(), clusteredObjectInfo.isProxyEnabled(), dummyName, null, null, clusteredObjectInfo.hasState(), clusteredObjectInfo.getApplicationExceptionNames()); watch(dummyName); }
public void clear() { dispatcher.stop(); if(ClusterViewManagerFactory.getFactory().getConfig().isAdminEnabled()) { String domain = MBeanUtils.getMBeanDomainName(); String clusterName = channel.getClusterName(); String name = domain + ":type=channel,cluster=" + clusterName + ",name=HA"; String protos = domain + ":type=protocol,cluster=" + clusterName + ",name=HA" + ",*"; try { JmxConfigurator.unregisterChannel(MBeanUtils.getMBeanServer(), name); JmxConfigurator.unregister(MBeanUtils.getMBeanServer(), protos); } catch (Exception e) { logger.warn( "Error when unregistering the channel with name {0} from the MBean server", clusterName, e); } } channel.disconnect(); channel.close(); processThread.stopExecution(); }
String providerName = getConfig().getClientProviderName();
/** * Stop the server-side manager. */ @Override public void doStop() { setRegistrationOpened(false); setImplementationAvailable(false); resumableRunnable.stopExecution(); if(getConfig().isAdminEnabled()) { String domain = MBeanUtils.getMBeanDomainName(); JChannel channel = (JChannel) distributedTree.getChannel(); String clusterName = channel.getClusterName(); MBeanServer mBeanServer = MBeanUtils.getMBeanServer(); try { JmxConfigurator.unregisterChannel(channel, mBeanServer, domain, channel.getClusterName() + ",name=" + MBeanUtils.getMbeanName()); } catch (Exception e) { LOGGER.error( "Error when unregistering the channel with name {0} from the MBean server", clusterName, e); } } connectionManager.setTimeout(0); distributedTree.stop(); }
protocolConfiguration.getProtocol(), providerUrls, ((IConfig) cmiConfig.getClusterViewManagerFactoryConfig().getConfig()).getClientProviderName())) { return false;