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);
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class AbstractAddressMessageTask method execute.
@Override
public void execute(Runnable command) {
if (Thread.currentThread().getClass() == PartitionOperationThread.class) {
// instead of offloading it to another thread, we run on the partition thread. This will speed up throughput.
command.run();
} else {
ExecutionService executionService = nodeEngine.getExecutionService();
Executor executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
executor.execute(command);
}
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class AbstractPartitionMessageTask method execute.
@Override
public void execute(Runnable command) {
if (Thread.currentThread().getClass() == PartitionOperationThread.class) {
// instead of offloading it to another thread, we run on the partition thread. This will speed up throughput.
command.run();
} else {
ExecutionService executionService = nodeEngine.getExecutionService();
Executor executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
executor.execute(command);
}
}
use of com.hazelcast.spi.ExecutionService in project hazelcast by hazelcast.
the class ClientEngineImpl method newClientQueryExecutor.
private Executor newClientQueryExecutor() {
final ExecutionService executionService = nodeEngine.getExecutionService();
int coreSize = Runtime.getRuntime().availableProcessors();
int threadCount = node.getProperties().getInteger(GroupProperty.CLIENT_ENGINE_QUERY_THREAD_COUNT);
if (threadCount <= 0) {
threadCount = coreSize * QUERY_THREADS_PER_CORE;
}
logger.finest("Creating new client query executor with threadCount=" + threadCount);
return executionService.register(ExecutionService.CLIENT_QUERY_EXECUTOR, threadCount, coreSize * EXECUTOR_QUEUE_CAPACITY_PER_CORE, ExecutorType.CONCRETE);
}
Aggregations