1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.hadoop.hbase.client;
17
18 import org.apache.hadoop.hbase.util.Bytes;
19
20 import java.io.IOException;
21 import java.util.List;
22
23
24
25
26
27 public class RetriesExhaustedException extends IOException {
28 private static final long serialVersionUID = 1876775844L;
29
30 public RetriesExhaustedException(final String msg) {
31 super(msg);
32 }
33
34
35
36
37
38
39
40
41
42 public RetriesExhaustedException(String serverName, final byte [] regionName,
43 final byte [] row, int numTries, List<Throwable> exceptions) {
44 super(getMessage(serverName, regionName, row, numTries, exceptions));
45 }
46
47 private static String getMessage(String serverName, final byte [] regionName,
48 final byte [] row,
49 int numTries, List<Throwable> exceptions) {
50 StringBuilder buffer = new StringBuilder("Trying to contact region server ");
51 buffer.append(serverName);
52 buffer.append(" for region ");
53 buffer.append(regionName == null? "": Bytes.toStringBinary(regionName));
54 buffer.append(", row '");
55 buffer.append(row == null? "": Bytes.toStringBinary(row));
56 buffer.append("', but failed after ");
57 buffer.append(numTries + 1);
58 buffer.append(" attempts.\nExceptions:\n");
59 for (Throwable t : exceptions) {
60 buffer.append(t.toString());
61 buffer.append("\n");
62 }
63 return buffer.toString();
64 }
65 }