use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class TestPartitionUtils method collectOwnedReplicaVersions.
private static void collectOwnedReplicaVersions(Node node, Map<Integer, long[]> replicaVersions) throws InterruptedException {
InternalPartitionService partitionService = node.getPartitionService();
Address nodeAddress = node.getThisAddress();
for (IPartition partition : partitionService.getPartitions()) {
if (nodeAddress.equals(partition.getOwnerOrNull())) {
int partitionId = partition.getPartitionId();
replicaVersions.put(partitionId, getReplicaVersions(node, partitionId));
}
}
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class TestPartitionUtils method getReplicaAddresses.
public static List<Address> getReplicaAddresses(Node node, int partitionId) {
List<Address> replicaAddresses = new ArrayList<Address>();
InternalPartitionService partitionService = node.getPartitionService();
InternalPartition partition = partitionService.getPartition(partitionId);
for (int i = 0; i < MAX_REPLICA_COUNT; i++) {
replicaAddresses.add(partition.getReplicaAddress(i));
}
return replicaAddresses;
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class HazelcastTestSupport method checkPartitionCountGreaterOrEqualMemberCount.
private static void checkPartitionCountGreaterOrEqualMemberCount(HazelcastInstance instance) {
Cluster cluster = instance.getCluster();
int memberCount = cluster.getMembers().size();
InternalPartitionService internalPartitionService = getPartitionService(instance);
int partitionCount = internalPartitionService.getPartitionCount();
if (partitionCount < memberCount) {
throw new UnsupportedOperationException("Partition count should be equal or greater than member count!");
}
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class HazelcastTestSupport method isInstanceInSafeState.
public static boolean isInstanceInSafeState(HazelcastInstance instance) {
Node node = TestUtil.getNode(instance);
if (node == null) {
return true;
}
InternalPartitionService ps = node.getPartitionService();
return ps.isMemberStateSafe();
}
use of com.hazelcast.internal.partition.InternalPartitionService in project hazelcast by hazelcast.
the class HazelcastTestSupport method getPartitionId.
// ##################################
// ########## partition id ##########
// ##################################
/**
* Gets a partition id owned by this particular member.
*/
public static int getPartitionId(HazelcastInstance hz) {
warmUpPartitions(hz);
InternalPartitionService partitionService = getPartitionService(hz);
for (IPartition partition : partitionService.getPartitions()) {
if (partition.isLocal()) {
return partition.getPartitionId();
}
}
throw new RuntimeException("No local partitions are found for hz: " + hz.getName());
}
Aggregations