From: Tomas Cere Date: Mon, 12 Jun 2017 13:20:29 +0000 (+0200) Subject: BUG 8604 set proper tag when producer creation times out X-Git-Tag: release/nitrogen~73 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=915867f38e525e6e0735523f28523f5e13ee1cd7 BUG 8604 set proper tag when producer creation times out Change-Id: I405f4d546a32b2d0f5b56fb03907a63334fabd6c Signed-off-by: Tomas Cere (cherry picked from commit ec734245413c94cdd758f4c22ad3f3b63cfae5e6) --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index a444164274..5ebe0a7f32 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -235,6 +235,7 @@ org.opendaylight.controller.cluster.datastore; org.opendaylight.controller.cluster.datastore.config; + org.opendaylight.controller.cluster.datastore.exceptions; org.opendaylight.controller.cluster.datastore.messages; org.opendaylight.controller.cluster.datastore.persisted; org.opendaylight.controller.cluster.datastore.utils; diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixLeaderHandler.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixLeaderHandler.java index 24e076621f..5644a6bfc4 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixLeaderHandler.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixLeaderHandler.java @@ -12,6 +12,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.util.Collections; import java.util.concurrent.CompletionStage; +import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException; import org.opendaylight.controller.cluster.dom.api.CDSDataTreeProducer; import org.opendaylight.controller.cluster.dom.api.CDSShardAccess; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; @@ -20,6 +21,7 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException; import org.opendaylight.mdsal.dom.api.DOMDataTreeService; import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.BecomePrefixLeaderInput; +import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -57,6 +59,11 @@ public class PrefixLeaderHandler { }); } catch (final DOMDataTreeProducerException e) { LOG.warn("Error while closing producer", e); + } catch (final TimeoutException e) { + LOG.warn("Timeout while on producer operation", e); + Futures.immediateFuture(RpcResultBuilder.failed().withError(RpcError.ErrorType.RPC, + "resource-denied-transport", "Timeout while opening producer please retry.", "clustering-it", + "clustering-it", e)); } return Futures.immediateFuture(RpcResultBuilder.success().build());