Observer design pattern in java