public final class ClassicOperationExecutor extends Object implements OperationExecutor
OperationExecutor
that schedules:
execute(Object, int, boolean)
accepts an Object instead of a runnable to prevent needing to
create wrapper runnables around tasks. This is done to reduce the amount of object litter and therefor
reduce pressure on the gc.
There are 2 category of operation threads:
Modifier and Type | Field and Description |
---|---|
static int |
TERMINATION_TIMEOUT_SECONDS |
Constructor and Description |
---|
ClassicOperationExecutor(GroupProperties properties,
LoggingService loggerService,
Address thisAddress,
OperationRunnerFactory operationRunnerFactory,
HazelcastThreadGroup hazelcastThreadGroup,
NodeExtension nodeExtension,
MetricsRegistry metricsRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Operation op)
Executes an Operation.
|
void |
execute(Packet packet)
Executes a Operation packet
|
void |
execute(PartitionSpecificRunnable task)
Executes a PartitionSpecificRunnable.
|
OperationRunner[] |
getGenericOperationRunners()
Gets all the generic operation handlers.
|
int |
getGenericOperationThreadCount() |
int |
getOperationExecutorQueueSize() |
OperationRunner[] |
getPartitionOperationRunners()
Gets all the operation handlers for the partitions.
|
int |
getPartitionOperationThreadCount() |
int |
getPriorityOperationExecutorQueueSize() |
int |
getRunningOperationCount() |
void |
interruptAllPartitionThreads()
Interrupts all partition threads.
|
boolean |
isAllowedToRunInCurrentThread(Operation op)
Checks if the operation is allowed to run on the current thread.
|
boolean |
isInvocationAllowedFromCurrentThread(Operation op,
boolean isAsync)
Checks this operation can be invoked from the current thread.
|
boolean |
isOperationThread()
Checks if the current thread is an operation thread.
|
void |
runOnAllPartitionThreads(Runnable task)
Executes the task on all partition operation threads.
|
void |
runOnCallingThread(Operation operation)
Runs the operation on the calling thread.
|
void |
runOnCallingThreadIfPossible(Operation op)
Tries to run the operation on the calling thread if possible.
|
void |
shutdown()
Shuts down this OperationExecutor.
|
void |
start() |
int |
toPartitionThreadIndex(int partitionId) |
String |
toString() |
public static final int TERMINATION_TIMEOUT_SECONDS
public ClassicOperationExecutor(GroupProperties properties, LoggingService loggerService, Address thisAddress, OperationRunnerFactory operationRunnerFactory, HazelcastThreadGroup hazelcastThreadGroup, NodeExtension nodeExtension, MetricsRegistry metricsRegistry)
public void start()
public OperationRunner[] getPartitionOperationRunners()
OperationExecutor
getPartitionOperationRunners
in interface OperationExecutor
public OperationRunner[] getGenericOperationRunners()
OperationExecutor
getGenericOperationRunners
in interface OperationExecutor
public boolean isAllowedToRunInCurrentThread(Operation op)
OperationExecutor
isAllowedToRunInCurrentThread
in interface OperationExecutor
op
- the Operation to checkpublic boolean isOperationThread()
OperationExecutor
isOperationThread
in interface OperationExecutor
public boolean isInvocationAllowedFromCurrentThread(Operation op, boolean isAsync)
OperationExecutor
isInvocationAllowedFromCurrentThread
in interface OperationExecutor
op
- the Operation to checkisAsync
- is the invocation async, if false invocation does not return a future to block onpublic int getRunningOperationCount()
getRunningOperationCount
in interface OperationExecutor
public int getOperationExecutorQueueSize()
getOperationExecutorQueueSize
in interface OperationExecutor
public int getPriorityOperationExecutorQueueSize()
getPriorityOperationExecutorQueueSize
in interface OperationExecutor
public int getPartitionOperationThreadCount()
getPartitionOperationThreadCount
in interface OperationExecutor
public int getGenericOperationThreadCount()
getGenericOperationThreadCount
in interface OperationExecutor
public void execute(Operation op)
OperationExecutor
execute
in interface OperationExecutor
op
- the operation to execute.public void execute(PartitionSpecificRunnable task)
OperationExecutor
execute
in interface OperationExecutor
task
- the task the execute.public void runOnCallingThreadIfPossible(Operation op)
OperationExecutor
runOnCallingThreadIfPossible
in interface OperationExecutor
op
- the operation to run.public void runOnAllPartitionThreads(Runnable task)
OperationExecutor
runOnAllPartitionThreads
in interface OperationExecutor
task
- the task the execute.public void interruptAllPartitionThreads()
OperationExecutor
interruptAllPartitionThreads
in interface OperationExecutor
public void execute(Packet packet)
OperationExecutor
execute
in interface OperationExecutor
packet
- the packet to execute.public void runOnCallingThread(Operation operation)
OperationExecutor
runOnCallingThread
in interface OperationExecutor
operation
- the operation to run.public int toPartitionThreadIndex(int partitionId)
public void shutdown()
OperationExecutor
shutdown
in interface OperationExecutor
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.