1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
23
24
25
26
27
28
29
30
31 @InterfaceAudience.Private
32 public class OperationStatus {
33
34
35 static final OperationStatus SUCCESS =
36 new OperationStatus(OperationStatusCode.SUCCESS);
37
38
39 static final OperationStatus FAILURE =
40 new OperationStatus(OperationStatusCode.FAILURE);
41
42
43 static final OperationStatus NOT_RUN =
44 new OperationStatus(OperationStatusCode.NOT_RUN);
45
46 private final OperationStatusCode code;
47
48 private final String exceptionMsg;
49
50 public OperationStatus(OperationStatusCode code) {
51 this(code, "");
52 }
53
54 public OperationStatus(OperationStatusCode code, String exceptionMsg) {
55 this.code = code;
56 this.exceptionMsg = exceptionMsg;
57 }
58
59 public OperationStatus(OperationStatusCode code, Exception e) {
60 this.code = code;
61 this.exceptionMsg = (e == null) ? "" : e.getClass().getName() + ": " + e.getMessage();
62 }
63
64
65
66
67 public OperationStatusCode getOperationStatusCode() {
68 return code;
69 }
70
71
72
73
74 public String getExceptionMsg() {
75 return exceptionMsg;
76 }
77 }