Search in sources :

Example 1 with StatisticsAwareService

use of com.hazelcast.internal.services.StatisticsAwareService in project hazelcast by hazelcast.

the class TimedMemberStateFactory method createMemState.

private void createMemState(MemberStateImpl memberState, Collection<StatisticsAwareService> services) {
    Config config = instance.getConfig();
    for (StatisticsAwareService service : services) {
        if (service instanceof MapService) {
            handleMap(memberState, ((MapService) service).getStats());
        } else if (service instanceof MultiMapService) {
            handleMultiMap(memberState, ((MultiMapService) service).getStats());
        } else if (service instanceof QueueService) {
            handleQueue(memberState, ((QueueService) service).getStats());
        } else if (service instanceof TopicService) {
            handleTopic(memberState, ((TopicService) service).getStats());
        } else if (service instanceof ReliableTopicService) {
            handleReliableTopic(memberState, ((ReliableTopicService) service).getStats());
        } else if (service instanceof DistributedExecutorService) {
            handleExecutorService(memberState, config, ((DistributedExecutorService) service).getStats());
        } else if (service instanceof DistributedScheduledExecutorService) {
            handleScheduledExecutorService(memberState, config, ((DistributedScheduledExecutorService) service).getStats());
        } else if (service instanceof DistributedDurableExecutorService) {
            handleDurableExecutorService(memberState, config, ((DistributedDurableExecutorService) service).getStats());
        } else if (service instanceof ReplicatedMapService) {
            handleReplicatedMap(memberState, config, ((ReplicatedMapService) service).getStats());
        } else if (service instanceof PNCounterService) {
            handlePNCounter(memberState, config, ((PNCounterService) service).getStats());
        } else if (service instanceof FlakeIdGeneratorService) {
            handleFlakeIdGenerator(memberState, config, ((FlakeIdGeneratorService) service).getStats());
        } else if (service instanceof CacheService) {
            handleCache(memberState, (CacheService) service);
        }
    }
    WanReplicationService wanReplicationService = instance.node.nodeEngine.getWanReplicationService();
    Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
    if (wanStats != null) {
        handleWan(memberState, wanStats);
    }
}
Also used : DistributedDurableExecutorService(com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService) StatisticsAwareService(com.hazelcast.internal.services.StatisticsAwareService) SocketInterceptorConfig(com.hazelcast.config.SocketInterceptorConfig) ConfigAccessor.getActiveMemberNetworkConfig(com.hazelcast.config.ConfigAccessor.getActiveMemberNetworkConfig) ManagementCenterConfig(com.hazelcast.config.ManagementCenterConfig) CacheConfig(com.hazelcast.config.CacheConfig) SSLConfig(com.hazelcast.config.SSLConfig) Config(com.hazelcast.config.Config) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) WanReplicationService(com.hazelcast.wan.impl.WanReplicationService) FlakeIdGeneratorService(com.hazelcast.flakeidgen.impl.FlakeIdGeneratorService) TopicService(com.hazelcast.topic.impl.TopicService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) LocalWanStats(com.hazelcast.internal.monitor.LocalWanStats) DistributedExecutorService(com.hazelcast.executor.impl.DistributedExecutorService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) PNCounterService(com.hazelcast.internal.crdt.pncounter.PNCounterService) CacheService(com.hazelcast.cache.impl.CacheService)

Example 2 with StatisticsAwareService

use of com.hazelcast.internal.services.StatisticsAwareService 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;
}
Also used : SSLConfig(com.hazelcast.config.SSLConfig) StatisticsAwareService(com.hazelcast.internal.services.StatisticsAwareService) Address(com.hazelcast.cluster.Address) SocketInterceptorConfig(com.hazelcast.config.SocketInterceptorConfig) MemberStateImpl(com.hazelcast.internal.monitor.impl.MemberStateImpl) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) ManagementCenterConfig(com.hazelcast.config.ManagementCenterConfig) Member(com.hazelcast.cluster.Member) CPMember(com.hazelcast.cp.CPMember) Nonnull(javax.annotation.Nonnull)

Example 3 with StatisticsAwareService

use of com.hazelcast.internal.services.StatisticsAwareService in project hazelcast by hazelcast.

the class AbstractMapServiceFactory method createMapService.

/**
 * Returns a {@link MapService} object by populating it with required
 * auxiliary services.
 *
 * @return {@link MapService} object
 */
@Override
public MapService createMapService() {
    NodeEngine nodeEngine = getNodeEngine();
    MapServiceContext mapServiceContext = getMapServiceContext();
    ManagedService managedService = createManagedService();
    CountingMigrationAwareService migrationAwareService = createMigrationAwareService();
    TransactionalService transactionalService = createTransactionalService();
    RemoteService remoteService = createRemoteService();
    EventPublishingService eventPublishingService = createEventPublishingService();
    PostJoinAwareService postJoinAwareService = createPostJoinAwareService();
    SplitBrainHandlerService splitBrainHandlerService = createSplitBrainHandlerService();
    WanSupportingService wanSupportingService = createReplicationSupportingService();
    StatisticsAwareService statisticsAwareService = createStatisticsAwareService();
    PartitionAwareService partitionAwareService = createPartitionAwareService();
    MapSplitBrainProtectionAwareService splitBrainProtectionAwareService = createSplitBrainProtectionAwareService();
    ClientAwareService clientAwareService = createClientAwareService();
    checkNotNull(nodeEngine, "nodeEngine should not be null");
    checkNotNull(mapServiceContext, "mapServiceContext should not be null");
    checkNotNull(managedService, "managedService should not be null");
    checkNotNull(migrationAwareService, "migrationAwareService should not be null");
    checkNotNull(transactionalService, "transactionalService should not be null");
    checkNotNull(remoteService, "remoteService should not be null");
    checkNotNull(eventPublishingService, "eventPublishingService should not be null");
    checkNotNull(postJoinAwareService, "postJoinAwareService should not be null");
    checkNotNull(splitBrainHandlerService, "splitBrainHandlerService should not be null");
    checkNotNull(wanSupportingService, "replicationSupportingService should not be null");
    checkNotNull(statisticsAwareService, "statisticsAwareService should not be null");
    checkNotNull(partitionAwareService, "partitionAwareService should not be null");
    checkNotNull(splitBrainProtectionAwareService, "splitBrainProtectionAwareService should not be null");
    checkNotNull(clientAwareService, "clientAwareService should not be null");
    MapService mapService = new MapService();
    mapService.managedService = managedService;
    mapService.migrationAwareService = migrationAwareService;
    mapService.transactionalService = transactionalService;
    mapService.remoteService = remoteService;
    mapService.eventPublishingService = eventPublishingService;
    mapService.postJoinAwareService = postJoinAwareService;
    mapService.splitBrainHandlerService = splitBrainHandlerService;
    mapService.wanSupportingService = wanSupportingService;
    mapService.statisticsAwareService = statisticsAwareService;
    mapService.mapServiceContext = mapServiceContext;
    mapService.partitionAwareService = partitionAwareService;
    mapService.splitBrainProtectionAwareService = splitBrainProtectionAwareService;
    mapService.clientAwareService = clientAwareService;
    mapServiceContext.setService(mapService);
    return mapService;
}
Also used : ManagedService(com.hazelcast.internal.services.ManagedService) StatisticsAwareService(com.hazelcast.internal.services.StatisticsAwareService) TransactionalService(com.hazelcast.internal.services.TransactionalService) CountingMigrationAwareService(com.hazelcast.spi.impl.CountingMigrationAwareService) NodeEngine(com.hazelcast.spi.impl.NodeEngine) ClientAwareService(com.hazelcast.internal.services.ClientAwareService) PostJoinAwareService(com.hazelcast.internal.services.PostJoinAwareService) RemoteService(com.hazelcast.internal.services.RemoteService) WanSupportingService(com.hazelcast.internal.services.WanSupportingService) SplitBrainHandlerService(com.hazelcast.internal.services.SplitBrainHandlerService) PartitionAwareService(com.hazelcast.internal.partition.PartitionAwareService) EventPublishingService(com.hazelcast.spi.impl.eventservice.EventPublishingService)

Example 4 with StatisticsAwareService

use of com.hazelcast.internal.services.StatisticsAwareService in project hazelcast by hazelcast.

the class LocalMapStatsUnderOnGoingClientUpdateTest method stats_generated_when_member_restarted_under_ongoing_client_update.

@Test
public void stats_generated_when_member_restarted_under_ongoing_client_update() throws Exception {
    IMap map = client.getMap(mapName);
    member.shutdown();
    member = factory.newHazelcastInstance();
    map.put(1, 1);
    map.put(2, 2);
    // get internal StatisticsAwareService.
    MapService mapService = getNodeEngineImpl(member).getService(SERVICE_NAME);
    Map<String, LocalMapStats> stats = ((StatisticsAwareService) mapService).getStats();
    LocalMapStats localMapStats = stats.get(mapName);
    // StatisticsAwareService should give right stats.
    assertNotNull("there should be 1 LocalMapStats object", localMapStats);
    assertEquals("Owned entry count should be 2", 2, localMapStats.getOwnedEntryCount());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) IMap(com.hazelcast.map.IMap) StatisticsAwareService(com.hazelcast.internal.services.StatisticsAwareService) MapService(com.hazelcast.map.impl.MapService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

StatisticsAwareService (com.hazelcast.internal.services.StatisticsAwareService)4 ManagementCenterConfig (com.hazelcast.config.ManagementCenterConfig)2 SSLConfig (com.hazelcast.config.SSLConfig)2 SocketInterceptorConfig (com.hazelcast.config.SocketInterceptorConfig)2 MapService (com.hazelcast.map.impl.MapService)2 CacheService (com.hazelcast.cache.impl.CacheService)1 Address (com.hazelcast.cluster.Address)1 Member (com.hazelcast.cluster.Member)1 MemberImpl (com.hazelcast.cluster.impl.MemberImpl)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 CacheConfig (com.hazelcast.config.CacheConfig)1 Config (com.hazelcast.config.Config)1 ConfigAccessor.getActiveMemberNetworkConfig (com.hazelcast.config.ConfigAccessor.getActiveMemberNetworkConfig)1 CPMember (com.hazelcast.cp.CPMember)1 DistributedDurableExecutorService (com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 FlakeIdGeneratorService (com.hazelcast.flakeidgen.impl.FlakeIdGeneratorService)1 PNCounterService (com.hazelcast.internal.crdt.pncounter.PNCounterService)1 LocalWanStats (com.hazelcast.internal.monitor.LocalWanStats)1 MemberStateImpl (com.hazelcast.internal.monitor.impl.MemberStateImpl)1