use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class CardinalityEstimatorService method getPartitionId.
private int getPartitionId(String name) {
IPartitionService partitionService = nodeEngine.getPartitionService();
String partitionKey = getPartitionKey(name);
return partitionService.getPartitionId(partitionKey);
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class LocalLockCleanupOperation method shouldBackup.
@Override
public boolean shouldBackup() {
final NodeEngine nodeEngine = getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
IPartition partition = partitionService.getPartition(getPartitionId());
return partition.isLocal() && Boolean.TRUE.equals(response);
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class LoadAllOperation method selectThisPartitionsKeys.
/**
* Filters the {@link #keys} list for keys matching the partition on
* which this operation is executed.
*
* @return the filtered key list
*/
private List<Data> selectThisPartitionsKeys() {
final IPartitionService partitionService = mapServiceContext.getNodeEngine().getPartitionService();
final int partitionId = getPartitionId();
List<Data> dataKeys = null;
for (Data key : keys) {
if (partitionId == partitionService.getPartitionId(key)) {
if (dataKeys == null) {
dataKeys = new ArrayList<>(keys.size());
}
dataKeys.add(key);
}
}
if (dataKeys == null) {
return Collections.emptyList();
}
return dataKeys;
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class MapGetInvalidationMetaDataOperation method getOwnedPartitions.
private List<Integer> getOwnedPartitions() {
IPartitionService partitionService = getNodeEngine().getPartitionService();
Map<Address, List<Integer>> memberPartitionsMap = partitionService.getMemberPartitionsMap();
List<Integer> ownedPartitions = memberPartitionsMap.get(getNodeEngine().getThisAddress());
return ownedPartitions == null ? Collections.emptyList() : ownedPartitions;
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class MapChunk method entryCountOnThisNode.
private long entryCountOnThisNode(MapContainer mapContainer) {
int replicaIndex = getReplicaIndex();
long owned = 0;
MapServiceContext mapServiceContext = mapContainer.getMapServiceContext();
IPartitionService partitionService = mapServiceContext.getNodeEngine().getPartitionService();
int partitionCount = partitionService.getPartitionCount();
for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
if (replicaIndex == 0 ? partitionService.isPartitionOwner(partitionId) : !partitionService.isPartitionOwner(partitionId)) {
RecordStore store = mapServiceContext.getExistingRecordStore(partitionId, mapContainer.getName());
if (store != null) {
owned += store.size();
}
}
}
return owned;
}
Aggregations