public interface OperationService
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.
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_NAME |
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.
|
void |
execute(PartitionSpecificRunnable task)
Executes a PartitionSpecificRunnable.
|
void |
executeOnPartitions(PartitionTaskFactory taskFactory,
BitSet partitions)
Executes for each of the partitions, a task created by the
taskFactory.
|
long |
getExecutedOperationCount()
Returns the number of executed operations.
|
int |
getGenericThreadCount()
Returns the number of generic threads.
|
int |
getOperationExecutorQueueSize() |
int |
getPartitionThreadCount()
Returns the number of partition threads.
|
int |
getPriorityOperationExecutorQueueSize() |
int |
getRemoteOperationsCount() |
int |
getResponseQueueSize()
Returns the size of the response queue.
|
int |
getRunningOperationsCount() |
List<SlowOperationDTO> |
getSlowOperationDTOs()
Returns information about long running operations.
|
Map<Integer,Object> |
invokeOnAllPartitions(String serviceName,
OperationFactory operationFactory)
Invokes a set of operations on each partition.
|
<T> CompletableFuture<Map<Integer,T>> |
invokeOnAllPartitionsAsync(String serviceName,
OperationFactory operationFactory)
Invokes a set of operations on selected set of all partitions in an async way.
|
<E> InvocationFuture<E> |
invokeOnPartition(Operation op)
Executes an operation on a partition.
|
<E> InvocationFuture<E> |
invokeOnPartition(String serviceName,
Operation op,
int partitionId) |
<E> InvocationFuture<E> |
invokeOnPartitionAsync(String serviceName,
Operation op,
int partitionId) |
<T> Map<Integer,T> |
invokeOnPartitions(String serviceName,
OperationFactory operationFactory,
Collection<Integer> partitions)
Invokes a set of operations on selected set of partitions.
|
Map<Integer,Object> |
invokeOnPartitions(String serviceName,
OperationFactory operationFactory,
int[] partitions)
Invokes a set of operations on selected set of partitions.
|
<T> CompletableFuture<Map<Integer,T>> |
invokeOnPartitionsAsync(String serviceName,
OperationFactory operationFactory,
Collection<Integer> partitions)
Invokes a set of operations on selected set of partitions in an async way.
|
<T> CompletableFuture<Map<Integer,T>> |
invokeOnPartitionsAsync(String serviceName,
OperationFactory operationFactory,
Map<Address,List<Integer>> memberPartitions)
Invokes a set of operations on selected set of partitions in an async way.
|
<E> InvocationFuture<E> |
invokeOnTarget(String serviceName,
Operation op,
Address target) |
boolean |
isCallTimedOut(Operation op)
Checks if this call is timed out.
|
boolean |
isRunAllowed(Operation op)
Returns true if the given operation is allowed to run on the calling
thread, false otherwise.
|
void |
onCompletionAsyncOperation(Operation op)
Should be called when the asynchronous operation has completed.
|
void |
onEndpointLeft(Address endpoint)
Cleans up heartbeats and fails invocations for the given endpoint.
|
void |
onStartAsyncOperation(Operation op)
Should be called when an asynchronous operations not running on a operation thread is running.
|
void |
run(Operation op)
Runs an operation in the calling thread.
|
boolean |
send(Operation op,
Address target)
Executes an operation remotely.
|
static final String SERVICE_NAME
int getResponseQueueSize()
int getOperationExecutorQueueSize()
int getPriorityOperationExecutorQueueSize()
int getRunningOperationsCount()
int getRemoteOperationsCount()
long getExecutedOperationCount()
int getPartitionThreadCount()
int getGenericThreadCount()
void run(Operation op)
op
- the operation to execute in the calling threadvoid execute(Operation op)
op
- the operation to execute in the operation executor pool.void execute(PartitionSpecificRunnable task)
ClientEngine
when it has received a Packet containing a request that needs to be processed.task
- the task to executevoid executeOnPartitions(PartitionTaskFactory taskFactory, BitSet partitions)
OperationExecutor#executeOnPartitions(PartitionTaskFactory, BitSet)
taskFactory
- the PartitionTaskFactory used to create
operations.partitions
- the partitions to execute an operation on.NullPointerException
- if taskFactory or partitions is null.<E> InvocationFuture<E> invokeOnPartition(String serviceName, Operation op, int partitionId)
<E> InvocationFuture<E> invokeOnPartitionAsync(String serviceName, Operation op, int partitionId)
<E> InvocationFuture<E> invokeOnPartition(Operation op)
E
- the return type of the operation responseop
- the operation<E> InvocationFuture<E> invokeOnTarget(String serviceName, Operation op, Address target)
InvocationBuilder createInvocationBuilder(String serviceName, Operation op, int partitionId)
InvocationBuilder createInvocationBuilder(String serviceName, Operation op, Address target)
Map<Integer,Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory) throws Exception
This method blocks until the operations complete.
If the operations have sync backups, this method will not wait for their completion.
Instead, it will return once the operations are completed on primary replicas of the
given partitions
.
serviceName
- the name of the service.operationFactory
- the factory responsible for creating operationsException
<T> CompletableFuture<Map<Integer,T>> invokeOnAllPartitionsAsync(String serviceName, OperationFactory operationFactory)
If the operations have sync backups, the returned ICompletableFuture
does not
wait for their completion. Instead, the ICompletableFuture
is completed once the
operations are completed on primary replicas of the given partitions
.
T
- type of result of operations returned by operationFactory
serviceName
- the name of the serviceoperationFactory
- the factory responsible for creating operations<T> Map<Integer,T> invokeOnPartitions(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions) throws Exception
This method blocks until all operations complete.
If the operations have sync backups, this method will not wait for their completion.
Instead, it will return once the operations are completed on primary replicas of the given partitions
.
T
- type of result of operations returned by operationFactory
serviceName
- the name of the serviceoperationFactory
- the factory responsible for creating operationspartitions
- the partitions the operation should be executed on.Exception
- if there was an exception while waiting for the results
of the partition invocations<T> CompletableFuture<Map<Integer,T>> invokeOnPartitionsAsync(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions)
If the operations have sync backups, the returned ICompletableFuture
does not
wait for their completion. Instead, the ICompletableFuture
is completed once the
operations are completed on primary replicas of the given partitions
.
T
- type of result of operations returned by operationFactory
serviceName
- the name of the serviceoperationFactory
- the factory responsible for creating operationspartitions
- the partitions the operation should be executed on.<T> CompletableFuture<Map<Integer,T>> invokeOnPartitionsAsync(String serviceName, OperationFactory operationFactory, Map<Address,List<Integer>> memberPartitions)
If the operations have sync backups, the returned ICompletableFuture
does not
wait for their completion. Instead, the ICompletableFuture
is completed once the
operations are completed on primary replicas of the given partitions
.
T
- type of result of operations returned by operationFactory
serviceName
- the name of the serviceoperationFactory
- the factory responsible for creating operationsmemberPartitions
- the partitions the operation should be executed on,
grouped by ownersMap<Integer,Object> invokeOnPartitions(String serviceName, OperationFactory operationFactory, int[] partitions) throws Exception
This method blocks until all operations complete.
If the operations have sync backups, this method will not wait for their completion.
Instead, it will return once the operations are completed on primary replicas of the given partitions
.
serviceName
- the name of the serviceoperationFactory
- the factory responsible for creating operationspartitions
- the partitions the operation should be executed on.Exception
boolean send(Operation op, Address target)
It isn't allowed
op
- the operation to send and execute.target
- the address of that target member.void onStartAsyncOperation(Operation op)
op
- void onCompletionAsyncOperation(Operation op)
op
- onStartAsyncOperation(Operation)
boolean isCallTimedOut(Operation op)
op
- the operation to check.boolean isRunAllowed(Operation op)
run(Operation)
method, otherwise
execute(Operation)
should be used.op
- the operation to check.List<SlowOperationDTO> getSlowOperationDTOs()
SlowOperationDTO
instances.void onEndpointLeft(Address endpoint)
endpoint
- the endpoint that has leftCopyright © 2019 Hazelcast, Inc.. All rights reserved.