use of com.hazelcast.internal.util.executor.ManagedExecutorService in project hazelcast by hazelcast.
the class RaftSessionService method getAllSessions.
@Override
public InternalCompletableFuture<Collection<CPSession>> getAllSessions(String groupName) {
checkTrue(!METADATA_CP_GROUP_NAME.equals(groupName), "Cannot query CP sessions on the METADATA CP group!");
ManagedExecutorService executor = nodeEngine.getExecutionService().getExecutor(SYSTEM_EXECUTOR);
InternalCompletableFuture<Collection<CPSession>> future = InternalCompletableFuture.withExecutor(executor);
raftService.getCPGroup(groupName).whenCompleteAsync((group, t) -> {
if (t == null) {
if (group != null) {
getAllSessions(group.id()).whenCompleteAsync(completingCallback(future));
} else {
future.completeExceptionally(new IllegalArgumentException());
}
} else {
future.completeExceptionally(t);
}
});
return future;
}
use of com.hazelcast.internal.util.executor.ManagedExecutorService in project hazelcast by hazelcast.
the class RaftSessionService method forceCloseSession.
@Override
public InternalCompletableFuture<Boolean> forceCloseSession(String groupName, final long sessionId) {
ManagedExecutorService executor = nodeEngine.getExecutionService().getExecutor(SYSTEM_EXECUTOR);
InternalCompletableFuture<Boolean> future = InternalCompletableFuture.withExecutor(executor);
raftService.getCPGroup(groupName).whenCompleteAsync((group, t) -> {
if (t == null) {
if (group != null) {
raftService.getInvocationManager().<Boolean>invoke(group.id(), new CloseSessionOp(sessionId)).whenCompleteAsync(completingCallback(future));
} else {
future.complete(false);
}
} else {
future.completeExceptionally(t);
}
});
return future;
}
use of com.hazelcast.internal.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);
}
use of com.hazelcast.internal.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, serializationService);
}
use of com.hazelcast.internal.util.executor.ManagedExecutorService in project hazelcast by hazelcast.
the class CacheServiceTest method setup.
@Before
public void setup() {
// setup mocks
ExecutionService executionService = mock(ExecutionService.class);
ManagedExecutorService executorService = mock(ManagedExecutorService.class);
when(executionService.getExecutor(anyString())).thenReturn(executorService);
mockNodeEngine = Mockito.mock(NodeEngine.class);
when(mockNodeEngine.getLogger(any(Class.class))).thenReturn(Logger.getLogger(CacheServiceTest.class));
when(mockNodeEngine.getExecutionService()).thenReturn(executionService);
latch = new CountDownLatch(1);
}
Aggregations