Search in sources :

Example 1 with ManagedExecutorService

use of com.hazelcast.util.executor.ManagedExecutorService 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);
}
Also used : InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) EventService(com.hazelcast.spi.EventService) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ExecutionService(com.hazelcast.spi.ExecutionService) EventServiceDTO(com.hazelcast.internal.management.dto.EventServiceDTO) MXBeansDTO(com.hazelcast.internal.management.dto.MXBeansDTO) ManagedExecutorDTO(com.hazelcast.internal.management.dto.ManagedExecutorDTO) ConnectionManagerDTO(com.hazelcast.internal.management.dto.ConnectionManagerDTO) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) ConnectionManager(com.hazelcast.nio.ConnectionManager) ProxyService(com.hazelcast.spi.ProxyService) PartitionServiceBeanDTO(com.hazelcast.internal.management.dto.PartitionServiceBeanDTO) OperationServiceDTO(com.hazelcast.internal.management.dto.OperationServiceDTO) ProxyServiceDTO(com.hazelcast.internal.management.dto.ProxyServiceDTO)

Example 2 with ManagedExecutorService

use of com.hazelcast.util.executor.ManagedExecutorService in project hazelcast by hazelcast.

the class MapServiceContextImpl method createAggregationResultProcessor.

private AggregationResultProcessor createAggregationResultProcessor(SerializationService ss) {
    boolean parallelAccumulation = nodeEngine.getProperties().getBoolean(AGGREGATION_ACCUMULATION_PARALLEL_EVALUATION);
    int opTimeoutInMillis = nodeEngine.getProperties().getInteger(OPERATION_CALL_TIMEOUT_MILLIS);
    AccumulationExecutor accumulationExecutor;
    if (parallelAccumulation) {
        ManagedExecutorService queryExecutorService = nodeEngine.getExecutionService().getExecutor(QUERY_EXECUTOR);
        accumulationExecutor = new ParallelAccumulationExecutor(queryExecutorService, ss, opTimeoutInMillis);
    } else {
        accumulationExecutor = new CallerRunsAccumulationExecutor(ss);
    }
    return new AggregationResultProcessor(accumulationExecutor, nodeEngine.getSerializationService());
}
Also used : ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) ParallelAccumulationExecutor(com.hazelcast.map.impl.query.ParallelAccumulationExecutor) CallerRunsAccumulationExecutor(com.hazelcast.map.impl.query.CallerRunsAccumulationExecutor) AccumulationExecutor(com.hazelcast.map.impl.query.AccumulationExecutor) CallerRunsAccumulationExecutor(com.hazelcast.map.impl.query.CallerRunsAccumulationExecutor) ParallelAccumulationExecutor(com.hazelcast.map.impl.query.ParallelAccumulationExecutor) AggregationResultProcessor(com.hazelcast.map.impl.query.AggregationResultProcessor)

Example 3 with ManagedExecutorService

use of com.hazelcast.util.executor.ManagedExecutorService in project hazelcast by hazelcast.

the class MapServiceContextImpl method createMapQueryRunner.

protected QueryRunner createMapQueryRunner(NodeEngine nodeEngine, QueryOptimizer queryOptimizer, ResultProcessorRegistry resultProcessorRegistry, PartitionScanRunner partitionScanRunner) {
    boolean parallelEvaluation = nodeEngine.getProperties().getBoolean(QUERY_PREDICATE_PARALLEL_EVALUATION);
    PartitionScanExecutor partitionScanExecutor;
    if (parallelEvaluation) {
        int opTimeoutInMillis = nodeEngine.getProperties().getInteger(OPERATION_CALL_TIMEOUT_MILLIS);
        ManagedExecutorService queryExecutorService = nodeEngine.getExecutionService().getExecutor(QUERY_EXECUTOR);
        partitionScanExecutor = new ParallelPartitionScanExecutor(partitionScanRunner, queryExecutorService, opTimeoutInMillis);
    } else {
        partitionScanExecutor = new CallerRunsPartitionScanExecutor(partitionScanRunner);
    }
    return new QueryRunner(this, queryOptimizer, partitionScanExecutor, resultProcessorRegistry);
}
Also used : ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) CallerRunsPartitionScanExecutor(com.hazelcast.map.impl.query.CallerRunsPartitionScanExecutor) ParallelPartitionScanExecutor(com.hazelcast.map.impl.query.ParallelPartitionScanExecutor) PartitionScanExecutor(com.hazelcast.map.impl.query.PartitionScanExecutor) ParallelPartitionScanExecutor(com.hazelcast.map.impl.query.ParallelPartitionScanExecutor) CallerRunsPartitionScanExecutor(com.hazelcast.map.impl.query.CallerRunsPartitionScanExecutor) QueryRunner(com.hazelcast.map.impl.query.QueryRunner)

Example 4 with ManagedExecutorService

use of com.hazelcast.util.executor.ManagedExecutorService 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);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) JobPartitionState(com.hazelcast.mapreduce.JobPartitionState) GetResultOperationFactory(com.hazelcast.mapreduce.impl.operation.GetResultOperationFactory) ExecutionService(com.hazelcast.spi.ExecutionService)

Example 5 with ManagedExecutorService

use of com.hazelcast.util.executor.ManagedExecutorService in project hazelcast by hazelcast.

the class ScheduledExecutorServiceBasicTest method config.

@Test
public void config() throws ExecutionException, InterruptedException {
    String schedulerName = "foobar";
    ScheduledExecutorConfig sec = new ScheduledExecutorConfig().setName(schedulerName).setDurability(5).setPoolSize(24);
    Config config = new Config().addScheduledExecutorConfig(sec);
    HazelcastInstance[] instances = createClusterWithCount(1, config);
    IScheduledFuture future = instances[0].getScheduledExecutorService(schedulerName).schedule(new PlainCallableTask(), 0, SECONDS);
    NodeEngineImpl nodeEngine = getNodeEngineImpl(instances[0]);
    ManagedExecutorService mes = (ManagedExecutorService) nodeEngine.getExecutionService().getScheduledDurable(sec.getName());
    DistributedScheduledExecutorService dses = nodeEngine.getService(DistributedScheduledExecutorService.SERVICE_NAME);
    assertNotNull(mes);
    assertEquals(24, mes.getMaximumPoolSize());
    assertEquals(5, dses.getPartition(future.getHandler().getPartitionId()).getOrCreateContainer(schedulerName).getDurability());
    assertEquals(1, dses.getPartition(future.getHandler().getPartitionId()).getOrCreateContainer("other").getDurability());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) Config(com.hazelcast.config.Config) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ManagedExecutorService (com.hazelcast.util.executor.ManagedExecutorService)7 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)2 ExecutionService (com.hazelcast.spi.ExecutionService)2 Config (com.hazelcast.config.Config)1 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)1 ExecutorConfig (com.hazelcast.config.ExecutorConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 ConnectionManagerDTO (com.hazelcast.internal.management.dto.ConnectionManagerDTO)1 EventServiceDTO (com.hazelcast.internal.management.dto.EventServiceDTO)1 MXBeansDTO (com.hazelcast.internal.management.dto.MXBeansDTO)1 ManagedExecutorDTO (com.hazelcast.internal.management.dto.ManagedExecutorDTO)1 OperationServiceDTO (com.hazelcast.internal.management.dto.OperationServiceDTO)1 PartitionServiceBeanDTO (com.hazelcast.internal.management.dto.PartitionServiceBeanDTO)1 ProxyServiceDTO (com.hazelcast.internal.management.dto.ProxyServiceDTO)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1 AccumulationExecutor (com.hazelcast.map.impl.query.AccumulationExecutor)1 AggregationResultProcessor (com.hazelcast.map.impl.query.AggregationResultProcessor)1 CallerRunsAccumulationExecutor (com.hazelcast.map.impl.query.CallerRunsAccumulationExecutor)1 CallerRunsPartitionScanExecutor (com.hazelcast.map.impl.query.CallerRunsPartitionScanExecutor)1 ParallelAccumulationExecutor (com.hazelcast.map.impl.query.ParallelAccumulationExecutor)1