summaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/main/java
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahoo-inc.com>2017-07-17 13:52:43 +0200
committerBjørn Christian Seime <bjorncs@yahoo-inc.com>2017-07-17 13:54:04 +0200
commit441197acb9f207afbbc67bbcb93aa95def71d000 (patch)
tree45805499270d23e20707c9fc6023770128d925f2 /jdisc_core/src/main/java
parentd977da45ba86d878f25eba4cd692af7b93cf5eb5 (diff)
Ensure that phantom references are enqueued to reference queue
Diffstat (limited to 'jdisc_core/src/main/java')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainerDeactivationWatchdog.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainerDeactivationWatchdog.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainerDeactivationWatchdog.java
index 90e2049a868..c6355c93648 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainerDeactivationWatchdog.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainerDeactivationWatchdog.java
@@ -67,7 +67,7 @@ class ActiveContainerDeactivationWatchdog implements ActiveContainerMetrics, Aut
WATCHDOG_FREQUENCY.getSeconds(),
WATCHDOG_FREQUENCY.getSeconds(),
TimeUnit.SECONDS);
- this.scheduler.scheduleAtFixedRate(System::gc,
+ this.scheduler.scheduleAtFixedRate(ActiveContainerDeactivationWatchdog::triggerGc,
GC_TRIGGER_FREQUENCY.getSeconds(),
GC_TRIGGER_FREQUENCY.getSeconds(),
TimeUnit.SECONDS);
@@ -121,6 +121,11 @@ class ActiveContainerDeactivationWatchdog implements ActiveContainerMetrics, Aut
}
}
+ private static void triggerGc() {
+ System.gc();
+ System.runFinalization(); // this is required to trigger enqueuing of phantom references on some Linux systems
+ }
+
private void enforceDestructionOfGarbageCollectedContainers() {
ActiveContainerPhantomReference reference;
while ((reference = (ActiveContainerPhantomReference) garbageCollectedContainers.poll()) != null) {