use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.
the class CreateAlterDestroyRegionCommands method regionExists.
private static boolean regionExists(InternalCache cache, String regionPath) {
boolean regionFound = false;
if (regionPath != null && !Region.SEPARATOR.equals(regionPath)) {
ManagementService managementService = ManagementService.getExistingManagementService(cache);
DistributedSystemMXBean dsMBean = managementService.getDistributedSystemMXBean();
String[] allRegionPaths = dsMBean.listAllRegionPaths();
for (String allRegionPath : allRegionPaths) {
if (allRegionPath.equals(regionPath)) {
regionFound = true;
break;
}
}
}
return regionFound;
}
use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.
the class DistributedSystemBridge method addMemberToSystem.
/**
* Add a proxy to the map to be used by bridge.
*
* @param objectName object name of the proxy
* @param proxy actual proxy instance
*/
public void addMemberToSystem(ObjectName objectName, MemberMXBean proxy, FederationComponent newState) {
if (objectName.equals(thisMemberName)) {
ObjectName distrObjectName = MBeanJMXAdapter.getDistributedSystemName();
DistributedSystemMXBean systemMBean = new DistributedSystemMBean(this);
service.registerInternalMBean(systemMBean, distrObjectName);
this.systemLevelNotifEmitter = (DistributedSystemMBean) service.getDistributedSystemMXBean();
this.distListener = new DistributedSystemNotifListener();
}
if (mapOfMembers != null) {
mapOfMembers.put(objectName, proxy);
memberSetSize = mapOfMembers.values().size();
}
updateMember(objectName, newState, null);
try {
mbeanServer.addNotificationListener(objectName, distListener, null, null);
} catch (InstanceNotFoundException e) {
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage());
}
logger.info(LocalizedMessage.create(ManagementStrings.INSTANCE_NOT_FOUND, objectName));
}
}
use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.
the class DistributedSystemStatsJUnitTest method testIssue51048.
@Test
public void testIssue51048() throws InterruptedException {
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean();
CachePerfStats cachePerfStats = ((GemFireCacheImpl) cache).getCachePerfStats();
for (int i = 1; i <= 10; i++) {
cachePerfStats.incCreates();
}
sample();
service.getLocalManager().runManagementTaskAdhoc();
assertTrue(dsmbean.getAverageWrites() == 10);
sample();
service.getLocalManager().runManagementTaskAdhoc();
assertTrue(dsmbean.getAverageWrites() == 0);
}
use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.
the class TestCQDUnitTest method getNumOfCQ.
public static long getNumOfCQ() {
final WaitCriterion waitCriteria = new WaitCriterion() {
@Override
public boolean done() {
final ManagementService service = getManagementService();
final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
if (bean != null) {
if (bean.getActiveCQCount() > 0) {
return true;
}
}
return false;
}
@Override
public String description() {
return "wait for getNumOfCQ to complete and get results";
}
};
Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
assertNotNull(bean);
return bean.getActiveCQCount();
}
use of org.apache.geode.management.DistributedSystemMXBean in project geode by apache.
the class TestClientsDUnitTest method getNumOfClients.
public static Integer getNumOfClients() {
final WaitCriterion waitCriteria = new WaitCriterion() {
@Override
public boolean done() {
final ManagementService service = getManagementService();
final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
if (bean != null) {
if (bean.getNumClients() > 0) {
return true;
}
}
return false;
}
@Override
public String description() {
return "wait for getNumOfClients bean to complete and get results";
}
};
Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
assertNotNull(bean);
return Integer.valueOf(bean.getNumClients());
}
Aggregations