1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.procedure2;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.classification.InterfaceStability;
23
24
25
26
27
28
29
30 @InterfaceAudience.Private
31 @InterfaceStability.Evolving
32 public class ProcedureResult {
33 private final RemoteProcedureException exception;
34 private final long lastUpdate;
35 private final long startTime;
36 private final byte[] result;
37
38 private long clientAckTime = -1;
39
40 public ProcedureResult(final long startTime, final long lastUpdate,
41 final RemoteProcedureException exception) {
42 this.lastUpdate = lastUpdate;
43 this.startTime = startTime;
44 this.exception = exception;
45 this.result = null;
46 }
47
48 public ProcedureResult(final long startTime, final long lastUpdate, final byte[] result) {
49 this.lastUpdate = lastUpdate;
50 this.startTime = startTime;
51 this.exception = null;
52 this.result = result;
53 }
54
55 public boolean isFailed() {
56 return exception != null;
57 }
58
59 public RemoteProcedureException getException() {
60 return exception;
61 }
62
63 public boolean hasResultData() {
64 return result != null;
65 }
66
67 public byte[] getResult() {
68 return result;
69 }
70
71 public long getStartTime() {
72 return startTime;
73 }
74
75 public long getLastUpdate() {
76 return lastUpdate;
77 }
78
79 public long executionTime() {
80 return lastUpdate - startTime;
81 }
82
83 public boolean hasClientAckTime() {
84 return clientAckTime > 0;
85 }
86
87 public long getClientAckTime() {
88 return clientAckTime;
89 }
90
91 @InterfaceAudience.Private
92 protected void setClientAckTime(final long timestamp) {
93 this.clientAckTime = timestamp;
94 }
95 }