From: Robert Varga Date: Tue, 12 May 2015 23:54:29 +0000 (+0200) Subject: Introduce DOMNotificationRejectedException X-Git-Tag: release/lithium~162 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=refs%2Fchanges%2F98%2F20198%2F2 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 --- 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); + } +}