use CountDownLatch to block main thread