java BlockingQueue does not have a blocking peek?
I have a blocking queue of objects. I want to write a thread that blocks till there is a object on the queue. Similar to the functionality provided by BlockingQueue.take(). However, since I do not know if I will be able to process the object successfully, I want to just peek() and not remove the object. I want to remove the object only if I am able to process it successfully. So, I would like a blocking peek() function. Currently, peek() just returns if the queue is empty as per the javadocs. Am I missing something? Is there another way to achieve this functionality? EDIT: Any thoughts on if I