From 12bf820406245feb0285317a88e5c7b3c9829ce6 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 13 May 2015 01:54:29 +0200 Subject: [PATCH] Introduce DOMNotificationRejectedException 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 --- .../api/DOMNotificationPublishService.java | 2 +- .../api/DOMNotificationRejectedException.java | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationRejectedException.java diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java index dc2ced7807..a7d2770172 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java @@ -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 REJECTED = Futures.immediateFailedFuture(new Throwable("Unacceptable blocking conditions encountered")); + ListenableFuture 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 index 0000000000..4d0aa665ea --- /dev/null +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationRejectedException.java @@ -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; + +/** + *

+ * This exception indicates that given notification can not be processed by corresponding mechanism. + * More info can be provided in message. + *

+ *

+ * Expected use: {@link DOMNotificationPublishService} + *

+ */ +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); + } +} -- 2.36.6