Class PluginClassLoaderLeakSentinel
PluginTeardown.teardown(com.xebialabs.xlrelease.osgi.impl.PluginRuntime) completes, watches whether a plugin's classloader actually
becomes collectible within a bounded delay, and logs at ERROR - with the plugin's
symbolic name and install/teardown timestamps - only once it is sure. Never throws,
never affects any other plugin or host behavior.
GC policy: the initial DEFAULT_CHECK_DELAY wait is a courtesy - long
enough that a JVM under normal load has almost certainly already run a GC cycle naturally, so
the common case needs no forced collection at all. Only if the classloader is still not
collectible at that point does this class force the issue: a bounded number of
System.gc() calls, spaced out, specifically to rule out the case that mislead earlier versions
of this check - a JVM tuned with a large max heap feels no memory pressure and can go a long time
without an old-generation-inclusive collection, even though the classloader was never actually
unreachable-but-uncollected forever, just not yet swept. Forcing GC only after first detecting
non-collectibility (never unconditionally, never on the happy path) keeps this a rare,
teardown-triggered cost rather than a standing tax on the host.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidwatch(PluginRuntime runtime) Starts watchingruntime's classloader for collection.
-
Constructor Details
-
PluginClassLoaderLeakSentinel
public PluginClassLoaderLeakSentinel()
-
-
Method Details
-
watch
Starts watchingruntime's classloader for collection. Call once, afterPluginTeardown.teardown(com.xebialabs.xlrelease.osgi.impl.PluginRuntime)has released every reference the host itself holds.
-