X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fosgi%2FBlankTransactionServiceTracker.java;h=720b7197ea6100b0890ee0fd4a89d5f5de9157bd;hp=b973b9272104e22091153cb2721eab891c4b5107;hb=7d9b07a6cf8171e97eb5ce6ed4ccdcfadff8e741;hpb=2e92a15f60261432cde594d86f033802f7410e17 diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BlankTransactionServiceTracker.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BlankTransactionServiceTracker.java index b973b92721..720b7197ea 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BlankTransactionServiceTracker.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BlankTransactionServiceTracker.java @@ -8,6 +8,7 @@ package org.opendaylight.controller.config.manager.impl.osgi; import org.opendaylight.controller.config.api.ConflictingVersionException; +import org.opendaylight.controller.config.api.ValidationException; import org.opendaylight.controller.config.api.jmx.CommitStatus; import org.opendaylight.controller.config.manager.impl.ConfigRegistryImpl; import org.opendaylight.controller.config.spi.ModuleFactory; @@ -41,7 +42,8 @@ public class BlankTransactionServiceTracker implements ServiceTrackerCustomizer< synchronized void blankTransaction() { // race condition check: config-persister might push new configuration while server is starting up. ConflictingVersionException lastException = null; - for (int i = 0; i < 10; i++) { + int maxAttempts = 10; + for (int i = 0; i < maxAttempts; i++) { try { // create transaction boolean blankTransaction = true; @@ -57,9 +59,13 @@ public class BlankTransactionServiceTracker implements ServiceTrackerCustomizer< Thread.currentThread().interrupt(); throw new IllegalStateException(interruptedException); } + } catch (ValidationException e) { + logger.error("Validation exception while running blank transaction indicates programming error", e); + throw new RuntimeException("Validation exception while running blank transaction indicates programming error", e); } } - throw lastException; + throw new RuntimeException("Maximal number of attempts reached and still cannot get optimistic lock from " + + "config manager",lastException); } @Override