use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class MetadataRaftGroupManager method createRaftNodeAsync.
private void createRaftNodeAsync(CPGroupInfo group) {
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.execute(CP_SUBSYSTEM_EXECUTOR, () -> raftService.createRaftNode(group.id(), group.members()));
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class ExecutorServiceTest method testMultiPreregisteredExecutionCallbackCompletableFuture.
@Test
public void testMultiPreregisteredExecutionCallbackCompletableFuture() {
ExecutionService es = getExecutionService(createHazelcastInstance(smallInstanceConfig()));
CountDownLatch callableLatch = new CountDownLatch(1);
CountDownLatch callbackLatch = new CountDownLatch(2);
ExecutorService executorService = Executors.newSingleThreadExecutor();
try {
Future<String> future = executorService.submit(new CountDownLatchAwaitingCallable(callableLatch));
CountingDownExecutionCallback<String> callback1 = new CountingDownExecutionCallback<>(callbackLatch);
CountingDownExecutionCallback<String> callback2 = new CountingDownExecutionCallback<>(callbackLatch);
CompletableFuture<String> completableFuture = es.asCompletableFuture(future);
completableFuture.whenCompleteAsync(callback1);
completableFuture.whenCompleteAsync(callback2);
callableLatch.countDown();
assertOpenEventually(callbackLatch);
assertEquals(CountDownLatchAwaitingCallable.RESULT, callback1.getResult());
assertEquals(CountDownLatchAwaitingCallable.RESULT, callback2.getResult());
} finally {
executorService.shutdown();
}
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class MetricsServiceTest method testNoCollectionIfMetricsEnabledAndMcJmxDisabled.
@Test
public void testNoCollectionIfMetricsEnabledAndMcJmxDisabled() {
config.getMetricsConfig().setEnabled(true);
config.getMetricsConfig().getManagementCenterConfig().setEnabled(false);
config.getMetricsConfig().getJmxConfig().setEnabled(false);
ExecutionService executionServiceMock = mock(ExecutionService.class);
when(nodeEngineMock.getExecutionService()).thenReturn(executionServiceMock);
prepareMetricsService();
verifyNoMoreInteractions(executionServiceMock);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class MetricsServiceTest method testNoCollectionIfMetricsDisabled.
@Test
public void testNoCollectionIfMetricsDisabled() {
config.getMetricsConfig().setEnabled(false);
ExecutionService executionServiceMock = mock(ExecutionService.class);
when(nodeEngineMock.getExecutionService()).thenReturn(executionServiceMock);
prepareMetricsService();
verifyNoMoreInteractions(executionServiceMock);
}
use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class RepairingTaskTest method newRepairingTask.
private static RepairingTask newRepairingTask(Config config) {
HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
InvalidationMetaDataFetcher invalidationMetaDataFetcher = mock(InvalidationMetaDataFetcher.class);
ExecutionService executionService = mock(ExecutionService.class);
SerializationService serializationService = mock(SerializationService.class);
MinimalPartitionService minimalPartitionService = mock(MinimalPartitionService.class);
UUID uuid = UuidUtil.newUnsecureUUID();
ILogger logger = Logger.getLogger(RepairingTask.class);
return new RepairingTask(hazelcastProperties, invalidationMetaDataFetcher, executionService.getGlobalTaskScheduler(), serializationService, minimalPartitionService, uuid, logger);
}
Aggregations