use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class RegionManagementDUnitTest method awaitDistributedRegionMXBean.
private DistributedRegionMXBean awaitDistributedRegionMXBean(final String name) {
SystemManagementService service = getSystemManagementService_tmp();
await().until(() -> assertThat(service.getDistributedRegionMXBean(name)).isNotNull());
return service.getDistributedRegionMXBean(name);
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class RegionManagementDUnitTest method createPartitionRegion_tmp.
private void createPartitionRegion_tmp(final VM vm, final String partitionRegionName) {
vm.invoke("Create Partitioned region", () -> {
SystemManagementService service = getSystemManagementService_tmp();
RegionFactory regionFactory = getCache_tmp().createRegionFactory(RegionShortcut.PARTITION_REDUNDANT);
regionFactory.create(partitionRegionName);
});
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class RegionManagementDUnitTest method verifyPartitionRegionAfterCreate.
private void verifyPartitionRegionAfterCreate(final VM memberVM) {
memberVM.invoke("verifyPartitionRegionAfterCreate", () -> {
Region region = getCache_tmp().getRegion(PARTITIONED_REGION_PATH);
SystemManagementService service = getSystemManagementService_tmp();
RegionMXBean regionMXBean = service.getLocalRegionMBean(PARTITIONED_REGION_PATH);
verifyPartitionData(region.getAttributes(), regionMXBean.listPartitionAttributes());
});
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class AbstractCommandsController method getManagingMemberMXBean.
/**
* Lookup operation for the MemberMXBean representing the Manager in the GemFire cluster. This
* method gets an instance fo the Platform MBeanServer for this JVM process and uses it to lookup
* the MemberMXBean for the GemFire Manager based on the ObjectName declared in the
* DistributedSystemMXBean.getManagerObjectName() operation.
*
* @return a proxy instance to the MemberMXBean of the GemFire Manager.
* @see #getMBeanServer()
* @see #createMemberMXBeanForManagerUsingProxy(javax.management.MBeanServer,
* javax.management.ObjectName)
* @see org.apache.geode.management.DistributedSystemMXBean
* @see org.apache.geode.management.MemberMXBean
*/
protected synchronized MemberMXBean getManagingMemberMXBean() {
if (managingMemberMXBeanProxy == null) {
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(getCache());
MBeanServer mbs = getMBeanServer();
final DistributedSystemMXBean distributedSystemMXBean = JMX.newMXBeanProxy(mbs, MBeanJMXAdapter.getDistributedSystemName(), DistributedSystemMXBean.class);
managingMemberMXBeanProxy = createMemberMXBeanForManagerUsingProxy(mbs, distributedSystemMXBean.getMemberObjectName());
}
return managingMemberMXBeanProxy;
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class WanCommands method resumeGatewaySender.
@CliCommand(value = CliStrings.RESUME_GATEWAYSENDER, help = CliStrings.RESUME_GATEWAYSENDER__HELP)
@CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
@ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
public Result resumeGatewaySender(@CliOption(key = CliStrings.RESUME_GATEWAYSENDER__ID, mandatory = true, optionContext = ConverterHint.GATEWAY_SENDER_ID, help = CliStrings.RESUME_GATEWAYSENDER__ID__HELP) String senderId, @CliOption(key = CliStrings.RESUME_GATEWAYSENDER__GROUP, optionContext = ConverterHint.MEMBERGROUP, help = CliStrings.RESUME_GATEWAYSENDER__GROUP__HELP) String[] onGroup, @CliOption(key = CliStrings.RESUME_GATEWAYSENDER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME, help = CliStrings.RESUME_GATEWAYSENDER__MEMBER__HELP) String[] onMember) {
Result result = null;
if (senderId != null) {
senderId = senderId.trim();
}
try {
InternalCache cache = getCache();
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
GatewaySenderMXBean bean = null;
TabularResultData resultData = ResultBuilder.createTabularResultData();
Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
if (dsMembers.isEmpty()) {
return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
}
for (DistributedMember member : dsMembers) {
if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
bean = service.getLocalGatewaySenderMXBean(senderId);
} else {
ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
}
if (bean != null) {
if (bean.isRunning()) {
if (bean.isPaused()) {
bean.resume();
accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_OK, CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_RESUMED_ON_MEMBER_1, new Object[] { senderId, member.getId() }));
} else {
accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_ERROR, CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_PAUSED_ON_MEMBER_1, new Object[] { senderId, member.getId() }));
}
} else {
accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_ERROR, CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, new Object[] { senderId, member.getId() }));
}
} else {
accumulateStartResult(resultData, member.getId(), CliStrings.GATEWAY_ERROR, CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, new Object[] { senderId, member.getId() }));
}
}
result = ResultBuilder.buildResult(resultData);
} catch (Exception e) {
LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
}
return result;
}
Aggregations