public static ObjectName getObjectName(String name) { try { return ObjectName.getInstance(name); } catch (MalformedObjectNameException e) { throw new ManagementException("For MBean name string: " + name, e); } catch (NullPointerException e) { throw new ManagementException(e); } }
public static ObjectName getObjectName(String name) { try { return ObjectName.getInstance(name); } catch (MalformedObjectNameException e) { throw new ManagementException(e); } catch (NullPointerException e) { throw new ManagementException(e); } }
/** * * This method will query the MBean from GemFire Domain * * @param objectNamePattern */ public Set<ObjectName> queryMBeans(ObjectName objectNamePattern) { Set<ObjectName> queriedNames = Collections.emptySet(); try { queriedNames = mbeanServer.queryNames(objectNamePattern, null); } catch (NullPointerException e) { throw new ManagementException(e); } return queriedNames; }
/** * Method to unregister all the local GemFire MBeans * */ public void unregisterAll() { try { ObjectName name = new ObjectName(OBJECTNAME__PREFIX + "*"); Set<ObjectName> gemFireObjects = mbeanServer.queryNames(name, null); for (ObjectName objectName : gemFireObjects) { unregisterMBean(objectName); } } catch (MalformedObjectNameException e) { throw new ManagementException(e); } catch (NullPointerException e) { throw new ManagementException(e); } }
/** * Method to unregister all the local GemFire MBeans * */ public void unregisterAll() { try { ObjectName name = new ObjectName(OBJECTNAME__PREFIX + "*"); Set<ObjectName> gemFireObjects = mbeanServer.queryNames(name, null); for (ObjectName objectName : gemFireObjects) { unregisterMBean(objectName); } } catch (MalformedObjectNameException e) { throw new ManagementException(e); } catch (NullPointerException e) { throw new ManagementException(e); } }
private void compileFilterList(String[] list, List<Pattern> patternList){ for (String s : list) { try { s = formatStringTokens(s); Pattern pattern; if(s.contains("*")){ pattern = Pattern.compile(s); }else{ pattern = Pattern.compile(s,Pattern.LITERAL); } patternList.add(pattern); } catch (NullPointerException e) { throw new ManagementException(e); } } }
private void compileFilterList(String[] list, List<Pattern> patternList){ for (String s : list) { try { s = formatStringTokens(s); Pattern pattern; if(s.contains("*")){ pattern = Pattern.compile(s); }else{ pattern = Pattern.compile(s,Pattern.LITERAL); } patternList.add(pattern); } catch (NullPointerException e) { throw new ManagementException(e); } } }
private void verifyManagementService() { if (!isStarted) { throw new ManagementException( ManagementStrings.Management_Service_MANAGEMENT_SERVICE_NOT_STARTED_YET .toLocalizedString()); } if (!system.isConnected()) { throw new ManagementException( ManagementStrings.Management_Service_NOT_CONNECTED_TO_DISTRIBUTED_SYSTEM .toLocalizedString()); } if (closed) { throw new ManagementException( ManagementStrings.Management_Service_MANAGEMENT_SERVICE_IS_CLOSED .toLocalizedString()); } }
private void verifyManagementService() { if (!isStarted) { throw new ManagementException( ManagementStrings.Management_Service_MANAGEMENT_SERVICE_NOT_STARTED_YET .toLocalizedString()); } if (!system.isConnected()) { throw new ManagementException( ManagementStrings.Management_Service_NOT_CONNECTED_TO_DISTRIBUTED_SYSTEM .toLocalizedString()); } if (closed) { throw new ManagementException( ManagementStrings.Management_Service_MANAGEMENT_SERVICE_IS_CLOSED .toLocalizedString()); } }
/** * This method will be invoked whenever a member stops being a managing node. * The exception Management exception has to be handled by the caller. * * @throws ManagementException * */ private void stopManagingActivity() { try { pooledMembershipExecutor.shutdown(); Iterator<DistributedMember> it = repo.getMonitoringRegionMap().keySet() .iterator(); while (it.hasNext()) { removeMemberArtifacts(it.next(), false); } } catch (Exception e) { throw new ManagementException(e); }finally{ // For future use } }
/** * This method will be invoked whenever a member stops being a managing node. * The exception Management exception has to be handled by the caller. * * @throws ManagementException * */ private void stopManagingActivity() { try { this.pooledMembershipExecutor.shutdownNow(); Iterator<DistributedMember> it = repo.getMonitoringRegionMap().keySet().iterator(); while (it.hasNext()) { removeMemberArtifacts(it.next(), false); } } catch (Exception e) { throw new ManagementException(e); } finally { // For future use } }
public synchronized void stopAgent() { stopHttpService(); if (!this.running) return; if (logger.isDebugEnabled()) { logger.debug("Stopping jmx manager agent"); } try { cs.stop(); UnicastRemoteObject.unexportObject(registry, true); } catch (IOException e) { throw new ManagementException(e); } this.running = false; }
public void updateProxy(ObjectName objectName, ProxyInfo proxyInfo, Object newObject, Object oldObject) { try { if (proxyInfo != null) { Class interfaceClass = proxyInfo.getProxyInterface(); service.afterUpdateProxy(objectName, interfaceClass, proxyInfo.getProxyInstance(),(FederationComponent)newObject, (FederationComponent)oldObject); } } catch (Exception e) { throw new ManagementException(e); } }
public boolean existsInCluster(Cache cache) { boolean existsInCluster = false; if (cache != null) { ManagementService managementService = ManagementService.getExistingManagementService(cache); if (managementService.isManager()) { existsInCluster = managementService != null && managementService.getDistributedRegionMXBean(regionPath) != null; } else { throw new ManagementException("Not a cache from Manager member."); } } return existsInCluster; }
public synchronized void startAgent(){ startHttpService(); if (!this.running && this.config.getJmxManagerPort() != 0) { try { configureAndStart(); } catch (IOException e) { throw new ManagementException(e); } this.running = true; } }
public boolean existsInCluster(Cache cache) { boolean existsInCluster = false; if (cache != null) { ManagementService managementService = ManagementService.getExistingManagementService(cache); if (managementService.isManager()) { existsInCluster = managementService != null && managementService.getDistributedRegionMXBean(regionPath) != null; } else { throw new ManagementException("Not a cache from Manager member."); } } return existsInCluster; }
public void updateProxy(ObjectName objectName, ProxyInfo proxyInfo, Object newObject, Object oldObject) { try { if (proxyInfo != null) { Class interfaceClass = proxyInfo.getProxyInterface(); service.afterUpdateProxy(objectName, interfaceClass, proxyInfo.getProxyInstance(),(FederationComponent)newObject, (FederationComponent)oldObject); } } catch (Exception e) { throw new ManagementException(e); } }
public synchronized void stopAgent(){ stopHttpService(); if (!this.running) return; this.logger.info(LocalizedStrings.DEBUG, "Stopping jmx manager agent"); try { cs.stop(); UnicastRemoteObject.unexportObject(registry, true); } catch (IOException e) { throw new ManagementException(e); } this.running = false; }
public synchronized void startAgent(GemFireCacheImpl cache) { // Do not start Management REST service if developer REST service is already // started. if (!isAPIRestServiceRunning(cache)) { startHttpService(isServerNode(cache)); } else { if (logger.isDebugEnabled()) { logger .debug("Developer REST APIs webapp is already running, Not Starting M&M REST and pulse!"); } } if (!this.running && this.config.getJmxManagerPort() != 0) { try { configureAndStart(); } catch (IOException e) { throw new ManagementException(e); } this.running = true; } }
/** * This method will initialize all the internal components for Management and * Monitoring * * It will a)start an JMX connectorServer b) create a notification hub * c)register the ManagementFunction */ private SystemManagementService init() { try { this.localManager = new LocalManager(repo, system, this,cache); this.localManager.startManager(); this.listener = new ManagementMembershipListener(this, logger); system.getDistributionManager().addMembershipListener(listener); isStarted = true; return this; } catch (CancelException e) { // Rethrow all CancelExceptions (fix for defect 46339) throw e; } catch (Exception e) { // Wrap all other exceptions as ManagementExceptions logger.error(e); throw new ManagementException(e); } }