BUG-5280: report history which was not found 98/48998/7
authorRobert Varga <rovarga@cisco.com>
Mon, 5 Dec 2016 17:35:54 +0000 (18:35 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 12 Dec 2016 13:13:04 +0000 (13:13 +0000)
We seem to have a lockign issue somewhere, which leads
to an exception being thrown in tests. Refactor the exception
to also include history identifier, so we can track it down.

Change-Id: I0826dfdc18f10103da58855bb14c269734ae47ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/BouncingReconnectForwarder.java

index c6564b66fbf507a9f8d9c0d778284e18853c1527..3136023204a6b0a09703ff08cfbb483d5821559f 100644 (file)
@@ -26,16 +26,20 @@ import org.slf4j.LoggerFactory;
 // Cohort aware forwarder, which forwards the request to the cohort, giving it a reference to the successor
 // connection
 final class BouncingReconnectForwarder extends ReconnectForwarder {
-    private static final Logger LOG = LoggerFactory.getLogger(BouncingReconnectForwarder.class);
-
-    private static final RequestException FAILED_TO_REPLAY_EXCEPTION = new RequestException("Cohort not found") {
+    private static final class CohortNotFoundException extends RequestException {
         private static final long serialVersionUID = 1L;
 
+        CohortNotFoundException(final LocalHistoryIdentifier historyId) {
+            super("Cohort for " + historyId + " not found");
+        }
+
         @Override
         public boolean isRetriable() {
             return false;
         }
-    };
+    }
+
+    private static final Logger LOG = LoggerFactory.getLogger(BouncingReconnectForwarder.class);
 
     private final Map<LocalHistoryIdentifier, ProxyReconnectCohort> cohorts;
 
@@ -69,7 +73,7 @@ final class BouncingReconnectForwarder extends ReconnectForwarder {
             final ProxyReconnectCohort cohort = cohorts.get(historyId);
             if (cohort == null) {
                 LOG.warn("Cohort for request {} not found, aborting it", request);
-                throw FAILED_TO_REPLAY_EXCEPTION;
+                throw new CohortNotFoundException(historyId);
             }
 
             // FIXME: do not use sendRequest() once we have throttling in place, as we have already waited the