public interface OperationExecutor extends PacketHandler
Executor
with the big difference that it is designed for assigning packets,
operations and PartitionSpecificRunnable to a thread instead of only runnables.
It depends on the implementation if an operation is executed on the calling thread or not. For example the
OperationExecutorImpl
will always offload a partition specific
Operation to the correct partition-operation-thread.
The actual processing of a operation-packet, Operation, or a PartitionSpecificRunnable is forwarded to the
OperationRunner
.Modifier and Type | Method and Description |
---|---|
void |
execute(Operation op)
Executes the given
Operation at some point in the future. |
void |
execute(PartitionSpecificRunnable task)
Executes the given
PartitionSpecificRunnable at some point in the future. |
void |
executeOnPartitionThreads(Runnable task)
Executes the task on every partition thread.
|
long |
getExecutedOperationCount()
Returns the number of executed operations.
|
OperationRunner[] |
getGenericOperationRunners()
Gets all the generic operation handlers.
|
int |
getGenericThreadCount()
Returns the number of generic threads.
|
OperationRunner[] |
getPartitionOperationRunners()
Gets all the operation handlers for the partitions.
|
int |
getPartitionThreadCount()
Returns the number of partition threads.
|
int |
getPartitionThreadId(int partitionId)
Returns the ID of the partitionThread assigned to handle partition with given partitionId
|
int |
getPriorityQueueSize()
Deprecated.
|
int |
getQueueSize()
Deprecated.
|
int |
getRunningOperationCount()
Deprecated.
|
void |
interruptPartitionThreads()
Interrupts the partition threads.
|
boolean |
isInvocationAllowed(Operation op,
boolean isAsync)
Checks if the
Operation is allowed to be invoked from the current thread. |
boolean |
isOperationThread()
Checks if the current thread is an
Operation thread. |
boolean |
isRunAllowed(Operation op)
Checks if the
Operation is allowed to run on the current thread. |
void |
run(Operation op)
Runs the
Operation on the calling thread. |
void |
runOrExecute(Operation op)
Tries to run the
Operation on the calling thread if allowed. |
void |
scan(LiveOperations result) |
void |
shutdown()
Shuts down this OperationExecutor.
|
void |
start()
Starts this OperationExecutor
|
handle
@Deprecated int getRunningOperationCount()
@Deprecated int getQueueSize()
@Deprecated int getPriorityQueueSize()
long getExecutedOperationCount()
int getPartitionThreadCount()
int getGenericThreadCount()
OperationRunner[] getPartitionOperationRunners()
OperationRunner[] getGenericOperationRunners()
void execute(Operation op)
Operation
at some point in the future.op
- the operation to execute.NullPointerException
- if op is null.void execute(PartitionSpecificRunnable task)
PartitionSpecificRunnable
at some point in the future.task
- the task the execute.NullPointerException
- if task is null.void executeOnPartitionThreads(Runnable task)
task
- the task the execute.NullPointerException
- if task is null.void run(Operation op)
Operation
on the calling thread.op
- the Operation
to run.NullPointerException
- if op is null.IllegalThreadStateException
- if the operation is not allowed to be run on the calling thread.void runOrExecute(Operation op)
Operation
on the calling thread if allowed. Otherwise the operation is submitted for executing
using execute(Operation)
.op
- the Operation
to run or execute.NullPointerException
- if op is null.void scan(LiveOperations result)
boolean isRunAllowed(Operation op)
Operation
is allowed to run on the current thread.op
- the Operation
to checkNullPointerException
- if op is null.boolean isInvocationAllowed(Operation op, boolean isAsync)
Operation
is allowed to be invoked from the current thread. Invoking means that the operation can
be executed on another thread, but that one is going to block for completion using the future.get/join etc.
Blocking for completion can cause problems, e.g. when you hog a partition thread or deadlocks.op
- the Operation
to checkisAsync
- is the invocation async, if false invocation does not return a future to block onboolean isOperationThread()
Operation
thread.Operation
thread, false otherwise.int getPartitionThreadId(int partitionId)
partitionId
- given partitionIdvoid interruptPartitionThreads()
void start()
void shutdown()
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.