Semaphors and Monitors in Java