use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class MigrationManagerTest method setupMocks.
private void setupMocks() {
node = mock(Node.class);
NodeEngineImpl nodeEngine = mock(NodeEngineImpl.class);
HazelcastInstance instance = mock(HazelcastInstance.class);
MetricsRegistry metricsRegistry = mock(MetricsRegistry.class);
ExecutionService executionService = mock(ExecutionService.class);
ManagedExecutorService asyncExecutor = mock(ManagedExecutorService.class);
clusterService = mock(ClusterServiceImpl.class);
when(node.getProperties()).thenReturn(new HazelcastProperties(new Config()));
when(node.getNodeEngine()).thenReturn(nodeEngine);
when(node.getClusterService()).thenReturn(clusterService);
when(instance.getName()).thenReturn("dev");
when(nodeEngine.getHazelcastInstance()).thenReturn(instance);
when(nodeEngine.getMetricsRegistry()).thenReturn(metricsRegistry);
when(executionService.getExecutor(any(String.class))).thenReturn(asyncExecutor);
when(nodeEngine.getExecutionService()).thenReturn(executionService);
when(clusterService.getClusterVersion()).thenReturn(Versions.CURRENT_CLUSTER_VERSION);
partitionStateManager = mock(PartitionStateManager.class);
partitionService = mock(InternalPartitionServiceImpl.class);
when(partitionService.getPartitionStateManager()).thenReturn(partitionStateManager);
when(node.getConfig()).thenReturn(new Config());
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class ClientEngineImpl method newBlockingExecutor.
private Executor newBlockingExecutor() {
final ExecutionService executionService = nodeEngine.getExecutionService();
int coreSize = Runtime.getRuntime().availableProcessors();
int threadCount = node.getProperties().getInteger(ClusterProperty.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);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class ClientEngineImpl method newClientQueryExecutor.
private Executor newClientQueryExecutor() {
final ExecutionService executionService = nodeEngine.getExecutionService();
int coreSize = RuntimeAvailableProcessors.get();
int threadCount = node.getProperties().getInteger(ClusterProperty.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);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class ClusterViewListenerService method schedulePeriodicPush.
private void schedulePeriodicPush() {
ExecutionService executor = nodeEngine.getExecutionService();
executor.scheduleWithRepetition(this::pushView, PUSH_PERIOD_IN_SECONDS, PUSH_PERIOD_IN_SECONDS, TimeUnit.SECONDS);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class JobCoordinationService method startScanningForJobs.
public void startScanningForJobs() {
ExecutionService executionService = nodeEngine.getExecutionService();
HazelcastProperties properties = nodeEngine.getProperties();
maxJobScanPeriodInMillis = properties.getMillis(JOB_SCAN_PERIOD);
try {
executionService.schedule(COORDINATOR_EXECUTOR_NAME, this::scanJobs, 0, MILLISECONDS);
logger.info("Jet started scanning for jobs");
} catch (RejectedExecutionException ex) {
logger.info("Scan jobs task is rejected on the execution service since the executor service" + " has shutdown", ex);
}
}
Aggregations