Search in sources :

Example 1 with ReplicatedMapService

use of com.hazelcast.replicatedmap.impl.ReplicatedMapService 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 ReplicatedMapService

use of com.hazelcast.replicatedmap.impl.ReplicatedMapService in project hazelcast by hazelcast.

the class ReplicationOperation method run.

@Override
public void run() throws Exception {
    ILogger logger = getLogger();
    if (logger.isFineEnabled()) {
        logger.fine("Moving replicated map (partitionId " + getPartitionId() + ") from " + getCallerAddress() + " to the new owner " + getNodeEngine().getThisAddress());
    }
    ReplicatedMapService service = getService();
    if (data == null) {
        return;
    }
    fillRecordStoreWithRecords(service);
}
Also used : ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) ILogger(com.hazelcast.logging.ILogger)

Example 3 with ReplicatedMapService

use of com.hazelcast.replicatedmap.impl.ReplicatedMapService in project hazelcast by hazelcast.

the class SizeOperation method run.

@Override
public void run() throws Exception {
    ReplicatedMapService service = getService();
    Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
    int size = 0;
    for (ReplicatedRecordStore store : stores) {
        size += store.size();
    }
    response = size;
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService)

Example 4 with ReplicatedMapService

use of com.hazelcast.replicatedmap.impl.ReplicatedMapService in project hazelcast by hazelcast.

the class PutAllOperation method run.

@Override
public void run() throws Exception {
    ReplicatedMapService service = getService();
    ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
    int partitionId = getPartitionId();
    IPartitionService partitionService = getNodeEngine().getPartitionService();
    ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
    for (int i = 0; i < entries.size(); i++) {
        Data key = entries.getKey(i);
        Data value = entries.getValue(i);
        if (partitionId != partitionService.getPartitionId(key)) {
            continue;
        }
        Object putResult = store.put(key, value);
        Data oldValue = getNodeEngine().toData(putResult);
        eventPublishingService.fireEntryListenerEvent(key, oldValue, value, name, getCallerAddress());
        VersionResponsePair response = new VersionResponsePair(putResult, store.getVersion());
        publishReplicationMessage(key, value, response);
    }
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) IPartitionService(com.hazelcast.internal.partition.IPartitionService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) Data(com.hazelcast.internal.serialization.Data) ReplicatedMapEventPublishingService(com.hazelcast.replicatedmap.impl.ReplicatedMapEventPublishingService)

Example 5 with ReplicatedMapService

use of com.hazelcast.replicatedmap.impl.ReplicatedMapService in project hazelcast by hazelcast.

the class RequestMapDataOperation method run.

@Override
public void run() throws Exception {
    ILogger logger = getLogger();
    Address callerAddress = getCallerAddress();
    int partitionId = getPartitionId();
    NodeEngine nodeEngine = getNodeEngine();
    if (logger.isFineEnabled()) {
        logger.fine("Caller " + callerAddress + " requested copy of replicated map '" + name + "' (partitionId " + partitionId + ") from " + nodeEngine.getThisAddress());
    }
    ReplicatedMapService service = getService();
    PartitionContainer container = service.getPartitionContainer(partitionId);
    ReplicatedRecordStore store = container.getOrCreateRecordStore(name);
    store.setLoaded(true);
    if (nodeEngine.getThisAddress().equals(callerAddress)) {
        return;
    }
    long version = store.getVersion();
    Set<RecordMigrationInfo> recordSet = getRecordSet(store);
    Operation op = new SyncReplicatedMapDataOperation(name, recordSet, version).setPartitionId(partitionId).setValidateTarget(false);
    OperationService operationService = nodeEngine.getOperationService();
    operationService.createInvocationBuilder(SERVICE_NAME, op, callerAddress).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
Also used : Address(com.hazelcast.cluster.Address) PartitionContainer(com.hazelcast.replicatedmap.impl.PartitionContainer) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) Operation(com.hazelcast.spi.impl.operationservice.Operation) RecordMigrationInfo(com.hazelcast.replicatedmap.impl.record.RecordMigrationInfo) NodeEngine(com.hazelcast.spi.impl.NodeEngine) ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Aggregations

ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)40 ReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)19 ReplicatedMapEventPublishingService (com.hazelcast.replicatedmap.impl.ReplicatedMapEventPublishingService)7 Test (org.junit.Test)7 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 Data (com.hazelcast.internal.serialization.Data)6 ILogger (com.hazelcast.logging.ILogger)6 QuickTest (com.hazelcast.test.annotation.QuickTest)5 Config (com.hazelcast.config.Config)4 MapService (com.hazelcast.map.impl.MapService)4 ReplicatedMapProxy (com.hazelcast.replicatedmap.impl.ReplicatedMapProxy)4 ReplicatedRecord (com.hazelcast.replicatedmap.impl.record.ReplicatedRecord)4 QueueService (com.hazelcast.collection.impl.queue.QueueService)3 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)3 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)3 ArrayList (java.util.ArrayList)3 Address (com.hazelcast.cluster.Address)2