use of com.hazelcast.monitor.impl.MemberStateImpl in project hazelcast by hazelcast.
the class TimedMemberStateFactory method createTimedMemberState.
public TimedMemberState createTimedMemberState() {
MemberStateImpl memberState = new MemberStateImpl();
Collection<StatisticsAwareService> services = instance.node.nodeEngine.getServices(StatisticsAwareService.class);
TimedMemberState timedMemberState = new TimedMemberState();
createMemberState(timedMemberState, memberState, services);
timedMemberState.setMaster(instance.node.isMaster());
timedMemberState.setMemberList(new ArrayList<String>());
if (timedMemberState.getMaster()) {
Set<Member> memberSet = instance.getCluster().getMembers();
for (Member member : memberSet) {
MemberImpl memberImpl = (MemberImpl) member;
Address address = memberImpl.getAddress();
timedMemberState.getMemberList().add(address.getHost() + ":" + address.getPort());
}
}
timedMemberState.setMemberState(memberState);
GroupConfig groupConfig = instance.getConfig().getGroupConfig();
timedMemberState.setClusterName(groupConfig.getName());
return timedMemberState;
}
use of com.hazelcast.monitor.impl.MemberStateImpl in project hazelcast by hazelcast.
the class TimedMemberState method fromJson.
@Override
public void fromJson(JsonObject json) {
time = getLong(json, "time");
master = getBoolean(json, "master");
clusterName = getString(json, "clusterName");
instanceNames = new HashSet<String>();
final JsonArray jsonInstanceNames = getArray(json, "instanceNames");
for (JsonValue instanceName : jsonInstanceNames.values()) {
instanceNames.add(instanceName.asString());
}
memberList = new ArrayList<String>();
final JsonArray jsonMemberList = getArray(json, "memberList");
for (JsonValue member : jsonMemberList.values()) {
memberList.add(member.asString());
}
final JsonObject jsonMemberState = getObject(json, "memberState");
memberState = new MemberStateImpl();
memberState.fromJson(jsonMemberState);
}
use of com.hazelcast.monitor.impl.MemberStateImpl in project hazelcast by hazelcast.
the class PartitionServiceBeanDTOTest method testJMXStatsWithPublicAddressHostName.
/**
* https://github.com/hazelcast/hazelcast/issues/8463
*/
@Test
public void testJMXStatsWithPublicAddressHostName() {
String publicAddress = "hazelcast.org";
instance = createInstanceWithPublicAddress(publicAddress);
assumeNotNull(instance, "Internet access and/or DNS resolver are not available, " + publicAddress + " cannot be resolved!");
warmUpPartitions(instance);
MemberStateImpl memberState = new MemberStateImpl();
TimedMemberStateFactoryHelper.registerJMXBeans(getNode(instance).hazelcastInstance, memberState);
PartitionServiceBeanDTO partitionServiceDTO = memberState.getMXBeans().getPartitionServiceBean();
assertEquals(partitionServiceDTO.getPartitionCount(), partitionServiceDTO.getActivePartitionCount());
}
Aggregations