Tag Producer-Consumer problem in Java