Trigger a GC once initial configuration has been pushed
[controller.git] / opendaylight / netconf / config-persister-impl / src / main / java / org / opendaylight / controller / netconf / persist / impl / osgi / ConfigPersisterActivator.java
index 87bbb50860322bcfcfc24be4b912700269757179..48ae0cb91a132d1cd7bff773df604e2d5ae1c47a 100644 (file)
@@ -159,6 +159,16 @@ public class ConfigPersisterActivator implements BundleActivator {
                         throw new IllegalStateException(e);
                     }
                     logger.info("Configuration Persister initialization completed.");
+
+                    /*
+                     * We have completed initial configuration. At this point
+                     * it is good idea to perform garbage collection to prune
+                     * any garbage we have accumulated during startup.
+                     */
+                    logger.debug("Running post-initialization garbage collection...");
+                    System.gc();
+                    logger.debug("Post-initialization garbage collection completed.");
+
                     ConfigPersisterNotificationHandler jmxNotificationHandler = new ConfigPersisterNotificationHandler(platformMBeanServer, persisterAggregator);
                     synchronized (ConfigPersisterActivator.this) {
                         autoCloseables.add(jmxNotificationHandler);
@@ -168,7 +178,7 @@ public class ConfigPersisterActivator implements BundleActivator {
             synchronized (ConfigPersisterActivator.this) {
                 autoCloseables.add(new AutoCloseable() {
                     @Override
-                    public void close() throws Exception {
+                    public void close() {
                         pushingThread.interrupt();
                     }
                 });