use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class PartitionContainer method createRecordStore.
private RecordStore createRecordStore(String name) {
MapServiceContext serviceContext = mapService.getMapServiceContext();
MapContainer mapContainer = serviceContext.getMapContainer(name);
MapConfig mapConfig = mapContainer.getMapConfig();
NodeEngine nodeEngine = serviceContext.getNodeEngine();
IPartitionService ps = nodeEngine.getPartitionService();
OperationService opService = nodeEngine.getOperationService();
ExecutionService execService = nodeEngine.getExecutionService();
HazelcastProperties hazelcastProperties = nodeEngine.getProperties();
MapKeyLoader keyLoader = new MapKeyLoader(name, opService, ps, nodeEngine.getClusterService(), execService, mapContainer.toData());
keyLoader.setMaxBatch(hazelcastProperties.getInteger(GroupProperty.MAP_LOAD_CHUNK_SIZE));
keyLoader.setMaxSize(getMaxSizePerNode(mapConfig.getMaxSizeConfig()));
keyLoader.setHasBackup(mapConfig.getTotalBackupCount() > 0);
keyLoader.setMapOperationProvider(serviceContext.getMapOperationProvider(name));
RecordStore recordStore = serviceContext.createRecordStore(mapContainer, partitionId, keyLoader);
recordStore.init();
return recordStore;
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class ExecutorServiceTest method testMultiPostRegisteredExecutionCallbackCompletableFuture.
@Test
public void testMultiPostRegisteredExecutionCallbackCompletableFuture() throws Exception {
ExecutionService es = getExecutionService(createHazelcastInstance());
CountDownLatch callableLatch = new CountDownLatch(1);
CountDownLatch callbackLatch = new CountDownLatch(2);
ExecutorService executorService = Executors.newSingleThreadExecutor();
try {
Future<String> future = executorService.submit(new CountDownLatchAwaitingCallable(callableLatch));
ICompletableFuture<String> completableFuture = es.asCompletableFuture(future);
callableLatch.countDown();
future.get();
CountingDownExecutionCallback<String> callback1 = new CountingDownExecutionCallback<String>(callbackLatch);
completableFuture.andThen(callback1);
CountingDownExecutionCallback<String> callback2 = new CountingDownExecutionCallback<String>(callbackLatch);
completableFuture.andThen(callback2);
assertOpenEventually(callbackLatch);
assertEquals(CountDownLatchAwaitingCallable.RESULT, callback1.getResult());
assertEquals(CountDownLatchAwaitingCallable.RESULT, callback2.getResult());
} finally {
executorService.shutdown();
}
}
Aggregations