com.hazelcast.spi

## Interface OperationService

-     public interface OperationService

  The OperationService is responsible for executing operations.

  A single operation can be executed locally using `run(Operation)` and `execute(Operation)`. Or it can executed remotely using one of the send methods.

  It also is possible to execute multiple operation on multiple partitions using one of the invoke methods.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `InvocationBuilder` | `createInvocationBuilder(String serviceName, Operation op, Address target)`
    `InvocationBuilder` | `createInvocationBuilder(String serviceName, Operation op, int partitionId)`
    `void` | `execute(Operation op)` Executes an operation in the operation executor pool.
    `Map<Integer,Object>` | `invokeOnAllPartitions(String serviceName, OperationFactory operationFactory)` Invokes a set of operation on each partition.
    `<E> InternalCompletableFuture<E>` | `invokeOnPartition(Operation op)` Executes an operation on a partition.
    `<E> InternalCompletableFuture<E>` | `invokeOnPartition(String serviceName, Operation op, int partitionId)`
    `Map<Integer,Object>` | `invokeOnPartitions(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions)` Invokes an set of operation on selected set of partitions * This method blocks until all operations complete.
    `Map<Integer,Object>` | `invokeOnPartitions(String serviceName, OperationFactory operationFactory, int[] partitions)` Invokes an set of operation on selected set of partitions * This method blocks until all operations complete.
    `<E> InternalCompletableFuture<E>` | `invokeOnTarget(String serviceName, Operation op, Address target)`
    `void` | `run(Operation op)` Runs an operation in the calling thread.
    `boolean` | `send(Operation op, Address target)` Executes an operation remotely.

- - ### Method Detail

    - #### run

          void run(Operation op)

      Runs an operation in the calling thread.
      Parameters:
        `op` - the operation to execute in the calling thread

    - #### execute

          void execute(Operation op)

      Executes an operation in the operation executor pool.
      Parameters:
        `op` - the operation to execute in the operation executor pool.

    - #### invokeOnPartition

          <E> InternalCompletableFuture<E> invokeOnPartition(String serviceName,
                                                             Operation op,
                                                             int partitionId)

    - #### invokeOnPartition

          <E> InternalCompletableFuture<E> invokeOnPartition(Operation op)

      Executes an operation on a partition.
      Type Parameters:
        `E` - the return type of the operation response
      Parameters:
        `op` - the operation
      Returns:
        the future.

    - #### invokeOnTarget

          <E> InternalCompletableFuture<E> invokeOnTarget(String serviceName,
                                                          Operation op,
                                                          Address target)

    - #### createInvocationBuilder

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

    - #### createInvocationBuilder

          InvocationBuilder createInvocationBuilder(String serviceName,
                                                    Operation op,
                                                    Address target)

    - #### invokeOnAllPartitions

          Map<Integer,Object> invokeOnAllPartitions(String serviceName,
                                                    OperationFactory operationFactory)
                                             throws Exception

      Invokes a set of operation on each partition.

      This method blocks until the operation completes.
      Parameters:
        `serviceName` - the name of the service.
        `operationFactory` - the factory responsible for creating operations
      Returns:
        a Map with partitionId as key and the 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 *

      This method blocks until all operations complete.
      Parameters:
        `serviceName` - the name of the service
        `operationFactory` - the factory responsible for creating operations
        `partitions` - the partitions the operation should be executed on.
      Returns:
        a Map with partitionId as key and the outcome of the operation as value.
      Throws:
        `Exception`

    - #### invokeOnPartitions

          Map<Integer,Object> invokeOnPartitions(String serviceName,
                                                 OperationFactory operationFactory,
                                                 int[] partitions)
                                          throws Exception

      Invokes an set of operation on selected set of partitions *

      This method blocks until all operations complete.
      Parameters:
        `serviceName` - the name of the service
        `operationFactory` - the factory responsible for creating operations
        `partitions` - the partitions the operation should be executed on.
      Returns:
        a Map with partitionId as key and the outcome of the operation as value.
      Throws:
        `Exception`

    - #### send

          boolean send(Operation op,
                       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:
        true if send is successful, false otherwise.

Copyright © 2018. All rights reserved.