use of com.hazelcast.internal.monitor.impl.MemberStateImpl in project hazelcast by hazelcast.
the class TimedMemberStateFactory method createTimedMemberState.
@Nonnull
public TimedMemberState createTimedMemberState() {
MemberStateImpl memberState = new MemberStateImpl();
Collection<StatisticsAwareService> services = instance.node.nodeEngine.getServices(StatisticsAwareService.class);
TimedMemberState timedMemberState = new TimedMemberState();
createMemberState(memberState, services);
timedMemberState.setMaster(instance.node.isMaster());
timedMemberState.setMemberList(new ArrayList<>());
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);
timedMemberState.setClusterName(instance.getConfig().getClusterName());
SSLConfig sslConfig = getActiveMemberNetworkConfig(instance.getConfig()).getSSLConfig();
timedMemberState.setSslEnabled(sslConfig != null && sslConfig.isEnabled());
timedMemberState.setLite(instance.node.isLiteMember());
SocketInterceptorConfig interceptorConfig = getActiveMemberNetworkConfig(instance.getConfig()).getSocketInterceptorConfig();
timedMemberState.setSocketInterceptorEnabled(interceptorConfig != null && interceptorConfig.isEnabled());
ManagementCenterConfig managementCenterConfig = instance.node.getConfig().getManagementCenterConfig();
timedMemberState.setScriptingEnabled(managementCenterConfig.isScriptingEnabled());
timedMemberState.setConsoleEnabled(managementCenterConfig.isConsoleEnabled());
timedMemberState.setMcDataAccessEnabled(managementCenterConfig.isDataAccessEnabled());
return timedMemberState;
}
use of com.hazelcast.internal.monitor.impl.MemberStateImpl in project hazelcast by hazelcast.
the class TimedMemberStateTest method testOnlyCachesWithStatsEnabled_areReportedInTimedMemberState.
@Test
public void testOnlyCachesWithStatsEnabled_areReportedInTimedMemberState() {
// create 100 caches with stats enabled
for (int i = 0; i < 100; i++) {
hz.getCacheManager().getCache(CACHE_WITH_STATS_PREFIX + i);
}
// create 50 caches with stats disabled
for (int i = 0; i < 50; i++) {
ICache cacheWithoutStats = hz.getCacheManager().getCache(CACHE_WITHOUT_STATS_PREFIX + i);
// explicitly request local stats -> this registers an empty stats object in CacheService
cacheWithoutStats.getLocalCacheStatistics();
}
MemberStateImpl memberState = createState().getMemberState();
for (int i = 0; i < 100; i++) {
assertContains(memberState.getCachesWithStats(), getDistributedObjectName(CACHE_WITH_STATS_PREFIX + i));
assertNotContains(memberState.getCachesWithStats(), getDistributedObjectName(CACHE_WITHOUT_STATS_PREFIX + i));
}
}
use of com.hazelcast.internal.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");
JsonArray jsonMemberList = getArray(json, "memberList");
memberList = new ArrayList<String>(jsonMemberList.size());
for (JsonValue member : jsonMemberList.values()) {
memberList.add(member.asString());
}
JsonObject jsonMemberState = getObject(json, "memberState");
memberState = new MemberStateImpl();
memberState.fromJson(jsonMemberState);
sslEnabled = getBoolean(json, "sslEnabled", false);
lite = getBoolean(json, "lite");
socketInterceptorEnabled = getBoolean(json, "socketInterceptorEnabled");
scriptingEnabled = getBoolean(json, "scriptingEnabled");
consoleEnabled = getBoolean(json, "consoleEnabled");
mcDataAccessEnabled = getBoolean(json, "mcDataAccessEnabled");
}
Aggregations