private ClientMessage invokeWithPredicate(ClientMessage request, Predicate predicate) { ClientMessage response; if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; response = invoke(request, partitionPredicate.getPartitionKey()); } else { response = invoke(request); } return response; }
private ClientMessage invokeWithPredicate(ClientMessage request, Predicate predicate) { ClientMessage response; if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; response = invoke(request, partitionPredicate.getPartitionKey()); } else { response = invoke(request); } return response; }
if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; Data key = toData(partitionPredicate.getPartitionKey()); int partitionId = partitionService.getPartitionId(key); handleHazelcastInstanceAwareParams(partitionPredicate.getTarget());
protected void removeAllInternal(Predicate predicate) { try { if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; OperationFactory operation = operationProvider .createPartitionWideEntryWithPredicateOperationFactory(name, ENTRY_REMOVING_PROCESSOR, partitionPredicate.getTarget()); Data partitionKey = toDataWithStrategy(partitionPredicate.getPartitionKey()); int partitionId = partitionService.getPartitionId(partitionKey); // invokeOnPartitions is used intentionally here, instead of invokeOnPartition, since // the later one doesn't support PartitionAwareOperationFactory, which we need to use // to speed up the removal operation using global indexes // (see PartitionWideEntryWithPredicateOperationFactory.createFactoryOnRunner). operationService.invokeOnPartitions(SERVICE_NAME, operation, singletonList(partitionId)); } else { OperationFactory operation = operationProvider .createPartitionWideEntryWithPredicateOperationFactory(name, ENTRY_REMOVING_PROCESSOR, predicate); operationService.invokeOnAllPartitions(SERVICE_NAME, operation); } } catch (Throwable t) { throw rethrow(t); } }
if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; Data key = toData(partitionPredicate.getPartitionKey()); int partitionId = partitionService.getPartitionId(key); handleHazelcastInstanceAwareParams(partitionPredicate.getTarget());
protected <T extends Result> T executeQueryInternal(Predicate predicate, Aggregator aggregator, Projection projection, IterationType iterationType, Target target) { QueryEngine queryEngine = getMapQueryEngine(); Predicate userPredicate = predicate; if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; Data key = toData(partitionPredicate.getPartitionKey()); int partitionId = partitionService.getPartitionId(key); userPredicate = partitionPredicate.getTarget(); target = createPartitionTarget(partitionId); } handleHazelcastInstanceAwareParams(userPredicate); Query query = Query.of() .mapName(getName()) .predicate(userPredicate) .iterationType(iterationType) .aggregator(aggregator) .projection(projection) .build(); return queryEngine.execute(query, target); }
protected <T extends Result> T executeQueryInternal(Predicate predicate, Aggregator aggregator, Projection projection, IterationType iterationType, Target target) { MapQueryEngine queryEngine = getMapQueryEngine(); Predicate userPredicate = predicate; if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; Data key = toData(partitionPredicate.getPartitionKey()); int partitionId = partitionService.getPartitionId(key); userPredicate = partitionPredicate.getTarget(); target = Target.of().partitionOwner(partitionId).build(); } handleHazelcastInstanceAwareParams(userPredicate); Query query = Query.of() .mapName(getName()) .predicate(userPredicate) .iterationType(iterationType) .aggregator(aggregator) .projection(projection) .build(); return queryEngine.execute(query, target); }
MapContainer mapContainer = mapServiceContext.getMapContainer(parameters.name); PartitioningStrategy partitioningStrategy = mapContainer.getPartitioningStrategy(); Data partitionKey = serializationService.toData(partitionPredicate.getPartitionKey(), partitioningStrategy); partitionId = nodeEngine.getPartitionService().getPartitionId(partitionKey);