use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class AddMigrationListenerMessageTask method processInternal.
@Override
protected CompletableFuture<UUID> processInternal() {
IPartitionService partitionService = getService(getServiceName());
MigrationListener listener = createMigrationListener();
if (parameters) {
return newCompletedFuture(partitionService.addLocalMigrationListener(listener));
}
return partitionService.addMigrationListenerAsync(listener);
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class PartitionContainer method createRecordStore.
private RecordStore createRecordStore(String name) {
MapServiceContext serviceContext = mapService.getMapServiceContext();
MapContainer mapContainer = serviceContext.getMapContainer(name);
MapConfig mapConfig = mapContainer.getMapConfig();
NodeEngine nodeEngine = serviceContext.getNodeEngine();
IPartitionService ps = nodeEngine.getPartitionService();
OperationService opService = nodeEngine.getOperationService();
ExecutionService execService = nodeEngine.getExecutionService();
HazelcastProperties hazelcastProperties = nodeEngine.getProperties();
MapKeyLoader keyLoader = new MapKeyLoader(name, opService, ps, nodeEngine.getClusterService(), execService, mapContainer.toData(), serviceContext.getNodeWideLoadedKeyLimiter());
keyLoader.setMaxBatch(hazelcastProperties.getInteger(ClusterProperty.MAP_LOAD_CHUNK_SIZE));
keyLoader.setMaxSize(getMaxSizePerNode(mapConfig.getEvictionConfig()));
keyLoader.setHasBackup(mapConfig.getTotalBackupCount() > 0);
keyLoader.setMapOperationProvider(serviceContext.getMapOperationProvider(name));
if (!mapContainer.isGlobalIndexEnabled()) {
Indexes indexesForMap = mapContainer.createIndexes(false);
indexes.putIfAbsent(name, indexesForMap);
}
RecordStore recordStore = serviceContext.createRecordStore(mapContainer, partitionId, keyLoader);
recordStore.init();
return recordStore;
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class MapReplicationStateHolder method entryCountOnThisNode.
// owned or backup
private long entryCountOnThisNode(MapContainer mapContainer) {
int replicaIndex = operation.getReplicaIndex();
long owned = 0;
if (mapContainer.getEvictor() != Evictor.NULL_EVICTOR && PER_NODE == mapContainer.getMapConfig().getEvictionConfig().getMaxSizePolicy()) {
MapService mapService = operation.getService();
MapServiceContext mapServiceContext = mapService.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;
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class GetAllOperation method runInternal.
@Override
protected void runInternal() {
IPartitionService partitionService = getNodeEngine().getPartitionService();
int partitionId = getPartitionId();
final int roughSize = (int) (keys.size() * SIZING_FUDGE_FACTOR / partitionService.getPartitionCount());
Set<Data> partitionKeySet = createHashSet(roughSize);
for (Data key : keys) {
if (partitionId == partitionService.getPartitionId(key)) {
partitionKeySet.add(key);
}
}
entries = recordStore.getAll(partitionKeySet, getCallerAddress());
}
use of com.hazelcast.internal.partition.IPartitionService in project hazelcast by hazelcast.
the class XAResourceImpl method clearRemoteTransactions.
private void clearRemoteTransactions(Xid xid) {
NodeEngine nodeEngine = getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
OperationService operationService = nodeEngine.getOperationService();
SerializableXID serializableXID = new SerializableXID(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
Data xidData = nodeEngine.toData(serializableXID);
int partitionId = partitionService.getPartitionId(xidData);
ClearRemoteTransactionOperation operation = new ClearRemoteTransactionOperation(xidData);
operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
}
Aggregations