X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatabroker%2Factors%2Fdds%2FBouncingReconnectForwarder.java;h=26e346e77cb4e0a0a19b6c66b5f5903d141a4803;hb=db3d7caeeb310f76a9a159f9a8d7e9beff89f645;hp=f2734ae15debb7b402f78135f7333bad6dc8bd39;hpb=6c1d222b2f87af18e2488870b6708f91d5f6c6f8;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/BouncingReconnectForwarder.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/BouncingReconnectForwarder.java index f2734ae15d..26e346e77c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/BouncingReconnectForwarder.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/BouncingReconnectForwarder.java @@ -55,9 +55,25 @@ final class BouncingReconnectForwarder extends ReconnectForwarder { HistoryReconnectCohort::getProxy), ProxyReconnectCohort::getIdentifier)); } - @Override protected void forwardEntry(final ConnectionEntry entry, final long now) { + try { + findCohort(entry).forwardEntry(entry, this::sendToSuccessor); + } catch (RequestException e) { + entry.complete(entry.getRequest().toRequestFailure(e)); + } + } + + @Override + protected void replayEntry(final ConnectionEntry entry, final long now) { + try { + findCohort(entry).replayEntry(entry, this::replayToSuccessor); + } catch (RequestException e) { + entry.complete(entry.getRequest().toRequestFailure(e)); + } + } + + private ProxyReconnectCohort findCohort(final ConnectionEntry entry) throws CohortNotFoundException { final Request request = entry.getRequest(); final LocalHistoryIdentifier historyId; @@ -69,18 +85,12 @@ final class BouncingReconnectForwarder extends ReconnectForwarder { throw new IllegalArgumentException("Unhandled request " + request); } - try { - final ProxyReconnectCohort cohort = cohorts.get(historyId); - if (cohort == null) { - LOG.warn("Cohort for request {} not found, aborting it", request); - throw new CohortNotFoundException(historyId); - } - - // FIXME: do not use sendRequest() once we have throttling in place, as we have already waited the - // period required to get into the queue. - cohort.forwardRequest(request, entry.getCallback(), this::sendToSuccessor); - } catch (RequestException e) { - entry.complete(request.toRequestFailure(e)); + final ProxyReconnectCohort cohort = cohorts.get(historyId); + if (cohort == null) { + LOG.warn("Cohort for request {} not found, aborting it", request); + throw new CohortNotFoundException(historyId); } + + return cohort; } -} \ No newline at end of file +}