How to block until a BlockingQueue is empty?

前端 未结 6 2096
逝去的感伤
逝去的感伤 2021-02-02 10:30

I\'m looking for a way to block until a BlockingQueue is empty.

I know that, in a multithreaded environment, as long as there are producers putting items in

6条回答
  •  甜味超标
    2021-02-02 10:59

    According to the documentation, BlockingQueue can be blocked on "Remove" by methods: take() or poll(time, unit) instead of poll()

提交回复
热议问题