com.hazelcast.spi
Interface OperationService

All Known Subinterfaces:
InternalOperationService

public interface OperationService

The OperationService is responsible for executing operations.

A single operation can be executed locally using runOperationOnCallingThread(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.


Method Summary
 InvocationBuilder createInvocationBuilder(String serviceName, Operation op, Address target)
           
 InvocationBuilder createInvocationBuilder(String serviceName, Operation op, int partitionId)
           
 void dumpPerformanceMetrics(StringBuffer sb)
          Dumps all kinds of metrics, e.g.
 void executeOperation(Operation op)
          Executes operation in operation executor pool.
 long getExecutedOperationCount()
           
 int getGenericOperationThreadCount()
           
 int getOperationExecutorQueueSize()
           
 int getPartitionOperationThreadCount()
           
 int getPriorityOperationExecutorQueueSize()
           
 int getRemoteOperationsCount()
           
 int getResponseQueueSize()
           
 int getRunningOperationsCount()
           
 Map<Integer,Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory)
          Invokes a set of operation on each 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.

<E> InternalCompletableFuture<E>
invokeOnTarget(String serviceName, Operation op, Address target)
           
 boolean isAllowedToRunOnCallingThread(Operation op)
          Returns true if given operation is allowed to run on calling thread, false otherwise.
 void runOperationOnCallingThread(Operation op)
          Runs operation in calling thread.
 boolean send(Operation op, Address target)
          Executes an operation remotely.
 boolean send(Response response, Address target)
          Sends a response to a remote machine.
 

Method Detail

getResponseQueueSize

int getResponseQueueSize()

getOperationExecutorQueueSize

int getOperationExecutorQueueSize()

getPriorityOperationExecutorQueueSize

int getPriorityOperationExecutorQueueSize()

getRunningOperationsCount

int getRunningOperationsCount()

getRemoteOperationsCount

int getRemoteOperationsCount()

getPartitionOperationThreadCount

int getPartitionOperationThreadCount()

getGenericOperationThreadCount

int getGenericOperationThreadCount()

getExecutedOperationCount

long getExecutedOperationCount()

dumpPerformanceMetrics

void dumpPerformanceMetrics(StringBuffer sb)
Dumps all kinds of metrics, e.g. performance. This can be used for performance analysis. In the future we'll have a more formal (e.g map with key/value pairs) information.


runOperationOnCallingThread

void runOperationOnCallingThread(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.

isAllowedToRunOnCallingThread

boolean isAllowedToRunOnCallingThread(Operation op)
Returns true if given operation is allowed to run on calling thread, false otherwise. If this method returns true, then operation can be executed using runOperationOnCallingThread(Operation) method, otherwise executeOperation(Operation) should be used.

Parameters:
op - the operation to check.
Returns:
true if operation is allowed to run on calling thread, false otherwise.

invokeOnPartition

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

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 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 *

This method blocks until all operations complete.

Parameters:
serviceName - the name of the service
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

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 successfully, false otherwise.

send

boolean send(Response response,
             Address target)
Sends a response to a remote machine.

Parameters:
response - the response to send.
target - the address of the target machine
Returns:
true if send successfully, false otherwise.


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