use of reactor.core.dispatch.ThreadPoolExecutorDispatcher in project cloudbreak by hortonworks.
the class ReactorFlowManagerTest method setUp.
@Before
public void setUp() {
reset(reactor);
reset(eventFactory);
when(reactor.notify((Object) anyObject(), any(Event.class))).thenReturn(new EventBus(new ThreadPoolExecutorDispatcher(1, 1)));
Acceptable acceptable = new Acceptable() {
@Override
public Promise<Boolean> accepted() {
Promise<Boolean> a = new Promise<>();
a.accept(true);
return a;
}
@Override
public Long getStackId() {
return stackId;
}
};
Stack stack = TestUtil.stack();
stack.setCluster(TestUtil.cluster());
when(stackService.get(anyLong())).thenReturn(stack);
when(stackService.getById(anyLong())).thenReturn(TestUtil.stack());
when(stackService.getByIdView(anyLong())).thenReturn(TestUtil.stackView());
when(eventFactory.createEventWithErrHandler(anyObject())).thenReturn(new Event<>(acceptable));
}
use of reactor.core.dispatch.ThreadPoolExecutorDispatcher in project cloudbreak by hortonworks.
the class EventBusConfig method getEventBusDispatcher.
private Dispatcher getEventBusDispatcher() {
ClassLoader context = new ClassLoader(Thread.currentThread().getContextClassLoader()) {
};
MDCCleanerThreadPoolExecutor executorService = new MDCCleanerThreadPoolExecutor(eventBusThreadPoolSize, eventBusThreadPoolSize, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(eventBusThreadPoolSize), new NamedDaemonThreadFactory("reactorDispatcher", context), (r, executor) -> r.run());
return new ThreadPoolExecutorDispatcher(eventBusThreadPoolSize, eventBusThreadPoolSize, executorService);
}
Aggregations