summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsblimkie <sb787e@att.com>2018-12-04 14:44:04 -0500
committersblimkie <steven.blimkie@amdocs.com>2018-12-04 14:51:15 -0500
commit9a6079fe14815e6f247268ce32b3157cf95d734b (patch)
treee3b25c25f2a98c2d4cfb9522f5128e3ab8670da7
parentd894ec51a86cfb4d711d3c053d8aa46759584456 (diff)
Fix issue with Spike using too much CPU
Even when idle, Spike was using close to 100% CPU Change-Id: I9936028e6935f54a9683cc57316c7d97205d5316 Issue-ID: AAI-1985 Signed-off-by: sblimkie <steven.blimkie@amdocs.com>
-rw-r--r--src/main/java/org/onap/aai/spike/service/SpikeEventProcessor.java2
-rw-r--r--src/test/java/org/onap/aai/spike/event/incoming/OffsetManagerTest.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/onap/aai/spike/service/SpikeEventProcessor.java b/src/main/java/org/onap/aai/spike/service/SpikeEventProcessor.java
index 88fa716..cd404b0 100644
--- a/src/main/java/org/onap/aai/spike/service/SpikeEventProcessor.java
+++ b/src/main/java/org/onap/aai/spike/service/SpikeEventProcessor.java
@@ -246,6 +246,8 @@ public class SpikeEventProcessor extends TimerTask {
|| eventQueue.size() > eventQueueCapacity)) {
event = eventQueue.take();
} else {
+ // Small pause so that we aren't burning CPU
+ Thread.sleep(200);
continue;
}
diff --git a/src/test/java/org/onap/aai/spike/event/incoming/OffsetManagerTest.java b/src/test/java/org/onap/aai/spike/event/incoming/OffsetManagerTest.java
index 22626e7..2190942 100644
--- a/src/test/java/org/onap/aai/spike/event/incoming/OffsetManagerTest.java
+++ b/src/test/java/org/onap/aai/spike/event/incoming/OffsetManagerTest.java
@@ -33,7 +33,7 @@ public class OffsetManagerTest {
@Test
public void testOffsetAdvancement() throws Exception {
- final Long offsetPeriod = 50L; // ms
+ final Long offsetPeriod = 500L; // ms
// Create an instance of the offset manager.
OffsetManager offsetManager = new OffsetManager(10, offsetPeriod);