10 Kasım 2022 Perşembe

Hazelcast SPI OperationThread Sınıfı

Giriş
Şu satırı dahil ederiz
import com.hazelcast.spiimpl.operationexecutor.impl.OperationThread;
Kalıtım şöyle
Thread
  HazelcastManagedThread
    OperationThread
      GenericOperationThread
      PartitionOperationThread

process metodu
Metod şöyle. TaskBatch belirtilen partition'lar üzerinde bir şey çalıştırır.
private void process(TaskBatch batch) {
  Object task = batch.next();
  if (task == null) {
    completedOperationBatchCount.inc();
    return;
  }

  try {
    if (task instanceof Operation) {
      if (process((Operation) task)) {
        queue.add(task, false);
      }
    } else if (task instanceof Runnable) {
      process((Runnable) task);
    } else {
      throw new IllegalStateException("Unhandled task: " + task + " from " 
        + batch.taskFactory());
    }
  } finally {
    queue.add(batch, false);
  }
}
TaskBatch nereden gelir? Bir örnek şöyle. Burada AbstractAsyncMessageTask aslında com.hazelcast.client.impl.protocol.task.map.MapClearMessageTask
<init>:37, TaskBatch (com.hazelcast.spi.impl.operationexecutor.impl)
executeOnPartitions:365, OperationExecutorImpl (com.hazelcast.spi.impl.operationexecutor.impl)
executeOnPartitions:286, OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl)
executeOperations:178, PartitionIteratingOperation$OffloadImpl (com.hazelcast.spi.impl.operationservice.impl.operations)
start:150, PartitionIteratingOperation$OffloadImpl (com.hazelcast.spi.impl.operationservice.impl.operations)
call:307, OperationRunnerImpl (com.hazelcast.spi.impl.operationservice.impl)
run:258, OperationRunnerImpl (com.hazelcast.spi.impl.operationservice.impl)
run:219, OperationRunnerImpl (com.hazelcast.spi.impl.operationservice.impl)
run:411, OperationExecutorImpl (com.hazelcast.spi.impl.operationexecutor.impl)
runOrExecute:438, OperationExecutorImpl (com.hazelcast.spi.impl.operationexecutor.impl)
doInvokeLocal:601, Invocation (com.hazelcast.spi.impl.operationservice.impl)
doInvoke:580, Invocation (com.hazelcast.spi.impl.operationservice.impl)
invoke0:541, Invocation (com.hazelcast.spi.impl.operationservice.impl)
invoke:241, Invocation (com.hazelcast.spi.impl.operationservice.impl)
invoke:61, InvocationBuilderImpl (com.hazelcast.spi.impl.operationservice.impl)
invokeOnAllPartitions:120, InvokeOnPartitions (com.hazelcast.spi.impl.operationservice.impl)
invokeAsync:98, InvokeOnPartitions (com.hazelcast.spi.impl.operationservice.impl)
invokeOnAllPartitionsAsync:420, OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl)
processInternal:40, AbstractAllPartitionsMessageTask (com.hazelcast.client.impl.protocol.task)
processMessage:71, AbstractAsyncMessageTask (com.hazelcast.client.impl.protocol.task)
initializeAndProcessMessage:153, AbstractMessageTask (com.hazelcast.client.impl.protocol.task)
run:116, AbstractMessageTask (com.hazelcast.client.impl.protocol.task)
runWorker:1149, ThreadPoolExecutor (java.util.concurrent)
run:624, ThreadPoolExecutor$Worker (java.util.concurrent)
run:748, Thread (java.lang)
executeRun:76, HazelcastManagedThread (com.hazelcast.internal.util.executor)
run:102, HazelcastManagedThread (com.hazelcast.internal.util.executor)
MapClearMessageTask sınıfı şöyle. Yani her partition için bir com.hazelcast.map.impl.operation.ClearOperation nesnesi üretiyor.
@Override
protected OperationFactory createOperationFactory() {
  MapOperationProvider operationProvider = getOperationProvider(parameters);
  return operationProvider.createClearOperationFactory(parameters);
}



Hiç yorum yok:

Yorum Gönder

THIRD-PARTY.txt Dosyası

Kullanılan harici kütüphanelerin sürümleri bu dosyada Dosyanın yolu şöyle hazelcast/licenses/THIRD-PARTY.txt