aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java b/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java
index f8a2ecb4df..46bfcf69e6 100644
--- a/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java
+++ b/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@
package org.onap.cps.integration;
+import static org.awaitility.Awaitility.await;
+
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
@@ -71,7 +73,7 @@ public class ResourceMeter {
static void performGcAndWait() {
final long gcCountBefore = getGcCount();
System.gc();
- while (getGcCount() == gcCountBefore) {}
+ await().until(() -> getGcCount() > gcCountBefore);
}
private static long getGcCount() {
@@ -94,4 +96,3 @@ public class ResourceMeter {
.forEach(MemoryPoolMXBean::resetPeakUsage);
}
}
-