Multithreading | Java BlockingQueue

What is BlockingQueue? BlockingQueue is a data structure to provide Queue like capability in multithreading environment. put() offer() -> Exception #blocking Element take() poll() poll(time, unit) -> exception boolean remove(element) drain(targetCollection) drain(targetCollection, numberOfElements) Element peek() Element element() -> exception int size() int remainingCapacity() boolean contains(Element)

Feb 27, 2025 - 04:33
 0
Multithreading | Java BlockingQueue

What is BlockingQueue?

BlockingQueue is a data structure to provide Queue like capability in multithreading environment.

Image description

put()
offer() -> Exception #blocking

Element take()
poll()
poll(time, unit) -> exception
boolean remove(element)

drain(targetCollection)
drain(targetCollection, numberOfElements)

Element peek()
Element element() -> exception

int size()
int remainingCapacity()

boolean contains(Element)