Search in sources :

Example 71 with NodeEngineImpl

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

the class InvalidationMetadataDistortionTest method distortRandomPartitionUuid.

private void distortRandomPartitionUuid(HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    int partitionCount = nodeEngineImpl.getPartitionService().getPartitionCount();
    int partitionId = getInt(partitionCount);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    metaDataGenerator.setUuid(partitionId, UuidUtil.newSecureUUID());
}
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)

Example 72 with NodeEngineImpl

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

the class TimedMemberStateFactory method isCacheServiceEnabled.

private boolean isCacheServiceEnabled() {
    NodeEngineImpl nodeEngine = instance.node.nodeEngine;
    Collection<ServiceInfo> serviceInfos = nodeEngine.getServiceInfos(CacheService.class);
    return !serviceInfos.isEmpty();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ServiceInfo(com.hazelcast.spi.impl.servicemanager.ServiceInfo)

Example 73 with NodeEngineImpl

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

the class UpdateManagementCenterUrlOperation method run.

@Override
public void run() throws Exception {
    ManagementCenterService service = ((NodeEngineImpl) getNodeEngine()).getManagementCenterService();
    int count = 0;
    while (service == null && count < REDO_COUNT) {
        Thread.sleep(SLEEP_MILLIS);
        count++;
        service = ((NodeEngineImpl) getNodeEngine()).getManagementCenterService();
    }
    if (service != null) {
        service.updateManagementCenterUrl(newUrl);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ManagementCenterService(com.hazelcast.internal.management.ManagementCenterService)

Example 74 with NodeEngineImpl

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

the class ListKeyValueSource method open.

@Override
public boolean open(NodeEngine nodeEngine) {
    NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
    ss = nei.getSerializationService();
    Address thisAddress = nei.getThisAddress();
    IPartitionService ps = nei.getPartitionService();
    Data data = ss.toData(listName, StringAndPartitionAwarePartitioningStrategy.INSTANCE);
    int partitionId = ps.getPartitionId(data);
    Address partitionOwner = ps.getPartitionOwner(partitionId);
    if (partitionOwner == null) {
        return false;
    }
    if (thisAddress.equals(partitionOwner)) {
        ListService listService = nei.getService(ListService.SERVICE_NAME);
        ListContainer listContainer = listService.getOrCreateContainer(listName, false);
        List<CollectionItem> items = new ArrayList<CollectionItem>(listContainer.getCollection());
        iterator = items.iterator();
    }
    return true;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ListService(com.hazelcast.collection.impl.list.ListService) Address(com.hazelcast.nio.Address) IPartitionService(com.hazelcast.spi.partition.IPartitionService) ArrayList(java.util.ArrayList) Data(com.hazelcast.nio.serialization.Data) ListContainer(com.hazelcast.collection.impl.list.ListContainer) CollectionItem(com.hazelcast.collection.impl.collection.CollectionItem)

Example 75 with NodeEngineImpl

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

the class RingbufferStoreWrapper 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 LatencyTrackingRingbufferStore(store, storeLatencyPlugin, name);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Diagnostics(com.hazelcast.internal.diagnostics.Diagnostics) StoreLatencyPlugin(com.hazelcast.internal.diagnostics.StoreLatencyPlugin)

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