Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit c691c5a

Browse files
committed
Update gearpumpbench to support java 1.7
1 parent aada472 commit c691c5a

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

gearpumpbench/streaming/src/main/scala/com/intel/hibench/gearpumpbench/task/SlidingWindow.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ class SlidingWindow(taskContext: TaskContext, conf: UserConfig) extends Task(tas
4141
val ip = message.msg.asInstanceOf[String]
4242
val msgTime = System.currentTimeMillis()
4343
getWindows(msgTime).foreach { window =>
44-
val countsByIp = windowCounts.getOrDefault(window, new UnifiedMap[String, (TimeStamp, Long)])
45-
val (minTime, count) = countsByIp.getOrDefault(ip, (msgTime, 0L))
44+
val countsByIp = if (windowCounts.containsKey(window)) {
45+
windowCounts.get(window)
46+
} else {
47+
new UnifiedMap[String, (TimeStamp, Long)]
48+
}
49+
val (minTime, count) = if (countsByIp.containsKey(ip)) {
50+
countsByIp.get(ip)
51+
} else {
52+
(msgTime, 0L)
53+
}
4654
countsByIp.put(ip, (Math.min(msgTime, minTime), count + 1L))
4755
windowCounts.put(window, countsByIp)
4856
}
@@ -63,7 +71,6 @@ class SlidingWindow(taskContext: TaskContext, conf: UserConfig) extends Task(tas
6371
}
6472
}
6573

66-
6774
private def getWindows(timestamp: TimeStamp): List[TimeStamp] = {
6875
val windows = ArrayBuffer.empty[TimeStamp]
6976
var start = lastStartFor(timestamp)

0 commit comments

Comments
 (0)