Search in sources :

Example 51 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getAsyncEventQueueMBeanProxy.

/**
   * Utility Method to obtain AsyncEventQueueMXBean proxy reference for a particular queue id on a
   * member
   * 
   * @param member distributed member
   * @param queueId Queue id
   * @return a reference to AsyncEventQueueMXBean
   * @throws Exception
   */
public static AsyncEventQueueMXBean getAsyncEventQueueMBeanProxy(DistributedMember member, String queueId) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName queueMBeanName = service.getAsyncEventQueueMBeanName(member, queueId);
    Wait.waitForCriterion(new WaitCriterion() {

        AsyncEventQueueMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(queueMBeanName, AsyncEventQueueMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    AsyncEventQueueMXBean bean = null;
    try {
        bean = service.getMBeanProxy(queueMBeanName, AsyncEventQueueMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :Async Event Queue MBean Proxy Should Not be Empty for : " + queueMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 52 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getLockServiceMbeanProxy.

/**
   * Utility Method to obtain LockServiceMXBean proxy reference for a particular lock service on a
   * Member
   * 
   * @param member
   * @return a reference to LockServiceMXBean
   * @throws Exception
   */
public static LockServiceMXBean getLockServiceMbeanProxy(DistributedMember member, String lockServiceName) throws Exception {
    LockServiceMXBean bean = null;
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName lockServiceMBeanName = service.getLockServiceMBeanName(member, lockServiceName);
    Wait.waitForCriterion(new WaitCriterion() {

        LockServiceMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            GemFireCacheImpl cacheImpl = (GemFireCacheImpl) cache;
            bean = service.getMBeanProxy(lockServiceMBeanName, LockServiceMXBean.class);
            boolean done = bean != null;
            return done;
        }
    }, MAX_WAIT, 500, true);
    try {
        bean = service.getMBeanProxy(lockServiceMBeanName, LockServiceMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :LockService Proxy Should Not be Empty for : " + lockServiceMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 53 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getGatewaySenderMbeanProxy.

/**
   * Utility Method to obtain GatewaySenderMXBean proxy reference for a particular sender id on a
   * member
   * 
   * @param member distributed member
   * @param gatwaySenderId sender id
   * @return a reference to GatewaySenderMXBean
   * @throws Exception
   */
public static GatewaySenderMXBean getGatewaySenderMbeanProxy(DistributedMember member, String gatwaySenderId) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName senderMBeanName = service.getGatewaySenderMBeanName(member, gatwaySenderId);
    Wait.waitForCriterion(new WaitCriterion() {

        GatewaySenderMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(senderMBeanName, GatewaySenderMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    GatewaySenderMXBean bean = null;
    try {
        bean = service.getMBeanProxy(senderMBeanName, GatewaySenderMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :GatewaySender MBean Proxy Should Not be Empty for : " + senderMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 54 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getRegionMbeanProxy.

/**
   * Utility Method to obtain RegionMXBean proxy reference for a particular region on a member
   * 
   * @param member
   * @return a reference to RegionMXBean
   * @throws Exception
   */
public static RegionMXBean getRegionMbeanProxy(DistributedMember member, String regionPath) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName regionMBeanName = service.getRegionMBeanName(member, regionPath);
    Wait.waitForCriterion(new WaitCriterion() {

        RegionMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(regionMBeanName, RegionMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    RegionMXBean bean = null;
    try {
        bean = service.getMBeanProxy(regionMBeanName, RegionMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :RegionMBean Proxy Should Not be Empty for : " + regionMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 55 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getCacheServerMbeanProxy.

/**
   * Utility Method to obtain CacheServerMXBean proxy reference for a particular Member
   * 
   * @param member
   * @return a reference to CacheServerMXBean
   * @throws Exception
   */
public static CacheServerMXBean getCacheServerMbeanProxy(DistributedMember member, int port) throws Exception {
    CacheServerMXBean bean = null;
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port, member);
    Wait.waitForCriterion(new WaitCriterion() {

        CacheServerMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            GemFireCacheImpl cacheImpl = (GemFireCacheImpl) cache;
            bean = service.getMBeanProxy(cacheServerMBeanName, CacheServerMXBean.class);
            boolean done = bean != null;
            return done;
        }
    }, MAX_WAIT, 500, true);
    try {
        bean = service.getMBeanProxy(cacheServerMBeanName, CacheServerMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :CacheServer Proxy Should Not be Empty for : " + cacheServerMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Aggregations

SystemManagementService (org.apache.geode.management.internal.SystemManagementService)83 ObjectName (javax.management.ObjectName)56 DistributedMember (org.apache.geode.distributed.DistributedMember)31 CacheServerMXBean (org.apache.geode.management.CacheServerMXBean)15 InternalCache (org.apache.geode.internal.cache.InternalCache)14 VM (org.apache.geode.test.dunit.VM)14 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)13 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)12 ExecutionException (java.util.concurrent.ExecutionException)11 CliMetaData (org.apache.geode.management.cli.CliMetaData)11 Result (org.apache.geode.management.cli.Result)11 CommandResultException (org.apache.geode.management.internal.cli.result.CommandResultException)11 ResourceOperation (org.apache.geode.management.internal.security.ResourceOperation)11 CliCommand (org.springframework.shell.core.annotation.CliCommand)11 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)10 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)8 Test (org.junit.Test)8 GatewaySenderMXBean (org.apache.geode.management.GatewaySenderMXBean)7 CompositeResultData (org.apache.geode.management.internal.cli.result.CompositeResultData)7 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)7