java BlockingQueue does not have a blocking peek?

前端 未结 8 1650
一向
一向 2020-12-15 15:37

I have a blocking queue of objects.

I want to write a thread that blocks till there is a object on the queue. Similar to the functionality provided by BlockingQueue.

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 16:37

    Could you also just add an event listener queue to your blocking queue, then when something is added to the (blocking)queue, send an event off to your listeners? You could have your thread block until it's actionPerformed method was called.

提交回复
热议问题