LinkedBlockingQueue thowing InterruptedException

前端 未结 1 1961
情深已故
情深已故 2021-01-28 16:20

I have this piece of code. A LinkedBlockingQueue should only throw an Exception if interrupted while waiting to add to the queue. But this queue is unb

1条回答
  •  一生所求
    2021-01-28 16:56

    If the thread is in a state of interruption, that is Thread.interrupted() == true, then the call will throw an InterruptionException. It doesn't necessarily mean that the thread was interrupted while you were putting, it could have already been in the state before entering.

    0 讨论(0)
提交回复
热议问题