The LinkedBlockingDeque does not behave consistently with other concurrency 
components. If we call putFirst(), putLast(), takeFirst(), or takeLast() with a 
thread that is interrupted, it does not immediately throw an 
InterruptedException, the way that ArrayBlockingQueue and LInkedBlockingQueue 
does, because instead of lockInterruptibly(), we call lock(). It will only 
throw an InterruptedException if the queue is full (on put) or empty (on take). 
Since interruptions are frequently used as a shutdown mechanism, this might 
prevent code from ever shutting down.

-------------

Commit messages:
 - Added test to check that putFirst(), putLast(), takeFirst() and takeLast() 
all throw InterruptedException immediately if the thread is interrupted.
 - Used lockInterruptibly() to cause InterruptedException if thread is already 
interrupted when putXXX() and takeXXX() are called

Changes: https://git.openjdk.org/jdk/pull/23464/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23464&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8349543
  Stats: 74 lines in 2 files changed: 58 ins; 0 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/23464.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23464/head:pull/23464

PR: https://git.openjdk.org/jdk/pull/23464

Reply via email to