On 7/25/2016 12:15 PM, Weijun Wang wrote: > Is it possible to use a single new CountDownLatch(2)? > Per the spec, the countDown() release all waiting threads if the count reaches zero, and the await() will not return until the latch has counted down to zero, or interrupted or timeout. It's difficult to use one instance of CountDownLatch(2) for two conditions.
> Also, I think comments on lines 145-149 and 199-203 are not really > necessary, the println() lines after them are quite clear. > The comments make the logic easier to understand, I think. Let's keep the comments if it is not a big concern of yours. Thanks, Xuelei > --Max > > On 7/25/2016 11:38, Xuelei Fan wrote: >> Hi Weijun, >> >> Please review this update. Per you suggestion, I updated to use >> CountDownLatch for the synchronization between client and server. >> CountDownLatch is more simple than ReentrantLock in the context. >> >> http://cr.openjdk.java.net/~xuelei/8161106/webrev.03/ >> >> Thanks, >> Xuelei >>