Search in sources :

Example 6 with InternalOperationService

use of com.hazelcast.spi.impl.operationservice.InternalOperationService in project hazelcast by hazelcast.

the class AbstractMapQueryMessageTask method createInvocationsForMissingPartitions.

private void createInvocationsForMissingPartitions(List<Integer> missingPartitionsList, List<Future> futures, Predicate predicate) {
    final InternalOperationService operationService = nodeEngine.getOperationService();
    Query query = buildQuery(predicate);
    for (Integer partitionId : missingPartitionsList) {
        QueryPartitionOperation queryPartitionOperation = new QueryPartitionOperation(query);
        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) Future(java.util.concurrent.Future) QueryPartitionOperation(com.hazelcast.map.impl.query.QueryPartitionOperation) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 7 with InternalOperationService

use of com.hazelcast.spi.impl.operationservice.InternalOperationService in project hazelcast by hazelcast.

the class ExecutorServiceCancelOnPartitionMessageTask method createInvocationBuilder.

@Override
protected InvocationBuilder createInvocationBuilder() throws UnknownHostException {
    final InternalOperationService operationService = nodeEngine.getOperationService();
    final String serviceName = DistributedExecutorService.SERVICE_NAME;
    CancellationOperation op = new CancellationOperation(parameters.uuid, parameters.interrupt);
    return operationService.createInvocationBuilder(serviceName, op, parameters.partitionId);
}
Also used : CancellationOperation(com.hazelcast.executor.impl.operations.CancellationOperation) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 8 with InternalOperationService

use of com.hazelcast.spi.impl.operationservice.InternalOperationService in project hazelcast by hazelcast.

the class AbstractMultiPartitionMessageTask method call.

@Override
protected Object call() throws Exception {
    ClientEndpoint endpoint = getEndpoint();
    OperationFactory operationFactory = new OperationFactoryWrapper(createOperationFactory(), endpoint.getUuid());
    final InternalOperationService operationService = nodeEngine.getOperationService();
    Map<Integer, Object> map = operationService.invokeOnPartitions(getServiceName(), operationFactory, getPartitions());
    return reduce(map);
}
Also used : OperationFactoryWrapper(com.hazelcast.client.impl.operations.OperationFactoryWrapper) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ClientEndpoint(com.hazelcast.client.ClientEndpoint) OperationFactory(com.hazelcast.spi.OperationFactory)

Example 9 with InternalOperationService

use of com.hazelcast.spi.impl.operationservice.InternalOperationService in project hazelcast by hazelcast.

the class AbstractMultiTargetMessageTask method processMessage.

@Override
protected void processMessage() throws Throwable {
    Supplier<Operation> operationSupplier = createOperationSupplier();
    Collection<Member> targets = getTargets();
    returnResponseIfNoTargetLeft(targets, EMPTY_MAP);
    final InternalOperationService operationService = nodeEngine.getOperationService();
    MultiTargetCallback callback = new MultiTargetCallback(targets);
    for (Member target : targets) {
        Operation op = operationSupplier.get();
        InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, target.getAddress()).setResultDeserialized(false).setExecutionCallback(new SingleTargetCallback(target, callback));
        builder.invoke();
    }
}
Also used : Operation(com.hazelcast.spi.Operation) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) Member(com.hazelcast.core.Member)

Example 10 with InternalOperationService

use of com.hazelcast.spi.impl.operationservice.InternalOperationService in project hazelcast by hazelcast.

the class ClientEngineImpl method handleClientMessage.

public void handleClientMessage(ClientMessage clientMessage, Connection connection) {
    int partitionId = clientMessage.getPartitionId();
    MessageTask messageTask = messageTaskFactory.create(clientMessage, connection);
    InternalOperationService operationService = nodeEngine.getOperationService();
    if (partitionId < 0) {
        if (isUrgent(messageTask)) {
            operationService.execute(new PriorityPartitionSpecificRunnable(messageTask));
        } else if (isQuery(messageTask)) {
            queryExecutor.execute(messageTask);
        } else {
            executor.execute(messageTask);
        }
    } else {
        operationService.execute(messageTask);
    }
}
Also used : AuthenticationMessageTask(com.hazelcast.client.impl.protocol.task.AuthenticationMessageTask) AuthenticationCustomCredentialsMessageTask(com.hazelcast.client.impl.protocol.task.AuthenticationCustomCredentialsMessageTask) PingMessageTask(com.hazelcast.client.impl.protocol.task.PingMessageTask) AbstractMapQueryMessageTask(com.hazelcast.client.impl.protocol.task.map.AbstractMapQueryMessageTask) GetPartitionsMessageTask(com.hazelcast.client.impl.protocol.task.GetPartitionsMessageTask) MessageTask(com.hazelcast.client.impl.protocol.task.MessageTask) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Aggregations

InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)20 ParallelTest (com.hazelcast.test.annotation.ParallelTest)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 Test (org.junit.Test)5 ClientEndpoint (com.hazelcast.client.ClientEndpoint)4 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 Address (com.hazelcast.nio.Address)4 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)4 Data (com.hazelcast.nio.serialization.Data)3 InvocationBuilder (com.hazelcast.spi.InvocationBuilder)3 Operation (com.hazelcast.spi.Operation)3 OperationFactory (com.hazelcast.spi.OperationFactory)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 OperationFactoryWrapper (com.hazelcast.client.impl.operations.OperationFactoryWrapper)2 AddAndGetOperation (com.hazelcast.concurrent.atomiclong.operations.AddAndGetOperation)2 Config (com.hazelcast.config.Config)2 CancellationOperation (com.hazelcast.executor.impl.operations.CancellationOperation)2 MemberImpl (com.hazelcast.instance.MemberImpl)2 Future (java.util.concurrent.Future)2 AuthenticationCustomCredentialsMessageTask (com.hazelcast.client.impl.protocol.task.AuthenticationCustomCredentialsMessageTask)1