Giriş
Şu satırı dahil ederiz
import com.hazelcast.durableexecutor.impl.DurableExecutorContainer;
Bu sınıfın içinde bir Runnable var. Şöyle
public class DurableExecutorContainer { public final class TaskProcessor extends FutureTask implements Runnable { ... } }
Thread ismi şöyle. Son kısım, thread-1 ve thread-5 arasında bir şey olur
hz.XXX.cached-thread-1
Command Pattern
AbstractDurableExecutorOperation : Tüm durable task'ların atası
TaskOperation : DurableExecutorService executor.submit() ile çalışır
DurableExecutorPartitionContainer Sınıfı
DurableExecutorContainer nesnesi DurableExecutorPartitionContainer içinde durur. Her partition için kod şöylepublic class DurableExecutorPartitionContainer { private final int partitionId; private final NodeEngineImpl nodeEngine; private final ConcurrentMap<String, DurableExecutorContainer> executorContainerMap = new ConcurrentHashMap<>(); ... }
execute metodu
public DurableExecutorContainer(NodeEngineImpl nodeEngine, String name, int partitionId, int durability, boolean statisticsEnabled, TaskRingBuffer ringBuffer) { this.name = name; this.nodeEngine = nodeEngine; this.executionService = nodeEngine.getExecutionService(); this.partitionId = partitionId; this.logger = nodeEngine.getLogger(DurableExecutorContainer.class); this.durability = durability; this.ringBuffer = ringBuffer; this.statisticsEnabled = statisticsEnabled; this.executorStats = ((DistributedDurableExecutorService) nodeEngine .getService(SERVICE_NAME)) .getExecutorStats(); } public int execute(Callable callable) { try { int sequence = ringBuffer.add(callable); TaskProcessor processor = new TaskProcessor(sequence, callable); executionService.executeDurable(name, processor); return sequence; } catch (RejectedExecutionException e) { if (statisticsEnabled) { executorStats.rejectExecution(name); } throw e; } }
Hiç yorum yok:
Yorum Gönder