use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class JobSupervisor method checkFullyProcessed.
public void checkFullyProcessed(JobProcessInformation processInformation) {
if (isOwnerNode()) {
JobPartitionState[] partitionStates = processInformation.getPartitionStates();
for (JobPartitionState partitionState : partitionStates) {
if (partitionState == null || partitionState.getState() != JobPartitionState.State.PROCESSED) {
return;
}
}
final String name = configuration.getName();
final String jobId = configuration.getJobId();
final NodeEngine nodeEngine = configuration.getNodeEngine();
final GetResultOperationFactory operationFactory = new GetResultOperationFactory(name, jobId);
// Get the initial future object to eventually set the result and cleanup
final TrackableJobFuture future = jobTracker.unregisterTrackableJob(jobId);
if (future == null) {
// If already handled just return
return;
}
final JobSupervisor jobSupervisor = this;
Runnable runnable = new GetResultsRunnable(nodeEngine, operationFactory, jobId, jobSupervisor, future);
ExecutionService executionService = nodeEngine.getExecutionService();
ManagedExecutorService executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
executor.submit(runnable);
}
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class PostJoinProxyOperation method run.
@Override
public void run() throws Exception {
if (proxies == null || proxies.size() <= 0) {
return;
}
NodeEngine nodeEngine = getNodeEngine();
ProxyServiceImpl proxyService = getService();
ExecutionService executionService = nodeEngine.getExecutionService();
for (final ProxyInfo proxy : proxies) {
final ProxyRegistry registry = proxyService.getOrCreateRegistry(proxy.getServiceName());
try {
executionService.execute(ExecutionService.SYSTEM_EXECUTOR, new Runnable() {
@Override
public void run() {
registry.createProxy(proxy.getObjectName(), false, true);
}
});
} catch (Throwable t) {
getLogger().warning("Cannot create proxy [" + proxy.getServiceName() + ":" + proxy.getObjectName() + "]!", t);
}
}
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class ExecutorServiceTest method testMultiPreregisteredExecutionCallbackCompletableFuture.
@Test
public void testMultiPreregisteredExecutionCallbackCompletableFuture() {
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));
CountingDownExecutionCallback<String> callback1 = new CountingDownExecutionCallback<String>(callbackLatch);
CountingDownExecutionCallback<String> callback2 = new CountingDownExecutionCallback<String>(callbackLatch);
ICompletableFuture<String> completableFuture = es.asCompletableFuture(future);
completableFuture.andThen(callback1);
completableFuture.andThen(callback2);
callableLatch.countDown();
assertOpenEventually(callbackLatch);
assertEquals(CountDownLatchAwaitingCallable.RESULT, callback1.getResult());
assertEquals(CountDownLatchAwaitingCallable.RESULT, callback2.getResult());
} finally {
executorService.shutdown();
}
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class ClientEngineImpl method newClientExecutor.
private Executor newClientExecutor() {
final ExecutionService executionService = nodeEngine.getExecutionService();
int coreSize = Runtime.getRuntime().availableProcessors();
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);
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class RepairingTaskTest method newRepairingTask.
private RepairingTask newRepairingTask(Config config) {
MetaDataFetcher metaDataFetcher = mock(MetaDataFetcher.class);
ExecutionService executionService = mock(ExecutionService.class);
MinimalPartitionService minimalPartitionService = mock(MinimalPartitionService.class);
String uuid = UuidUtil.newUnsecureUUID().toString();
ILogger logger = Logger.getLogger(RepairingTask.class);
HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
return new RepairingTask(metaDataFetcher, executionService.getGlobalTaskScheduler(), minimalPartitionService, hazelcastProperties, uuid, logger);
}
Aggregations