Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
2) yes, the producer waits until the list is empty. But you need to wait in a loop that chacks the condition you're waiting for to guard against spurious wake ups (= being awoken when there was no notification.) see tech-read.com/2010/01/28/spurious-wakeup-in-java for a brief explanation or consult Effective Java or Java Concurrency in Practice if you have either available.
@ChristianHujer Note that I'm saying disposing is fine. Just that after closing the last frame the application does not end. There's no code in place to actually exit.
@ChristianHujer actually my output varied from 601 to 1501 nanos on a Intel Core i7-3770 CPU @ 3.40Ghz 3.40GHz on Oracle's 1.8.0_25 JVM. The b<<2 looks a little faster than b+b+b+b+a on average but not much. Both are around 1201. 4*b+a is around 3603 as I said before the edit.
As it is, the code you have can not work. There are missing semicolons, use of a non existing logger field and calling the constructor of an abstract class...