Search in sources :

Example 36 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class CacheReplicationOperationTest method sendsConfigObjectOverWire.

@Test
public void sendsConfigObjectOverWire() throws Exception {
    // new config
    CacheConfig config = new CacheConfig("test-cache");
    // add config to cache service
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(createHazelcastInstance());
    CacheService cacheService = nodeEngineImpl.getService(CacheService.SERVICE_NAME);
    cacheService.putCacheConfigIfAbsent(config);
    // create operation
    Operation operation = new CacheReplicationOperation(new CachePartitionSegment(cacheService, 0), 0);
    // serialize & deserialize operation
    Data data = nodeEngineImpl.toData(operation);
    CacheReplicationOperation cacheReplicationOperation = (CacheReplicationOperation) nodeEngineImpl.toObject(data);
    // new operation instance should have previously added config.
    assertContains(cacheReplicationOperation.configs, config);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) CachePartitionSegment(com.hazelcast.cache.impl.CachePartitionSegment) Data(com.hazelcast.nio.serialization.Data) Operation(com.hazelcast.spi.Operation) CacheConfig(com.hazelcast.config.CacheConfig) CacheService(com.hazelcast.cache.impl.CacheService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 37 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class QueueStoreWrapper method instrument.

void instrument(NodeEngine nodeEngine) {
    Diagnostics diagnostics = ((NodeEngineImpl) nodeEngine).getDiagnostics();
    StoreLatencyPlugin storeLatencyPlugin = diagnostics.getPlugin(StoreLatencyPlugin.class);
    if (!enabled || storeLatencyPlugin == null) {
        return;
    }
    this.store = new LatencyTrackingQueueStore(store, storeLatencyPlugin, name);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Diagnostics(com.hazelcast.internal.diagnostics.Diagnostics) StoreLatencyPlugin(com.hazelcast.internal.diagnostics.StoreLatencyPlugin)

Example 38 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class InvalidationMetadataDistortionTest method distortRandomPartitionSequence.

private void distortRandomPartitionSequence(String mapName, HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    CacheService service = nodeEngineImpl.getService(CacheService.SERVICE_NAME);
    CacheEventHandler cacheEventHandler = service.getCacheEventHandler();
    MetaDataGenerator metaDataGenerator = cacheEventHandler.getMetaDataGenerator();
    InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
    int partitionCount = partitionService.getPartitionCount();
    int randomPartition = getInt(partitionCount);
    int randomSequence = getInt(MAX_VALUE);
    metaDataGenerator.setCurrentSequence(mapName, randomPartition, randomSequence);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) CacheEventHandler(com.hazelcast.cache.impl.CacheEventHandler) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) CacheService(com.hazelcast.cache.impl.CacheService)

Example 39 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class ClientCacheMetaDataFetcherTest method distortRandomPartitionSequence.

private void distortRandomPartitionSequence(String cacheName, int partition, long sequence, HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    CacheService service = nodeEngineImpl.getService(SERVICE_NAME);
    CacheEventHandler cacheEventHandler = service.getCacheEventHandler();
    MetaDataGenerator metaDataGenerator = cacheEventHandler.getMetaDataGenerator();
    metaDataGenerator.setCurrentSequence(cacheName, partition, sequence);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) CacheEventHandler(com.hazelcast.cache.impl.CacheEventHandler) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) CacheService(com.hazelcast.cache.impl.CacheService)

Example 40 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class ClientMapMetaDataFetcherTest method distortRandomPartitionSequence.

private void distortRandomPartitionSequence(String mapName, int partition, long sequence, HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    metaDataGenerator.setCurrentSequence(mapName, partition, sequence);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Aggregations

NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)112 HazelcastInstance (com.hazelcast.core.HazelcastInstance)39 Test (org.junit.Test)32 ParallelTest (com.hazelcast.test.annotation.ParallelTest)31 QuickTest (com.hazelcast.test.annotation.QuickTest)31 Node (com.hazelcast.instance.Node)21 MapService (com.hazelcast.map.impl.MapService)20 Config (com.hazelcast.config.Config)19 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)19 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)16 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)14 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)14 ILogger (com.hazelcast.logging.ILogger)11 AssertTask (com.hazelcast.test.AssertTask)11 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)10 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)10 Address (com.hazelcast.nio.Address)10 Data (com.hazelcast.nio.serialization.Data)10 Before (org.junit.Before)10 Operation (com.hazelcast.spi.Operation)9