I need to have a thread-safe LIFO structure and found that I can use thread-safe implementations of Deque
for this. Java 7 has introduced ConcurrentLinkedDeque and
First thing both LinkedBlockingDeque and ConcurrentLinkedDeque both are thread safe but which one to use depends on your application requirement.
For example,
LinkedBlockingDequeue : Use this collection if you want that at a time only single thread can operate on your data and when you need blocking for your application.
ConcurrentLinkedDeque: This is also thread safe collection deque, If you application is multi threaded and you want that each one of your thread can access the data then ConcurrentLinkedDequeue is the best choise for it.
As in your question,
1. I need to have a thread-safe LIFO structure,
Use LinkedBlockingDeque if at a time you want only single thread can operate your data.
Use ConcurrentLinkedDeque if you want that each thread can access the shared data
2. If you disregard the blocking aspect, is there any other difference between ConcurrentLinkedDeque and LinkedBlockingDeque,
Yes, there is a difference as LinkedBlockingDeque is using locking mechanism and ConcurrentLinkedDeque is not this may affect the performance when you want to operate your data.