aboutsummaryrefslogtreecommitdiff
path: root/streaming
diff options
context:
space:
mode:
Diffstat (limited to 'streaming')
-rw-r--r--streaming/src/main/scala/org/apache/spark/streaming/util/Clock.scala15
1 files changed, 2 insertions, 13 deletions
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/util/Clock.scala b/streaming/src/main/scala/org/apache/spark/streaming/util/Clock.scala
index 39145a3ab0..7cd867ce34 100644
--- a/streaming/src/main/scala/org/apache/spark/streaming/util/Clock.scala
+++ b/streaming/src/main/scala/org/apache/spark/streaming/util/Clock.scala
@@ -41,13 +41,7 @@ class SystemClock() extends Clock {
return currentTime
}
- val pollTime = {
- if (waitTime / 10.0 > minPollTime) {
- (waitTime / 10.0).toLong
- } else {
- minPollTime
- }
- }
+ val pollTime = math.max(waitTime / 10.0, minPollTime).toLong
while (true) {
currentTime = System.currentTimeMillis()
@@ -55,12 +49,7 @@ class SystemClock() extends Clock {
if (waitTime <= 0) {
return currentTime
}
- val sleepTime =
- if (waitTime < pollTime) {
- waitTime
- } else {
- pollTime
- }
+ val sleepTime = math.min(waitTime, pollTime)
Thread.sleep(sleepTime)
}
-1