View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.snapshot;
19  
20  import org.apache.hadoop.hbase.DoNotRetryIOException;
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.classification.InterfaceStability;
23  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
24  
25  /**
26   * General exception base class for when a snapshot fails.
27   */
28  @SuppressWarnings("serial")
29  @InterfaceAudience.Public
30  @InterfaceStability.Evolving
31  public class HBaseSnapshotException extends DoNotRetryIOException {
32    private SnapshotDescription description;
33  
34    /**
35     * Some exception happened for a snapshot and don't even know the snapshot that it was about.
36     *
37     * @param message the full description of the failure
38     */
39    public HBaseSnapshotException(String message) {
40      super(message);
41    }
42  
43    /**
44     * Exception for the given snapshot that has no previous root cause.
45     *
46     * @param message the reason why the snapshot failed
47     * @param snapshotDescription the description of the snapshot that is failing
48     * @deprecated since 1.3.0, will be removed in 3.0.0
49     */
50    @Deprecated
51    public HBaseSnapshotException(String message, SnapshotDescription snapshotDescription) {
52      super(message);
53      this.description = snapshotDescription;
54    }
55  
56    /**
57     * Exception for the given snapshot due to another exception.
58     *
59     * @param message the reason why the snapshot failed
60     * @param cause the root cause of the failure
61     * @param snapshotDescription the description of the snapshot that is being failed
62     * @deprecated since 1.3.0, will be removed in 3.0.0
63     */
64    @Deprecated
65    public HBaseSnapshotException(String message, Throwable cause,
66        SnapshotDescription snapshotDescription) {
67      super(message, cause);
68      this.description = snapshotDescription;
69    }
70  
71    /**
72     * Exception when the description of the snapshot cannot be determined, due to some root other
73     * root cause.
74     *
75     * @param message description of what caused the failure
76     * @param e the root cause
77     */
78    public HBaseSnapshotException(String message, Exception e) {
79      super(message, e);
80    }
81  
82    /**
83     * @return the description of the snapshot that is being failed
84     * @deprecated since 1.3.0, will be removed in 3.0.0
85     */
86    @Deprecated
87    public SnapshotDescription getSnapshotDescription() {
88      return this.description;
89    }
90  }