Bump to odlparent 3.1.0 and yangtools 2.0.3
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / exceptions / NoShardLeaderException.java
1 /*
2  * Copyright (c) 2014 Brocade Communications Systems, Inc. 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.datastore.exceptions;
9
10 import com.google.common.base.Strings;
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import javax.annotation.Nullable;
13
14 /**
15  * Exception indicating a shard has no current leader.
16  *
17  * @author Thomas Pantelis
18  */
19 public class NoShardLeaderException extends RuntimeException {
20     private static final long serialVersionUID = 1L;
21
22     public NoShardLeaderException(String message) {
23         super(message);
24     }
25
26     @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
27             justification = "Unrecognised NullableDecl")
28     public NoShardLeaderException(@Nullable String message, String shardName) {
29         super(String.format("%sShard %s currently has no leader. Try again later.",
30                 (Strings.isNullOrEmpty(message) ? "" : message + ". "), shardName));
31     }
32 }