use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class TimedMemberStateFactoryHelper method registerJMXBeans.
static void registerJMXBeans(HazelcastInstanceImpl instance, MemberStateImpl memberState) {
final EventService es = instance.node.nodeEngine.getEventService();
final InternalOperationService os = instance.node.nodeEngine.getOperationService();
final ConnectionManager cm = instance.node.connectionManager;
final InternalPartitionService ps = instance.node.partitionService;
final ProxyService proxyService = instance.node.nodeEngine.getProxyService();
final ExecutionService executionService = instance.node.nodeEngine.getExecutionService();
final MXBeansDTO beans = new MXBeansDTO();
final EventServiceDTO esBean = new EventServiceDTO(es);
beans.setEventServiceBean(esBean);
final OperationServiceDTO osBean = new OperationServiceDTO(os);
beans.setOperationServiceBean(osBean);
final ConnectionManagerDTO cmBean = new ConnectionManagerDTO(cm);
beans.setConnectionManagerBean(cmBean);
final PartitionServiceBeanDTO psBean = new PartitionServiceBeanDTO(ps, instance);
beans.setPartitionServiceBean(psBean);
final ProxyServiceDTO proxyServiceBean = new ProxyServiceDTO(proxyService);
beans.setProxyServiceBean(proxyServiceBean);
final ManagedExecutorService systemExecutor = executionService.getExecutor(ExecutionService.SYSTEM_EXECUTOR);
final ManagedExecutorService asyncExecutor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
final ManagedExecutorService scheduledExecutor = executionService.getExecutor(ExecutionService.SCHEDULED_EXECUTOR);
final ManagedExecutorService clientExecutor = executionService.getExecutor(ExecutionService.CLIENT_EXECUTOR);
final ManagedExecutorService queryExecutor = executionService.getExecutor(ExecutionService.QUERY_EXECUTOR);
final ManagedExecutorService ioExecutor = executionService.getExecutor(ExecutionService.IO_EXECUTOR);
final ManagedExecutorDTO systemExecutorDTO = new ManagedExecutorDTO(systemExecutor);
final ManagedExecutorDTO asyncExecutorDTO = new ManagedExecutorDTO(asyncExecutor);
final ManagedExecutorDTO scheduledExecutorDTO = new ManagedExecutorDTO(scheduledExecutor);
final ManagedExecutorDTO clientExecutorDTO = new ManagedExecutorDTO(clientExecutor);
final ManagedExecutorDTO queryExecutorDTO = new ManagedExecutorDTO(queryExecutor);
final ManagedExecutorDTO ioExecutorDTO = new ManagedExecutorDTO(ioExecutor);
beans.putManagedExecutor(ExecutionService.SYSTEM_EXECUTOR, systemExecutorDTO);
beans.putManagedExecutor(ExecutionService.ASYNC_EXECUTOR, asyncExecutorDTO);
beans.putManagedExecutor(ExecutionService.SCHEDULED_EXECUTOR, scheduledExecutorDTO);
beans.putManagedExecutor(ExecutionService.CLIENT_EXECUTOR, clientExecutorDTO);
beans.putManagedExecutor(ExecutionService.QUERY_EXECUTOR, queryExecutorDTO);
beans.putManagedExecutor(ExecutionService.IO_EXECUTOR, ioExecutorDTO);
memberState.setBeans(beans);
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class BatchInvalidator method startBackgroundBatchProcessor.
private void startBackgroundBatchProcessor() {
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.scheduleWithRepetition(invalidationExecutorName, new BatchInvalidationEventSender(), batchFrequencySeconds, batchFrequencySeconds, SECONDS);
}
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 BasicCompletableFutureTest method basicCompletableFuture.
private static <V> BasicCompletableFuture<V> basicCompletableFuture(Future<V> future) {
NodeEngine engine = mock(NodeEngine.class);
when(engine.getLogger(BasicCompletableFuture.class)).thenReturn(mock(ILogger.class));
ExecutionService executionService = mock(ExecutionService.class);
when(engine.getExecutionService()).thenReturn(executionService);
when(executionService.getExecutor(anyString())).thenReturn(new TestCurrentThreadExecutor());
return new BasicCompletableFuture<V>(future, engine);
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class CachedExecutorServiceDelegateTest method setup.
@Before
public void setup() {
cachedExecutorService = new NamedThreadPoolExecutor("test", 0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory());
ExecutionService executionService = mock(ExecutionService.class);
when(executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR)).thenReturn(cachedExecutorService);
nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getExecutionService()).thenReturn(executionService);
}
Aggregations