Slice front-end request messages
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / messaging / MessageSliceException.java
1 /*
2  * Copyright (c) 2017 Inocybe Technologies and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.messaging;
9
10 /**
11  * An exception indicating a message slice failure.
12  *
13  * @author Thomas Pantelis
14  */
15 public class MessageSliceException extends Exception {
16     private static final long serialVersionUID = 1L;
17
18     private final boolean isRetriable;
19
20     /**
21      * Constructs an instance.
22      *
23      * @param message the detail message
24      * @param cause the cause
25      */
26     public MessageSliceException(final String message, final Throwable cause) {
27         super(message, cause);
28         isRetriable = false;
29     }
30
31     /**
32      * Constructs an instance.
33      *
34      * @param message the detail message
35      * @param isRetriable if true, indicates the original operation can be retried
36      */
37     public MessageSliceException(final String message, final boolean isRetriable) {
38         super(message);
39         this.isRetriable = isRetriable;
40     }
41
42     /**
43      * Returns whether or not the original operation can be retried.
44      *
45      * @return true if it can be retried, false otherwise
46      */
47     public boolean isRetriable() {
48         return isRetriable;
49     }
50 }