Producer Consumer using semaphores of java