use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class SafeStateCheckOperation method run.
@Override
public void run() throws Exception {
final InternalPartitionService service = getService();
safe = service.isMemberStateSafe();
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class MapLoaderTest method findOwnerAndReplicas.
private HazelcastInstance[] findOwnerAndReplicas(HazelcastInstance[] instances, String name) {
Node node = getNode(instances[0]);
InternalPartitionService partitionService = node.getPartitionService();
int partitionId = partitionService.getPartitionId(name);
InternalPartition partition = partitionService.getPartition(partitionId);
HazelcastInstance[] ownerAndReplicas = new HazelcastInstance[instances.length];
for (int i = 0; i < instances.length; i++) {
ownerAndReplicas[i] = getInstanceForAddress(instances, partition.getReplicaAddress(i));
}
return ownerAndReplicas;
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class QueryResultSizeLimiterTest method initMocksWithConfiguration.
private void initMocksWithConfiguration(int maxResultSizeLimit, int maxLocalPartitionLimitForPreCheck, int partitionCount) {
Config config = new Config();
config.setProperty(QUERY_RESULT_SIZE_LIMIT.getName(), valueOf(maxResultSizeLimit));
config.setProperty(QUERY_MAX_LOCAL_PARTITION_LIMIT_FOR_PRE_CHECK.getName(), valueOf(maxLocalPartitionLimitForPreCheck));
config.setProperty(PARTITION_COUNT.getName(), valueOf(partitionCount));
HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
InternalPartitionService partitionService = mock(InternalPartitionService.class);
when(partitionService.getPartitionCount()).thenReturn(partitionCount);
NodeEngine nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getProperties()).thenReturn(hazelcastProperties);
when(nodeEngine.getPartitionService()).thenReturn(partitionService);
RecordStore recordStore = mock(RecordStore.class);
when(recordStore.size()).then(new RecordStoreAnswer(localPartitions.values()));
MapServiceContext mapServiceContext = mock(MapServiceContext.class);
when(mapServiceContext.getNodeEngine()).thenReturn(nodeEngine);
when(mapServiceContext.getRecordStore(anyInt(), anyString())).thenReturn(recordStore);
when(mapServiceContext.getOwnedPartitions()).thenReturn(localPartitions.keySet());
limiter = new QueryResultSizeLimiter(mapServiceContext, Logger.getLogger(QueryResultSizeLimiterTest.class));
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class InvalidationMetadataDistortionTest method distortRandomPartitionSequence.
private void distortRandomPartitionSequence(String mapName, 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();
InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
int partitionCount = partitionService.getPartitionCount();
metaDataGenerator.setCurrentSequence(mapName, getInt(partitionCount), getInt(MAX_VALUE));
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class TestPartitionUtils method getAllReplicaAddresses.
public static Map<Integer, List<Address>> getAllReplicaAddresses(Node node) {
Map<Integer, List<Address>> allReplicaAddresses = new HashMap<Integer, List<Address>>();
InternalPartitionService partitionService = node.getPartitionService();
for (int partitionId = 0; partitionId < partitionService.getPartitionCount(); partitionId++) {
allReplicaAddresses.put(partitionId, getReplicaAddresses(node, partitionId));
}
return allReplicaAddresses;
}
Aggregations