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.
Can I pay via PayPal?
Yes, you can for outright purchases, but not for recurring payments such as paying by installments.
Can I get back the EU VAT?
Absolutely. First off, be sure to enter the VAT number in the appropriate field during the payment process. Then contact Teachable and ask them to reimburse you the VAT.
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 discounts on bulk licenses 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 14 days to tell us what you are unhappy about, 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!