Introduce DOMNotificationRejectedException 98/20198/2
authorRobert Varga <rovarga@cisco.com>
Tue, 12 May 2015 23:54:29 +0000 (01:54 +0200)
committerRobert Varga <rovarga@cisco.com>
Tue, 12 May 2015 23:58:24 +0000 (01:58 +0200)
DOMNotificationPublishService.REJECTED wraps a throwable, which may
cause problems with code which attempts to unwind it, as frameworks tend
to propagate Throwables rather than wrapping them.

Change-Id: I77d7ceeef8213425636dab92f6994fcd3f1443e9
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationRejectedException.java [new file with mode: 0644]

index dc2ced78072e986068bbb273021d682071c49e5e..a7d2770172c0ad0063fc26a84cef84d23ae812b4 100644 (file)
@@ -29,7 +29,7 @@ public interface DOMNotificationPublishService extends DOMService, BrokerService
      * Well-known value indicating that the implementation is currently not
      * able to accept a notification.
      */
-    ListenableFuture<Object> REJECTED = Futures.immediateFailedFuture(new Throwable("Unacceptable blocking conditions encountered"));
+    ListenableFuture<Object> REJECTED = Futures.immediateFailedFuture(new DOMNotificationRejectedException("Unacceptable blocking conditions encountered"));
 
     /**
      * Publish a notification. The result of this method is a {@link ListenableFuture}
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationRejectedException.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationRejectedException.java
new file mode 100644 (file)
index 0000000..4d0aa66
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.sal.dom.api;
+
+/**
+ * <p>
+ * This exception indicates that given notification can not be processed by corresponding mechanism.
+ * More info can be provided in message.
+ * <p/>
+ * <p>
+ * Expected use: {@link DOMNotificationPublishService}
+ * </p>
+ */
+public class DOMNotificationRejectedException extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    public DOMNotificationRejectedException(final String message) {
+        super(message);
+    }
+
+    public DOMNotificationRejectedException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}