BUG 8604 set proper tag when producer creation times out 44/59844/2
authorTomas Cere <tcere@cisco.com>
Mon, 12 Jun 2017 13:20:29 +0000 (15:20 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 3 Jul 2017 11:08:17 +0000 (11:08 +0000)
Change-Id: I405f4d546a32b2d0f5b56fb03907a63334fabd6c
Signed-off-by: Tomas Cere <tcere@cisco.com>
(cherry picked from commit ec734245413c94cdd758f4c22ad3f3b63cfae5e6)

opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixLeaderHandler.java

index a444164..5ebe0a7 100644 (file)
             <Export-Package>
                 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;
index 24e0766..5644a6b 100644 (file)
@@ -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.<Void>success().build());

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.