There exists many queue implementations in Java like LinkedList, BlockingQueues. Are all of them thread-safe? If your answer no, which implementations support concurrent access and which gives the best performance?
Note: I'm using JDK 1.6.
Most standard collections are not thread safe. You find this information when reading the API documention.
For example the documentation of LinkedList:
If multiple threads access a linked list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally
For collections that are accessed from multiple threads you should look at the java.util.concurrent package
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With