public final class OperationServiceImpl extends Object implements InternalOperationService, MetricsProvider, LiveOperationsTracker
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,
TargetInvocationSERVICE_NAME| 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 |
execute(Operation op)
Executes an operation in the operation executor pool.
|
void |
execute(PartitionSpecificRunnable task)
Executes a PartitionSpecificRunnable.
|
PacketHandler |
getAsyncInboundResponseHandler() |
long |
getExecutedOperationCount()
Returns the number of executed operations.
|
int |
getGenericThreadCount()
Returns the number of generic threads.
|
InboundResponseHandler |
getInboundResponseHandler() |
com.hazelcast.spi.impl.operationservice.impl.InvocationMonitor |
getInvocationMonitor() |
InvocationRegistry |
getInvocationRegistry() |
OperationExecutor |
getOperationExecutor() |
int |
getOperationExecutorQueueSize() |
OutboundResponseHandler |
getOutboundResponseHandler() |
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 operation on each partition.
|
<E> InternalCompletableFuture<E> |
invokeOnPartition(Operation op)
Executes an operation on a 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.
|
Map<Integer,Object> |
invokeOnPartitions(String serviceName,
OperationFactory operationFactory,
int[] 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 |
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) |
void |
onMemberLeft(MemberImpl member) |
void |
onStartAsyncOperation(Operation op) |
void |
populate(LiveOperations liveOperations)
Populate the LiveOperations
|
void |
provideMetrics(MetricsRegistry registry) |
void |
reset() |
void |
run(Operation op)
Runs an operation in the calling thread.
|
boolean |
send(Operation op,
Address target)
Executes an operation remotely.
|
void |
shutdownInvocations()
Shuts down invocation infrastructure.
|
void |
shutdownOperationExecutor() |
void |
start() |
public OperationServiceImpl(NodeEngineImpl nodeEngine)
public OutboundResponseHandler getOutboundResponseHandler()
public PacketHandler getAsyncInboundResponseHandler()
public com.hazelcast.spi.impl.operationservice.impl.InvocationMonitor getInvocationMonitor()
public List<SlowOperationDTO> getSlowOperationDTOs()
InternalOperationServicegetSlowOperationDTOs in interface InternalOperationServiceSlowOperationDTO instances.public InvocationRegistry getInvocationRegistry()
public InboundResponseHandler getInboundResponseHandler()
public int getPartitionThreadCount()
InternalOperationServicegetPartitionThreadCount in interface InternalOperationServicepublic int getGenericThreadCount()
InternalOperationServicegetGenericThreadCount in interface InternalOperationServicepublic int getRunningOperationsCount()
getRunningOperationsCount in interface InternalOperationServicepublic long getExecutedOperationCount()
InternalOperationServicegetExecutedOperationCount in interface InternalOperationServicepublic int getRemoteOperationsCount()
getRemoteOperationsCount in interface InternalOperationServicepublic int getOperationExecutorQueueSize()
getOperationExecutorQueueSize in interface InternalOperationServicepublic int getPriorityOperationExecutorQueueSize()
getPriorityOperationExecutorQueueSize in interface InternalOperationServicepublic OperationExecutor getOperationExecutor()
public int getResponseQueueSize()
InternalOperationServicegetResponseQueueSize in interface InternalOperationServicepublic void populate(LiveOperations liveOperations)
LiveOperationsTrackerpopulate in interface LiveOperationsTrackerliveOperations - the LiveOperations to populate.public void execute(PartitionSpecificRunnable task)
InternalOperationServiceClientEngine when it has received a Packet containing
a request that needs to be processed.execute in interface InternalOperationServicetask - the task to executepublic InvocationBuilder createInvocationBuilder(String serviceName, Operation op, int partitionId)
createInvocationBuilder in interface OperationServicepublic InvocationBuilder createInvocationBuilder(String serviceName, Operation op, Address target)
createInvocationBuilder in interface OperationServicepublic void run(Operation op)
OperationServicerun in interface OperationServiceop - the operation to execute in the calling threadpublic void execute(Operation op)
OperationServiceexecute in interface OperationServiceop - the operation to execute in the operation executor pool.public boolean isRunAllowed(Operation op)
InternalOperationServiceOperationService.run(Operation)
method, otherwise OperationService.execute(Operation) should be used.isRunAllowed in interface InternalOperationServiceop - the operation to check.public <E> InternalCompletableFuture<E> invokeOnPartition(String serviceName, Operation op, int partitionId)
invokeOnPartition in interface OperationServicepublic <E> InternalCompletableFuture<E> invokeOnPartition(Operation op)
OperationServiceinvokeOnPartition in interface OperationServiceE - the return type of the operation responseop - the operationpublic <E> InternalCompletableFuture<E> invokeOnTarget(String serviceName, Operation op, Address target)
invokeOnTarget in interface OperationServicepublic <V> void asyncInvokeOnPartition(String serviceName, Operation op, int partitionId, ExecutionCallback<V> callback)
asyncInvokeOnPartition in interface InternalOperationServicepublic void onStartAsyncOperation(Operation op)
public void onCompletionAsyncOperation(Operation op)
public boolean isCallTimedOut(Operation op)
InternalOperationServiceisCallTimedOut in interface InternalOperationServiceop - the operation to check.public Map<Integer,Object> invokeOnAllPartitions(String serviceName, OperationFactory operationFactory) throws Exception
OperationServiceinvokeOnAllPartitions in interface OperationServiceserviceName - the name of the service.operationFactory - the factory responsible for creating operationsExceptionpublic Map<Integer,Object> invokeOnPartitions(String serviceName, OperationFactory operationFactory, Collection<Integer> partitions) throws Exception
OperationServiceinvokeOnPartitions in interface OperationServiceserviceName - the name of the serviceoperationFactory - the factory responsible for creating operationspartitions - the partitions the operation should be executed on.Exceptionpublic Map<Integer,Object> invokeOnPartitions(String serviceName, OperationFactory operationFactory, int[] partitions) throws Exception
OperationServiceinvokeOnPartitions in interface OperationServiceserviceName - the name of the serviceoperationFactory - the factory responsible for creating operationspartitions - the partitions the operation should be executed on.Exceptionpublic boolean send(Operation op, Address target)
OperationServicesend in interface OperationServiceop - the operation to send and execute.target - the address of that target member.public void onMemberLeft(MemberImpl member)
public void reset()
public void provideMetrics(MetricsRegistry registry)
provideMetrics in interface MetricsProviderpublic void start()
public void shutdownInvocations()
public void shutdownOperationExecutor()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.