Search in sources :

Example 21 with DistributedSystemMXBean

use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.

the class DiskStoreCommands method diskStoreExists.

private boolean diskStoreExists(String diskStoreName) {
    InternalCache cache = getCache();
    ManagementService managementService = ManagementService.getExistingManagementService(cache);
    DistributedSystemMXBean dsMXBean = managementService.getDistributedSystemMXBean();
    Map<String, String[]> diskstore = dsMXBean.listMemberDiskstore();
    Set<Entry<String, String[]>> entrySet = diskstore.entrySet();
    for (Entry<String, String[]> entry : entrySet) {
        String[] value = entry.getValue();
        if (CliUtil.contains(value, diskStoreName)) {
            return true;
        }
    }
    return false;
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) Entry(java.util.Map.Entry) ManagementService(org.apache.geode.management.ManagementService) InternalCache(org.apache.geode.internal.cache.InternalCache)

Example 22 with DistributedSystemMXBean

use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.

the class TestRemoteClusterDUnitTest method checkRemoteClusterStatus.

/**
   * Checks Proxy GatewaySender
   * 
   * @param vm reference to VM
   */
@SuppressWarnings("serial")
protected void checkRemoteClusterStatus(final VM vm, final DistributedMember senderMember) {
    SerializableRunnable checkProxySender = new SerializableRunnable("DS Map Size") {

        public void run() {
            Cache cache = GemFireCacheImpl.getInstance();
            final WaitCriterion waitCriteria2 = new WaitCriterion() {

                @Override
                public boolean done() {
                    Cache cache = GemFireCacheImpl.getInstance();
                    final ManagementService service = ManagementService.getManagementService(cache);
                    final DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
                    if (dsBean != null) {
                        return true;
                    }
                    return false;
                }

                @Override
                public String description() {
                    return "wait for getDistributedSystemMXBean to complete and get results";
                }
            };
            Wait.waitForCriterion(waitCriteria2, 2 * 60 * 1000, 5000, true);
            ManagementService service = ManagementService.getManagementService(cache);
            final DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
            assertNotNull(dsBean);
            Map<String, Boolean> dsMap = dsBean.viewRemoteClusterStatus();
            LogWriterUtils.getLogWriter().info("Ds Map is: " + dsMap.size());
            assertNotNull(dsMap);
            assertEquals(true, dsMap.size() > 0 ? true : false);
        }
    };
    vm.invoke(checkProxySender);
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) ManagementService(org.apache.geode.management.ManagementService) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) Cache(org.apache.geode.cache.Cache)

Aggregations

DistributedSystemMXBean (org.apache.geode.management.DistributedSystemMXBean)22 ManagementService (org.apache.geode.management.ManagementService)15 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)8 SystemManagementService (org.apache.geode.management.internal.SystemManagementService)5 ObjectName (javax.management.ObjectName)4 DistributedMember (org.apache.geode.distributed.DistributedMember)4 InternalCache (org.apache.geode.internal.cache.InternalCache)3 CommandResultException (org.apache.geode.management.internal.cli.result.CommandResultException)3 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Entry (java.util.Map.Entry)2 MBeanServer (javax.management.MBeanServer)2 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)2 DistributedRegionMXBean (org.apache.geode.management.DistributedRegionMXBean)2 ConverterHint (org.apache.geode.management.cli.ConverterHint)2 CompositeResultData (org.apache.geode.management.internal.cli.result.CompositeResultData)2 FileNotFoundException (java.io.FileNotFoundException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1