Reputation: 193
I have a problem with BlockingQueue
.
It is working for me when I use it as the queue. However, sometimes I would like to return several tasks to the queue to the head.
I assume BlockingQueue
is not able to do that operation.
Is any other structure is able to do that and is ThreadSafe? I would like to avoid Collections.synchronizedList()
but I do not have any idea how to implement such problem with java.utils.concurrent
possibilities?
Any hints which structure is able to support such a problem in multi-threaded environment, please?
Upvotes: 0
Views: 342
Reputation: 5246
Are you looking for a BlockingDeque? addLast
doesn't block and adds to tail and putLast
blocks and adds to tail.
Upvotes: 3