synchronized void put(Producer product) { if (toBeOrNotToBe) { try { product.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } toBeOrNotToBe = false; }