2

试图理解下面的(部分)堆栈跟踪。使用spring的项目reactor 2.0.4。

我得到了应该为工作线程创建任务和分配任务的任务调度程序线程。此时应用程序挂起(工作线程不记录任何内容,在不同时间进行的线程转储始终相同等)。

我可以根据以下行声明环形缓冲区已满:at reactor.jarjar.com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:136)

如果环形缓冲区已满,为什么我的工作线程没有执行任何这些任务?环形缓冲区状态会损坏吗?

    "task-scheduler-9" prio=10 tid=0x00007f2e78aa7000 nid=0x3a7a waiting on condition [0x00007f2e651b6000]
   java.lang.Thread.State: TIMED_WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:349)
        at reactor.jarjar.com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:136)
        at reactor.jarjar.com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:105)
        at reactor.jarjar.com.lmax.disruptor.RingBuffer.next(RingBuffer.java:246)
        at reactor.core.dispatch.WorkQueueDispatcher.allocateTask(WorkQueueDispatcher.java:172)
        at reactor.core.dispatch.AbstractLifecycleDispatcher.dispatch(AbstractLifecycleDispatcher.java:117)
        at reactor.core.dispatch.AbstractLifecycleDispatcher.execute(AbstractLifecycleDispatcher.java:133)
        at reactor.spring.core.task.AbstractAsyncTaskExecutor.execute(AbstractAsyncTaskExecutor.java:293)
        at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:324)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)


"pollerExecutor-19" daemon prio=10 tid=0x00007f2e78ba2000 nid=0x3a6f waiting on condition [0x00007f2e65bc0000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000007016bd818> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
        at reactor.jarjar.com.lmax.disruptor.BlockingWaitStrategy.waitFor(BlockingWaitStrategy.java:45)
        at reactor.jarjar.com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)
        at reactor.jarjar.com.lmax.disruptor.WorkProcessor.run(WorkProcessor.java:143)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)

   Locked ownable synchronizers:
        - <0x00000007011e7058> (a java.util.concurrent.ThreadPoolExecutor$Worker)
4

1 回答 1

2

如果您查看 MultiProducerSequencer.java # 136,我们会看到环形缓冲区包装点 > 门控序列。Disruptor:Gating Sequence说这完全是关于发布者覆盖尚未处理的事件。正如您所说,为什么我的工作线程没有执行任何这些任务?我认为您需要查看onEvent实现您的代码的代码EventHandler<T>

于 2016-03-03T10:33:28.473 回答