Teardown 01 - ArrayBlockingQueue

Learn to code like a pro by studying how pros code

"Rather use java.util.concurrent than write your own"

Who has not heard this sage advice?

Of course we agree, and follow this advice ourselves. But what if the constructs in java.util.concurrent differ from what we need? Can we write our own? And what can we learn from studying how the java.util.concurrent classes work?

In our Teardown series we study the classes in java.util.concurrent line-by-line. We analyze every for-loop and if statement, asking why the authors wrote it this way. We dissect the concurrency controls, looking at how the authors apply it to the construct.

The first construct we chose to study is the ArrayBlockingQueue. The concurrency controls of this class are one of the easiest to understand. ArrayBlockingQueue has one ReentrantLock with two Conditions notEmpty and notFull. Unfortunately the weakly consistent iterators are somewhat complex. Furthermore, the authors overcomplicated their work by not keeping one space free, like we see in ArrayDeque. This means that when takeIndex==putIndex, the queue is either full or empty.

This mini-course consists of almost 4 hours of detailed instruction of how ArrayBlockingQueue works. Watch it either from start to finish, or jump around between sections as your curiosity is piqued. You will definitely learn something - or your money back!

Your Instructor


Dr Heinz M. Kabutz
Dr Heinz M. Kabutz

Heinz Kabutz is the author of The Java Specialists’ Newsletter, a publication enjoyed by tens of thousands of Java experts in over 150 countries. He has been a Java Champion since 2005.


Course Curriculum


  ArrayBlockingQueue
Available in days
days after you enroll

Frequently Asked Questions


How long do I have access to a fully paid course?
How does lifetime access sound? After enrolling, you have unlimited access to this course for as long as you like - across any and all devices you own. Furthermore, if we move to another platform, we will offer you a free transfer of your account for all the courses that you have purchased.
How many times can I cancel and rejoin a subscription course?
To prevent abuse, we limit the number of times that you can cancel and rejoin our subscription based courses to three times.
What is the difference between a subscription, paying in installments and an outright purchase?
With a subscription, you never own the rights to the material. If your card is declined or you cancel your subscription, you lose access to the course. The money you have paid so far is lost. Paying in installments is a bit better. You pay for 5 or 10 months and then once you have completed your installments you have lifetime access to the course. The safest is an outright purchase, where you pay the entire course in one amount. There is no risk of losing access.
Can I pay via PayPal?
Yes, you can for outright purchases, but not for recurring payments such as paying by installments or subscriptions.
Can I get an EU VAT Invoice?
Absolutely. First off, be sure to enter the VAT number in the appropriate field during the payment process. Then contact us for an EU VAT Invoice. Please tell us the receipt number for which you need the invoice.
May I share my login details with my colleagues?
Unfortunately not. The terms of usage are for a single license. Teachable tracks your progress through the curriculum, so you won't know how much you have watched. We offer a 30% discount on 50 licenses or more by one company. Please contact us for bulk licensing.
May we use the course for running in-house courses?
You may, as long as each of the students in the class has a valid license for that course. For example, some companies run lunch time Design Patterns study groups using our material. This is an effective way to learn. Please contact us for bulk licensing.
What if I am unhappy with the course?
We would never want you to be unhappy! If you are unsatisfied with your purchase, contact us in the first 30 days and we will give you a full refund and deregister you from the course.
When does the course start and finish?
The course starts now and never ends! It is a completely self-paced online course - you decide when you start and when you finish. We do recommend putting time aside and setting goals to complete the course.
Can I watch the course offline during my commute?
Teachable have an iOS app that lets you watch offline. Android is not supported unfortunately.

Get started now!