Refactor synchronized/notify to CountdownLatch