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;
19  
20  import org.apache.hadoop.hbase.HealthChecker.HealthCheckerExitStatus;
21  
22  /**
23   * The Class RegionServerHealthReport containing information about
24   * health of the region server.
25   */
26  class HealthReport {
27  
28    private HealthCheckerExitStatus status;
29    private String healthReport;
30  
31    HealthReport(HealthCheckerExitStatus status, String healthReport) {
32      super();
33      this.status = status;
34      this.healthReport = healthReport;
35    }
36  
37    /**
38     * Gets the status of the region server.
39     *
40     * @return HealthCheckerExitStatus
41     */
42    HealthCheckerExitStatus getStatus() {
43      return status;
44    }
45   
46    /**
47     * Gets the health report of the region server.
48     *
49     * @return String
50     */
51    String getHealthReport() {
52      return healthReport;
53    }
54  
55    @Override
56    public int hashCode() {
57      final int prime = 31;
58      int result = 1;
59      result = prime * result + ((healthReport == null) ? 0 : healthReport.hashCode());
60      result = prime * result + ((status == null) ? 0 : status.hashCode());
61      return result;
62    }
63  
64    @Override
65    public boolean equals(Object obj) {
66      if (this == obj) {
67        return true;
68      }
69      if (obj == null) {
70        return false;
71      }
72      if (!(obj instanceof HealthReport)) {
73        return false;
74      }
75      HealthReport other = (HealthReport) obj;
76      if (healthReport == null) {
77        if (other.healthReport != null) {
78          return false;
79        }
80      } else if (!healthReport.equals(other.healthReport)) {
81        return false;
82      }
83      if (status != other.status) {
84        return false;
85      }
86      return true;
87    }
88  
89  }