use of com.hazelcast.spi.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());
keyLoader.setMaxBatch(hazelcastProperties.getInteger(GroupProperty.MAP_LOAD_CHUNK_SIZE));
keyLoader.setMaxSize(getMaxSizePerNode(mapConfig.getMaxSizeConfig()));
keyLoader.setHasBackup(mapConfig.getTotalBackupCount() > 0);
keyLoader.setMapOperationProvider(serviceContext.getMapOperationProvider(name));
RecordStore recordStore = serviceContext.createRecordStore(mapContainer, partitionId, keyLoader);
recordStore.init();
return recordStore;
}
use of com.hazelcast.spi.partition.IPartitionService in project hazelcast by hazelcast.
the class EvictionChecker method isOwnerOrBackup.
protected boolean isOwnerOrBackup(int partitionId) {
final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
final IPartitionService partitionService = nodeEngine.getPartitionService();
final IPartition partition = partitionService.getPartition(partitionId, false);
final Address thisAddress = nodeEngine.getThisAddress();
return partition.isOwnerOrBackup(thisAddress);
}
use of com.hazelcast.spi.partition.IPartitionService in project hazelcast by hazelcast.
the class EvictionChecker method findPartitionIds.
protected List<Integer> findPartitionIds() {
final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
final IPartitionService partitionService = nodeEngine.getPartitionService();
final int partitionCount = partitionService.getPartitionCount();
List<Integer> partitionIds = null;
for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
if (isOwnerOrBackup(partitionId)) {
if (partitionIds == null) {
partitionIds = new ArrayList<Integer>();
}
partitionIds.add(partitionId);
}
}
return partitionIds == null ? Collections.<Integer>emptyList() : partitionIds;
}
use of com.hazelcast.spi.partition.IPartitionService in project hazelcast by hazelcast.
the class GetAllOperation method run.
@Override
public void run() {
IPartitionService partitionService = getNodeEngine().getPartitionService();
int partitionId = getPartitionId();
Set<Data> partitionKeySet = new HashSet<Data>();
for (Data key : keys) {
if (partitionId == partitionService.getPartitionId(key)) {
partitionKeySet.add(key);
}
}
entries = recordStore.getAll(partitionKeySet);
}
use of com.hazelcast.spi.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