Search in sources :

Example 1 with EventDispatchThread

use of io.nuls.event.bus.processor.thread.EventDispatchThread in project nuls by nuls-io.

the class ProcessorManager method init.

public final void init() {
    pool = TaskManager.createThreadPool(EventBusConstant.THREAD_COUNT, 0, new NulsThreadFactory(NulsConstant.MODULE_ID_EVENT_BUS, EventBusConstant.THREAD_POOL_NAME));
    disruptorService.createDisruptor(disruptorName, EventBusConstant.DEFAULT_RING_BUFFER_SIZE);
    List<EventDispatchThread> handlerList = new ArrayList<>();
    for (int i = 0; i < EventBusConstant.THREAD_COUNT; i++) {
        EventDispatchThread handler = new EventDispatchThread(this);
        handlerList.add(handler);
    }
    disruptorService.handleEventsWithWorkerPool(disruptorName, handlerList.toArray(new EventDispatchThread[handlerList.size()]));
    disruptorService.start(disruptorName);
}
Also used : NulsThreadFactory(io.nuls.core.thread.manager.NulsThreadFactory) EventDispatchThread(io.nuls.event.bus.processor.thread.EventDispatchThread)

Aggregations

NulsThreadFactory (io.nuls.core.thread.manager.NulsThreadFactory)1 EventDispatchThread (io.nuls.event.bus.processor.thread.EventDispatchThread)1