Merge "BUG 2593 : Fix flakiness in ShardManager ActorNotInitialized tests"
[controller.git] / opendaylight / netconf / config-persister-impl / src / main / java / org / opendaylight / controller / netconf / persist / impl / ConfigPusherImpl.java
index b06219c978558cb69c92bb353d279cb0f8c480cb..cf9958e7f8abf44303aeb18f79a77d01b62d7a9b 100644 (file)
@@ -78,17 +78,9 @@ public class ConfigPusherImpl implements ConfigPusher {
                 synchronized (autoCloseables) {
                     autoCloseables.add(jmxNotificationHandler);
                 }
-                /*
-                 * 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.
-                 */
-                LOG.debug("Running post-initialization garbage collection...");
-                System.gc();
-                LOG.debug("Post-initialization garbage collection completed.");
-                LOG.debug("ConfigPusher has pushed configs {}, gc completed", configs);
-            }
-            catch (NetconfDocumentedException e) {
+
+                LOG.debug("ConfigPusher has pushed configs {}", configs);
+            } catch (NetconfDocumentedException e) {
                 LOG.error("Error pushing configs {}",configs);
                 throw new IllegalStateException(e);
             }
@@ -123,17 +115,20 @@ public class ConfigPusherImpl implements ConfigPusher {
      */
     private synchronized EditAndCommitResponse pushConfigWithConflictingVersionRetries(ConfigSnapshotHolder configSnapshotHolder) throws NetconfDocumentedException {
         ConflictingVersionException lastException;
-        Stopwatch stopwatch = new Stopwatch().start();
+        Stopwatch stopwatch = new Stopwatch();
         do {
             String idForReporting = configSnapshotHolder.toString();
             SortedSet<String> expectedCapabilities = checkNotNull(configSnapshotHolder.getCapabilities(),
                     "Expected capabilities must not be null - %s, check %s", idForReporting,
                     configSnapshotHolder.getClass().getName());
             try (NetconfOperationService operationService = getOperationServiceWithRetries(expectedCapabilities, idForReporting)) {
+                if(!stopwatch.isRunning()) {
+                    stopwatch.start();
+                }
                 return pushConfig(configSnapshotHolder, operationService);
             } catch (ConflictingVersionException e) {
                 lastException = e;
-                LOG.debug("Conflicting version detected, will retry after timeout");
+                LOG.info("Conflicting version detected, will retry after timeout");
                 sleep();
             }
         } while (stopwatch.elapsed(TimeUnit.MILLISECONDS) < conflictingVersionTimeoutMillis);