Search in sources :

Example 36 with ReplicatedMapService

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

the class ReplicatedMapTtlTest method service_reset_empties_internal_ttl_schedulers.

@Test
public void service_reset_empties_internal_ttl_schedulers() {
    HazelcastInstance node = createHazelcastInstance();
    String mapName = "test";
    ReplicatedMap map = node.getReplicatedMap(mapName);
    for (int i = 0; i < 1000; i++) {
        map.put(i, i, 100, TimeUnit.DAYS);
    }
    ReplicatedMapService service = getNodeEngineImpl(node).getService(ReplicatedMapService.SERVICE_NAME);
    service.reset();
    assertAllTtlSchedulersEmpty(map);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 37 with ReplicatedMapService

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

the class AbstractBaseReplicatedRecordStoreTest method setUp.

@Before
public void setUp() {
    HazelcastInstance instance = createHazelcastInstance();
    NodeEngineImpl nodeEngine = getNodeEngineImpl(instance);
    ReplicatedMapService service = new ReplicatedMapService(nodeEngine);
    recordStore = new TestReplicatedRecordStore("recordStore", service, 0);
    recordStoreSameAttributes = new TestReplicatedRecordStore("recordStore", service, 0);
    recordStoreSameAttributes.storageRef.set(recordStore.storageRef.get());
    recordStoreOtherStorage = new TestReplicatedRecordStore("recordStore", service, 0);
    recordStoreOtherName = new TestReplicatedRecordStore("otherRecordStore", service, 0);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) Before(org.junit.Before)

Example 38 with ReplicatedMapService

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

the class AbstractReplicatedMapAddEntryListenerMessageTask method processInternal.

@Override
protected CompletableFuture<UUID> processInternal() {
    ReplicatedMapService service = getService(ReplicatedMapService.SERVICE_NAME);
    ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
    Predicate predicate = getPredicate();
    ReplicatedEntryEventFilter filter;
    if (predicate == null) {
        filter = new ReplicatedEntryEventFilter(getKey());
    } else {
        filter = new ReplicatedQueryEventFilter(getKey(), predicate);
    }
    return newCompletedFuture(eventPublishingService.addLocalEventListener(this, filter, getDistributedObjectName()));
}
Also used : ReplicatedQueryEventFilter(com.hazelcast.replicatedmap.impl.record.ReplicatedQueryEventFilter) ReplicatedEntryEventFilter(com.hazelcast.replicatedmap.impl.record.ReplicatedEntryEventFilter) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) ReplicatedMapEventPublishingService(com.hazelcast.replicatedmap.impl.ReplicatedMapEventPublishingService) Predicate(com.hazelcast.query.Predicate)

Example 39 with ReplicatedMapService

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

the class ReplicatedMapClearMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    int deletedEntrySize = 0;
    for (Object deletedEntryPerPartition : map.values()) {
        deletedEntrySize += (Integer) deletedEntryPerPartition;
    }
    ReplicatedMapService service = getService(getServiceName());
    ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
    eventPublishingService.fireMapClearedEvent(deletedEntrySize, getDistributedObjectName());
    return null;
}
Also used : ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) ReplicatedMapEventPublishingService(com.hazelcast.replicatedmap.impl.ReplicatedMapEventPublishingService)

Example 40 with ReplicatedMapService

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

the class ReplicatedMapRemoveEntryListenerMessageTask method deRegisterListener.

@Override
protected Future<Boolean> deRegisterListener() {
    ReplicatedMapService service = getService(ReplicatedMapService.SERVICE_NAME);
    ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
    return eventPublishingService.removeEventListenerAsync(parameters.name, parameters.registrationId);
}
Also used : ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) ReplicatedMapEventPublishingService(com.hazelcast.replicatedmap.impl.ReplicatedMapEventPublishingService)

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