HDFS-12380. Simplify dataQueue.wait condition logical operation in DataStreamer::run(). Contributed by liaoyuxiangqin

This commit is contained in:
Mingliang Liu 2017-08-31 23:15:07 -07:00
parent dcd0bedcc8
commit 36f33a1efb

@ -689,8 +689,7 @@ class DataStreamer extends Daemon {
long now = Time.monotonicNow(); long now = Time.monotonicNow();
while ((!shouldStop() && dataQueue.size() == 0 && while ((!shouldStop() && dataQueue.size() == 0 &&
(stage != BlockConstructionStage.DATA_STREAMING || (stage != BlockConstructionStage.DATA_STREAMING ||
stage == BlockConstructionStage.DATA_STREAMING && now - lastPacket < halfSocketTimeout)) || doSleep) {
now - lastPacket < halfSocketTimeout)) || doSleep ) {
long timeout = halfSocketTimeout - (now-lastPacket); long timeout = halfSocketTimeout - (now-lastPacket);
timeout = timeout <= 0 ? 1000 : timeout; timeout = timeout <= 0 ? 1000 : timeout;
timeout = (stage == BlockConstructionStage.DATA_STREAMING)? timeout = (stage == BlockConstructionStage.DATA_STREAMING)?