[Fix](Job)Concurrency may result in event loss (#29385)

This commit is contained in:
Calvin Kirs
2024-01-02 14:06:16 +08:00
committed by GitHub
parent f6443efe1a
commit eac96005b3
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ public class TaskDisruptor<T> {
WaitStrategy waitStrategy, WorkHandler<T>[] workHandlers,
EventTranslatorVararg<T> eventTranslator) {
disruptor = new Disruptor<>(eventFactory, ringBufferSize, threadFactory,
ProducerType.SINGLE, waitStrategy);
ProducerType.MULTI, waitStrategy);
disruptor.handleEventsWithWorkerPool(workHandlers);
this.eventTranslator = eventTranslator;
disruptor.start();

View File

@ -81,7 +81,7 @@ public class TaskDisruptor implements Closeable {
public void start() {
ThreadFactory producerThreadFactory = DaemonThreadFactory.INSTANCE;
disruptor = new Disruptor<>(TaskEvent.FACTORY, DEFAULT_RING_BUFFER_SIZE, producerThreadFactory,
ProducerType.SINGLE, new BlockingWaitStrategy());
ProducerType.MULTI, new BlockingWaitStrategy());
WorkHandler<TaskEvent>[] workers = new TaskHandler[consumerThreadCount];
for (int i = 0; i < consumerThreadCount; i++) {
workers[i] = new TaskHandler(transientTaskManager);