public DurableExecutorContainer(NodeEngineImpl nodeEngine, String name, int partitionId, int durability, 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; }
@Override public void removeEndpoint(final Address endPoint) { nodeEngine.getExecutionService().execute(ExecutionService.IO_EXECUTOR, new Runnable() { @Override public void run() { node.clusterService.suspectAddressIfNotConnected(endPoint); } }); }
private ExecutorService newClientsManagementExecutor() { //CLIENT_MANAGEMENT_EXECUTOR is a single threaded executor to ensure that disconnect/auth are executed in correct order. InternalExecutionService executionService = nodeEngine.getExecutionService(); return executionService.register(CLIENT_MANAGEMENT_EXECUTOR, 1, Integer.MAX_VALUE, ExecutorType.CACHED); }
private ExecutorService newClientsManagementExecutor() { //CLIENT_MANAGEMENT_EXECUTOR is a single threaded executor to ensure that disconnect/auth are executed in correct order. InternalExecutionService executionService = nodeEngine.getExecutionService(); return executionService.register(CLIENT_MANAGEMENT_EXECUTOR, 1, Integer.MAX_VALUE, ExecutorType.CACHED); }
@Override public void destroyDistributedObject(String name) { shutdownExecutors.remove(name); nodeEngine.getExecutionService().shutdownDurableExecutor(name); quorumConfigCache.remove(name); }
public void init() { instance.node.nodeEngine.getExecutionService().scheduleWithRepetition(new Runnable() { @Override public void run() { memberStateSafe = instance.getPartitionService().isLocalMemberSafe(); } }, INITIAL_PARTITION_SAFETY_CHECK_DELAY, PARTITION_SAFETY_CHECK_PERIOD, TimeUnit.SECONDS); }
private Executor newBlockingExecutor() { final ExecutionService executionService = nodeEngine.getExecutionService(); int coreSize = Runtime.getRuntime().availableProcessors(); int threadCount = node.getProperties().getInteger(GroupProperty.CLIENT_ENGINE_BLOCKING_THREAD_COUNT); if (threadCount <= 0) { threadCount = coreSize * BLOCKING_THREADS_PER_CORE; } logger.finest("Creating new client executor for blocking tasks with threadCount=" + threadCount); return executionService.register(ExecutionService.CLIENT_BLOCKING_EXECUTOR, threadCount, coreSize * EXECUTOR_QUEUE_CAPACITY_PER_CORE, ExecutorType.CONCRETE); }
@Override public void onDisconnect(final Address endpoint, Throwable cause) { if (cause == null) { // connection is closed explicitly. we should not attempt to reconnect return; } if (node.clusterService.getMember(endpoint) != null) { nodeEngine.getExecutionService().execute(ExecutionService.IO_EXECUTOR, new ReconnectionTask(endpoint)); } }
@Override public void memberAdded(MembershipServiceEvent event) { if (isInactive()) { return; } nodeEngine.getExecutionService().execute(QUORUM_EXECUTOR, new UpdateQuorums(event)); }
@Override public void onHeartbeat(Member member, long timestamp) { if (isInactive() || !heartbeatAware) { return; } nodeEngine.getExecutionService().execute(QUORUM_EXECUTOR, new OnHeartbeat(member, timestamp)); }
/** * Tries to ping the {@code member} and removes the member if it is unreachable. * * @param member the member for which we need to determine reachability */ private void runPingTask(final Member member) { nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR, icmpParallelMode ? new PeriodicPingTask(member) : new PingTask(member)); }
@Override public void onDisconnect(final Address endpoint, Throwable cause) { if (cause == null) { // connection is closed explicitly. we should not attempt to reconnect return; } if (node.clusterService.getMember(endpoint) != null) { nodeEngine.getExecutionService().execute(ExecutionService.IO_EXECUTOR, new ReconnectionTask(endpoint)); } }
@Override public void memberAdded(MembershipServiceEvent event) { if (isInactive()) { return; } nodeEngine.getExecutionService().execute(QUORUM_EXECUTOR, new UpdateQuorums(event)); }
@Override public void onPingLost(Member member) { if (isInactive() || !pingAware) { return; } nodeEngine.getExecutionService().execute(QUORUM_EXECUTOR, new OnPing(member, false)); }
@Override public void processRequest(TextCommand command) { startResponseThreadIfNotRunning(); node.nodeEngine.getExecutionService().execute("hz:text", new CommandExecutor(command)); }
public void sendPartitionLostEvent(int partitionId, int lostReplicaIndex) { final IPartitionLostEvent event = new IPartitionLostEvent(partitionId, lostReplicaIndex, nodeEngine.getThisAddress()); final InternalPartitionLostEventPublisher publisher = new InternalPartitionLostEventPublisher(nodeEngine, event); nodeEngine.getExecutionService().execute(SYSTEM_EXECUTOR, publisher); }
public void sendPartitionLostEvent(int partitionId, int lostReplicaIndex) { final IPartitionLostEvent event = new IPartitionLostEvent(partitionId, lostReplicaIndex, nodeEngine.getThisAddress()); final InternalPartitionLostEventPublisher publisher = new InternalPartitionLostEventPublisher(nodeEngine, event); nodeEngine.getExecutionService().execute(SYSTEM_EXECUTOR, publisher); }
private Executor newClientExecutor() { final ExecutionService executionService = nodeEngine.getExecutionService(); int coreSize = RuntimeAvailableProcessors.get(); int threadCount = node.getProperties().getInteger(GroupProperty.CLIENT_ENGINE_THREAD_COUNT); if (threadCount <= 0) { threadCount = coreSize * THREADS_PER_CORE; } logger.finest("Creating new client executor with threadCount=" + threadCount); return executionService.register(ExecutionService.CLIENT_EXECUTOR, threadCount, coreSize * EXECUTOR_QUEUE_CAPACITY_PER_CORE, ExecutorType.CONCRETE); }
private Executor newClientQueryExecutor() { final ExecutionService executionService = nodeEngine.getExecutionService(); int coreSize = RuntimeAvailableProcessors.get(); int threadCount = node.getProperties().getInteger(GroupProperty.CLIENT_ENGINE_QUERY_THREAD_COUNT); if (threadCount <= 0) { threadCount = coreSize * QUERY_THREADS_PER_CORE; } logger.finest("Creating new client query executor with threadCount=" + threadCount); return executionService.register(ExecutionService.CLIENT_QUERY_EXECUTOR, threadCount, coreSize * EXECUTOR_QUEUE_CAPACITY_PER_CORE, ExecutorType.CONCRETE); }
protected InstanceMBean(HazelcastInstanceImpl hazelcastInstance, ManagementService managementService) { super(hazelcastInstance, managementService); createProperties(hazelcastInstance); this.config = hazelcastInstance.getConfig(); this.cluster = hazelcastInstance.getCluster(); Node node = hazelcastInstance.node; ExecutionService executionService = node.nodeEngine.getExecutionService(); InternalOperationService operationService = node.nodeEngine.getOperationService(); createMBeans(hazelcastInstance, managementService, node, executionService, operationService); registerMBeans(); registerWanPublisherMBeans(node.nodeEngine.getWanReplicationService()); }