BlockingQueue

In our overview of Java queue types, we said that perhaps the most significant type is the blocking queue. A blocking queue has the following characteristics:

These features make BlockingQueues useful for cases such as the following:

Example use of BlockingQueue

On this next page, we'll examine the facilities provided by BlockingQueue implementations. We'll work through a BlockingQueue example, using it to cosntruct a logger thread.


If you enjoy this Java programming article, please share with friends and colleagues. Follow the author on Twitter for the latest news and rants.

Editorial page content written by Neil Coffey. Copyright © Javamex UK 2021. All rights reserved.