com.hazelcast.spi
Interface OperationService


public interface OperationService

The OperationService is responsible for executing operations. A single operation can be executed locally using runOperation(Operation) and executeOperation(Operation). Or it can executed remotely using the one of the send methods. It also is possible to execute multiple operation one multiple partitions using one of the invoke methods.

Author:
mdogan 12/14/12

Method Summary
 InvocationBuilder createInvocationBuilder(String serviceName, Operation op, com.hazelcast.nio.Address target)
           
 InvocationBuilder createInvocationBuilder(String serviceName, Operation op, int partitionId)
           
 void executeOperation(Operation op)
          Executes operation in operation executor pool.
 Map<Integer,Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory)
          Invokes a set of operation on each partition.
 Map<Integer,Object> invokeOnPartitions(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions)
          Invokes an set of operation on selected set of partitions
 Map<Integer,Object> invokeOnTargetPartitions(String serviceName, OperationFactory operationFactory, com.hazelcast.nio.Address target)
          Invokes a set of operations on all partitions of a target member.
 void runOperation(Operation op)
          Runs operation in calling thread.
 boolean send(Operation op, com.hazelcast.nio.Address target)
          Executes an operation remotely.
 boolean send(Operation op, com.hazelcast.nio.Connection connection)
          Executes an operation remotely
 boolean send(Operation op, int partitionId, int replicaIndex)
          Executes an operation remotely.
 

Method Detail

runOperation

void runOperation(Operation op)
Runs operation in calling thread.

Parameters:
op - the operation to execute.

executeOperation

void executeOperation(Operation op)
Executes operation in operation executor pool.

Parameters:
op - the operation to execute.

createInvocationBuilder

InvocationBuilder createInvocationBuilder(String serviceName,
                                          Operation op,
                                          int partitionId)

createInvocationBuilder

InvocationBuilder createInvocationBuilder(String serviceName,
                                          Operation op,
                                          com.hazelcast.nio.Address target)

invokeOnAllPartitions

Map<Integer,Object> invokeOnAllPartitions(String serviceName,
                                          OperationFactory operationFactory)
                                          throws Exception
Invokes a set of operation on each partition.

Parameters:
serviceName -
operationFactory - the factory responsible creating operations
Returns:
a Map with partitionId as key and outcome of the operation as value.
Throws:
Exception

invokeOnPartitions

Map<Integer,Object> invokeOnPartitions(String serviceName,
                                       OperationFactory operationFactory,
                                       Collection<Integer> partitions)
                                       throws Exception
Invokes an set of operation on selected set of partitions

Parameters:
serviceName -
operationFactory - the factory responsible creating operations
partitions - the partitions the operation should be executed on.
Returns:
a Map with partitionId as key and outcome of the operation as value.
Throws:
Exception

invokeOnTargetPartitions

Map<Integer,Object> invokeOnTargetPartitions(String serviceName,
                                             OperationFactory operationFactory,
                                             com.hazelcast.nio.Address target)
                                             throws Exception
Invokes a set of operations on all partitions of a target member.

Parameters:
serviceName -
operationFactory - the factory responsible creating operations
target - the address of the target member
Returns:
a Map with partitionId as key and outcome of the operation as value.
Throws:
Exception

send

boolean send(Operation op,
             int partitionId,
             int replicaIndex)
Executes an operation remotely.

Parameters:
op - the operation to execute.
partitionId - the id of the partition the operation should be executed on
replicaIndex -
Returns:

send

boolean send(Operation op,
             com.hazelcast.nio.Address target)
Executes an operation remotely. It isn't allowed

Parameters:
op - the operation to send and execute.
target - the address of that target member.
Returns:

send

boolean send(Operation op,
             com.hazelcast.nio.Connection connection)
Executes an operation remotely

Parameters:
op - the operation to send and execute.
connection - the connection to the target machine.
Returns:


Copyright © 2013 Hazelcast, Inc.. All Rights Reserved.