Search in sources :

Example 66 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapExecuteOnKeyMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    EntryProcessor processor = serializationService.toObject(parameters.entryProcessor);
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation op = operationProvider.createEntryOperation(parameters.name, parameters.key, processor);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : EntryProcessor(com.hazelcast.map.EntryProcessor) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 67 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapGetMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation operation = operationProvider.createGetOperation(parameters.name, parameters.key);
    operation.setThreadId(parameters.threadId);
    return operation;
}
Also used : MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 68 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class AbstractMapQueryMessageTask method createInvocationsForMissingPartitions.

private void createInvocationsForMissingPartitions(PartitionIdSet missingPartitionsList, List<Future> futures, Predicate predicate) {
    final OperationServiceImpl operationService = nodeEngine.getOperationService();
    MapService mapService = nodeEngine.getService(getServiceName());
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    Query query = buildQuery(predicate);
    PrimitiveIterator.OfInt missingPartitionIterator = missingPartitionsList.intIterator();
    missingPartitionIterator.forEachRemaining((IntConsumer) partitionId -> {
        MapOperation queryPartitionOperation = createQueryPartitionOperation(query, mapServiceContext);
        queryPartitionOperation.setPartitionId(partitionId);
        try {
            Future future = operationService.invokeOnPartition(SERVICE_NAME, queryPartitionOperation, partitionId);
            futures.add(future);
        } catch (Throwable t) {
            throw rethrow(t);
        }
    });
}
Also used : Query(com.hazelcast.map.impl.query.Query) PartitionPredicate(com.hazelcast.query.PartitionPredicate) Member(com.hazelcast.cluster.Member) IntConsumer(java.util.function.IntConsumer) QueryResultSizeExceededException(com.hazelcast.map.QueryResultSizeExceededException) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) ExceptionUtil.rethrow(com.hazelcast.internal.util.ExceptionUtil.rethrow) Aggregator(com.hazelcast.aggregation.Aggregator) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) AbstractCallableMessageTask(com.hazelcast.client.impl.protocol.task.AbstractCallableMessageTask) DATA_MEMBER_SELECTOR(com.hazelcast.cluster.memberselector.MemberSelectors.DATA_MEMBER_SELECTOR) Operation(com.hazelcast.spi.impl.operationservice.Operation) ActionConstants(com.hazelcast.security.permission.ActionConstants) LinkedList(java.util.LinkedList) Predicate(com.hazelcast.query.Predicate) QueryException(com.hazelcast.query.QueryException) HazelcastException(com.hazelcast.core.HazelcastException) MapOperation(com.hazelcast.map.impl.operation.MapOperation) Connection(com.hazelcast.internal.nio.Connection) SetUtil(com.hazelcast.internal.util.SetUtil) Collection(java.util.Collection) MapService(com.hazelcast.map.impl.MapService) Result(com.hazelcast.map.impl.query.Result) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) Node(com.hazelcast.instance.impl.Node) PrimitiveIterator(java.util.PrimitiveIterator) ExecutionException(java.util.concurrent.ExecutionException) SERVICE_NAME(com.hazelcast.map.impl.MapService.SERVICE_NAME) List(java.util.List) Permission(java.security.Permission) IterationType(com.hazelcast.internal.util.IterationType) Projection(com.hazelcast.projection.Projection) PartitionIdSet(com.hazelcast.internal.util.collection.PartitionIdSet) MapPermission(com.hazelcast.security.permission.MapPermission) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) Query(com.hazelcast.map.impl.query.Query) PrimitiveIterator(java.util.PrimitiveIterator) Future(java.util.concurrent.Future) MapService(com.hazelcast.map.impl.MapService) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 69 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapPutIfAbsentMessageTask method prepareOperation.

protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation op = operationProvider.createPutIfAbsentOperation(parameters.name, parameters.key, parameters.value, parameters.ttl, UNSET);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 70 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapPutMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    MapOperation op = newPutOperation(parameters.name, parameters.key, parameters.value, parameters.ttl);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Aggregations

MapOperation (com.hazelcast.map.impl.operation.MapOperation)80 MapOperationProvider (com.hazelcast.map.impl.operation.MapOperationProvider)25 Data (com.hazelcast.internal.serialization.Data)23 Future (java.util.concurrent.Future)16 Data (com.hazelcast.nio.serialization.Data)6 ArrayList (java.util.ArrayList)5 InternalCompletableFuture (com.hazelcast.spi.impl.InternalCompletableFuture)4 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 MapService (com.hazelcast.map.impl.MapService)3 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)3 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)3 AbstractDistributedObject (com.hazelcast.spi.impl.AbstractDistributedObject)3 InitializingObject (com.hazelcast.spi.impl.InitializingObject)3 InternalCompletableFuture.newCompletedFuture (com.hazelcast.spi.impl.InternalCompletableFuture.newCompletedFuture)3 InvocationFuture (com.hazelcast.spi.impl.operationservice.impl.InvocationFuture)3 OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)3 List (java.util.List)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 EntryView (com.hazelcast.core.EntryView)2 EntryProcessor (com.hazelcast.map.EntryProcessor)2