public final class OperationServiceImpl extends Object implements InternalOperationService, PacketHandler
InternalOperationService
.
UrgentSystemOperation
is invoked on this OperationService, it will be executed with a
high urgency by making use of a urgent queue. So when the system is under load, and the operation queues are
filled, then system operations are executed before normal operation. The advantage is that when a system is under
pressure, it still is able to do things like recognizing new members in the cluster and moving partitions around.
When a UrgentSystemOperation is send to a remote machine, it is wrapped in a Packet
and the packet is marked as a
urgent packet. When this packet is received on the remove OperationService, the urgent flag is checked and if
needed, the operation is set on the urgent queue. So local and remote execution of System operations will obey
the urgency.Invocation
,
InvocationBuilderImpl
,
PartitionInvocation
,
TargetInvocation
Constructor and Description |
---|
OperationServiceImpl(NodeEngineImpl nodeEngine) |
Modifier and Type | Method and Description |
---|---|
<V> void |
asyncInvokeOnPartition(String serviceName,
Operation op,
int partitionId,
ExecutionCallback<V> callback) |
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: for example, performance.
|
void |
execute(PartitionSpecificRunnable task)
Executes a PartitionSpecificRunnable.
|
void |
executeOperation(Operation op)
Executes an operation in the operation executor pool.
|
long |
getExecutedOperationCount()
This methods is deprecated since 3.5.
|
int |
getGenericOperationThreadCount()
This methods is deprecated since 3.5.
|
InvocationRegistry |
getInvocationsRegistry() |
IsStillRunningService |
getIsStillRunningService() |
OperationExecutor |
getOperationExecutor() |
int |
getOperationExecutorQueueSize()
This methods is deprecated since 3.5.
|
int |
getPartitionOperationThreadCount()
This methods is deprecated since 3.5.
|
int |
getPriorityOperationExecutorQueueSize()
This methods is deprecated since 3.5.
|
int |
getRemoteOperationsCount()
This methods is deprecated since 3.5.
|
int |
getResponseQueueSize()
This methods is deprecated since 3.5.
|
int |
getRunningOperationsCount()
This methods is deprecated since 3.5.
|
List<SlowOperationDTO> |
getSlowOperationDTOs()
Returns information about long running operations.
|
void |
handle(Packet packet)
Signals the PacketHandler that there is a packet to be handled.
|
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 the given operation is allowed to run on the calling thread, false otherwise.
|
boolean |
isCallTimedOut(Operation op)
Checks if this call is timed out.
|
void |
onMemberLeft(MemberImpl member) |
void |
reset() |
void |
runOperationOnCallingThread(Operation op)
Runs an operation in the 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.
|
void |
shutdown() |
void |
start() |
public OperationServiceImpl(NodeEngineImpl nodeEngine)
public void start()
public IsStillRunningService getIsStillRunningService()
public void dumpPerformanceMetrics(StringBuffer sb)
OperationService
dumpPerformanceMetrics
in interface OperationService
public List<SlowOperationDTO> getSlowOperationDTOs()
InternalOperationService
getSlowOperationDTOs
in interface InternalOperationService
SlowOperationDTO
instances.public InvocationRegistry getInvocationsRegistry()
public int getPartitionOperationThreadCount()
OperationService
getPartitionOperationThreadCount
in interface OperationService
public int getGenericOperationThreadCount()
OperationService
getGenericOperationThreadCount
in interface OperationService
public int getRunningOperationsCount()
OperationService
getRunningOperationsCount
in interface OperationService
public long getExecutedOperationCount()
OperationService
getExecutedOperationCount
in interface OperationService
public int getRemoteOperationsCount()
OperationService
getRemoteOperationsCount
in interface OperationService
public int getOperationExecutorQueueSize()
OperationService
getOperationExecutorQueueSize
in interface OperationService
public int getPriorityOperationExecutorQueueSize()
OperationService
getPriorityOperationExecutorQueueSize
in interface OperationService
public OperationExecutor getOperationExecutor()
public int getResponseQueueSize()
OperationService
getResponseQueueSize
in interface OperationService
public void handle(Packet packet) throws Exception
PacketHandler
handle
in interface PacketHandler
packet
- the response packet to handleException
public void execute(PartitionSpecificRunnable task)
InternalOperationService
ClientEngine
when it has received a Packet containing
a request that needs to be processed.execute
in interface InternalOperationService
task
- the task to executepublic InvocationBuilder createInvocationBuilder(String serviceName, Operation op, int partitionId)
createInvocationBuilder
in interface OperationService
public InvocationBuilder createInvocationBuilder(String serviceName, Operation op, Address target)
createInvocationBuilder
in interface OperationService
public void runOperationOnCallingThread(Operation op)
OperationService
runOperationOnCallingThread
in interface OperationService
op
- the operation to execute in the calling threadpublic void executeOperation(Operation op)
OperationService
executeOperation
in interface OperationService
op
- the operation to execute in the operation executor pool.public boolean isAllowedToRunOnCallingThread(Operation op)
OperationService
OperationService.runOperationOnCallingThread(Operation)
method, otherwise OperationService.executeOperation(Operation)
should be used.isAllowedToRunOnCallingThread
in interface OperationService
op
- the operation to check.public <E> InternalCompletableFuture<E> invokeOnPartition(String serviceName, Operation op, int partitionId)
invokeOnPartition
in interface OperationService
public <E> InternalCompletableFuture<E> invokeOnTarget(String serviceName, Operation op, Address target)
invokeOnTarget
in interface OperationService
public <V> void asyncInvokeOnPartition(String serviceName, Operation op, int partitionId, ExecutionCallback<V> callback)
asyncInvokeOnPartition
in interface InternalOperationService
public boolean isCallTimedOut(Operation op)
InternalOperationService
isCallTimedOut
in interface InternalOperationService
op
- the operation to check.public Map<Integer,Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory) throws Exception
OperationService
invokeOnAllPartitions
in interface OperationService
serviceName
- the name of the service.operationFactory
- the factory responsible for creating operationsException
public Map<Integer,Object> invokeOnPartitions(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions) throws Exception
OperationService
invokeOnPartitions
in interface OperationService
serviceName
- the name of the serviceoperationFactory
- the factory responsible for creating operationspartitions
- the partitions the operation should be executed on.Exception
public boolean send(Operation op, Address target)
OperationService
send
in interface OperationService
op
- the operation to send and execute.target
- the address of that target member.public boolean send(Response response, Address target)
OperationService
InternalOperationService
.send
in interface OperationService
response
- the response to send.target
- the address of the target machinepublic void onMemberLeft(MemberImpl member)
public void reset()
public void shutdown()
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.