/*
* ============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.
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;
static void performGcAndWait() {
final long gcCountBefore = getGcCount();
System.gc();
- while (getGcCount() == gcCountBefore) {}
+ await().until(() -> getGcCount() > gcCountBefore);
}
private static long getGcCount() {
.forEach(MemoryPoolMXBean::resetPeakUsage);
}
}
-