com.hazelcast.spi.impl.operationexecutor
Interface OperationExecutor

All Known Implementing Classes:
ClassicOperationExecutor

public interface OperationExecutor

The OperationExecutor is responsible for scheduling work (packets/operations) to be executed. It can be compared to a 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 ClassicOperationExecutor 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. In case of a response packet, the ResponsePacketHandler is used to handle the response.


Method Summary
 void dumpPerformanceMetrics(StringBuffer sb)
          Deprecated. 
 void execute(Operation op)
          Executes an Operation.
 void execute(Packet packet)
          Executes a Operation/Response-packet.
 void execute(PartitionSpecificRunnable task)
          Executes a PartitionSpecificRunnable.
 OperationRunner[] getGenericOperationRunners()
          Gets all the generic operation handlers.
 int getGenericOperationThreadCount()
          Deprecated. 
 int getOperationExecutorQueueSize()
          Deprecated. 
 OperationRunner[] getPartitionOperationRunners()
          Gets all the operation handlers for the partitions.
 int getPartitionOperationThreadCount()
          Deprecated. 
 int getPriorityOperationExecutorQueueSize()
          Deprecated. 
 int getResponseQueueSize()
          Deprecated. 
 int getRunningOperationCount()
          Deprecated. 
 boolean isAllowedToRunInCurrentThread(Operation op)
          Deprecated. 
 boolean isInvocationAllowedFromCurrentThread(Operation op, boolean isAsync)
          Checks this operation can be invoked from the current thread.
 boolean isOperationThread()
          Deprecated. it should not matter if a thread is an operation thread or not; this is something operationExecutor specific.
 void runOnCallingThread(Operation op)
          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.
 

Method Detail

getRunningOperationCount

@Deprecated
int getRunningOperationCount()
Deprecated. 


getOperationExecutorQueueSize

@Deprecated
int getOperationExecutorQueueSize()
Deprecated. 


getPriorityOperationExecutorQueueSize

@Deprecated
int getPriorityOperationExecutorQueueSize()
Deprecated. 


getResponseQueueSize

@Deprecated
int getResponseQueueSize()
Deprecated. 


getPartitionOperationThreadCount

@Deprecated
int getPartitionOperationThreadCount()
Deprecated. 


getGenericOperationThreadCount

@Deprecated
int getGenericOperationThreadCount()
Deprecated. 


dumpPerformanceMetrics

@Deprecated
void dumpPerformanceMetrics(StringBuffer sb)
Deprecated. 


getPartitionOperationRunners

OperationRunner[] getPartitionOperationRunners()
Gets all the operation handlers for the partitions. Each partition will have its own operation handler. So if there are 271 partitions, then the size of the array will be 271.

Don't modify the content of the array!

Returns:
the operation handlers.

getGenericOperationRunners

OperationRunner[] getGenericOperationRunners()
Gets all the generic operation handlers. The number of generic operation handlers depends on the number of generic threads.

Don't modify the content of the array!

Returns:
the generic operation handlers.

execute

void execute(Operation op)
Executes an Operation.

Parameters:
op - the operation to execute.
Throws:
NullPointerException - if op is null.

execute

void execute(PartitionSpecificRunnable task)
Executes a PartitionSpecificRunnable.

Parameters:
task - the task the execute.
Throws:
NullPointerException - if task is null.

execute

void execute(Packet packet)
Executes a Operation/Response-packet.

Parameters:
packet - the packet to execute.
Throws:
NullPointerException - if packet is null

runOnCallingThread

void runOnCallingThread(Operation op)
Runs the operation on the calling thread.

Parameters:
op - the operation to run.
Throws:
NullPointerException - if op is null.
IllegalThreadStateException - if the operation is not allowed to be run on the calling thread.

runOnCallingThreadIfPossible

void runOnCallingThreadIfPossible(Operation op)
Tries to run the operation on the calling thread if possible. Otherwise offload it to a different thread.

Parameters:
op - the operation to run.
Throws:
NullPointerException - if op is null.

isAllowedToRunInCurrentThread

@Deprecated
boolean isAllowedToRunInCurrentThread(Operation op)
Deprecated. 

Checks if the operation is allowed to run on the current thread.

Parameters:
op - the Operation to check
Returns:
true if it is allowed, false otherwise.
Throws:
NullPointerException - if op is null.

isOperationThread

boolean isOperationThread()
Deprecated. it should not matter if a thread is an operation thread or not; this is something operationExecutor specific.

Checks if the current thread is an operation thread.

Returns:
true if is an operation thread, false otherwise.

isInvocationAllowedFromCurrentThread

boolean isInvocationAllowedFromCurrentThread(Operation op,
                                             boolean isAsync)
Checks this operation can 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. Blocking for completion can cause problems, e.g. when you hog a partition thread.

Parameters:
op - the Operation to check
isAsync - is the invocation async, if false invocation does not return a future to block on
Returns:
true if allowed, false otherwise.

shutdown

void shutdown()
Shuts down this OperationExecutor.



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