BlockingQueue
BlockingQueue is an interface in the java.util.concurrent package that represents a queue which supports blocking operations. It extends the standard Queue interface and provides methods that wait for the queue to become non-empty when retrieving and for space to become available when storing. This behavior is useful for coordinating producer and consumer threads without explicit locking.
BlockingQueue supports both indefinite and time-bounded blocking. For example, put inserts an element and blocks if
Key methods include put(E e), take(), poll(), offer(E e), offer(E e, long timeout, TimeUnit unit), poll(long timeout,
Common implementations include ArrayBlockingQueue (bounded with fixed capacity), LinkedBlockingQueue (bounded or unbounded depending on construction), PriorityBlockingQueue