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 public RetriesExhaustedException(final String msg, final IOException e) {
35 super(msg, e);
36 }
37
38
39
40
41
42
43
44
45
46 public RetriesExhaustedException(String serverName, final byte [] regionName,
47 final byte [] row, int numTries, List<Throwable> exceptions) {
48 super(getMessage(serverName, regionName, row, numTries, exceptions));
49 }
50
51 private static String getMessage(String serverName, final byte [] regionName,
52 final byte [] row,
53 int numTries, List<Throwable> exceptions) {
54 StringBuilder buffer = new StringBuilder("Trying to contact region server ");
55 buffer.append(serverName);
56 buffer.append(" for region ");
57 buffer.append(regionName == null? "": Bytes.toStringBinary(regionName));
58 buffer.append(", row '");
59 buffer.append(row == null? "": Bytes.toStringBinary(row));
60 buffer.append("', but failed after ");
61 buffer.append(numTries + 1);
62 buffer.append(" attempts.\nExceptions:\n");
63 for (Throwable t : exceptions) {
64 buffer.append(t.toString());
65 buffer.append("\n");
66 }
67 return buffer.toString();
68 }
69 }