1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.client;
21
22 import java.util.concurrent.ExecutorService;
23
24 import org.apache.hadoop.hbase.TableName;
25 import org.apache.hadoop.hbase.classification.InterfaceAudience;
26 import org.apache.hadoop.hbase.classification.InterfaceStability;
27
28
29
30
31 @InterfaceAudience.Public
32 @InterfaceStability.Evolving
33 public class BufferedMutatorParams {
34
35 static final int UNSET = -1;
36
37 private final TableName tableName;
38 private long writeBufferSize = UNSET;
39 private int maxKeyValueSize = UNSET;
40 private ExecutorService pool = null;
41 private BufferedMutator.ExceptionListener listener = new BufferedMutator.ExceptionListener() {
42 @Override
43 public void onException(RetriesExhaustedWithDetailsException exception,
44 BufferedMutator bufferedMutator)
45 throws RetriesExhaustedWithDetailsException {
46 throw exception;
47 }
48 };
49
50 public BufferedMutatorParams(TableName tableName) {
51 this.tableName = tableName;
52 }
53
54 public TableName getTableName() {
55 return tableName;
56 }
57
58 public long getWriteBufferSize() {
59 return writeBufferSize;
60 }
61
62
63
64
65
66
67 public BufferedMutatorParams writeBufferSize(long writeBufferSize) {
68 this.writeBufferSize = writeBufferSize;
69 return this;
70 }
71
72 public int getMaxKeyValueSize() {
73 return maxKeyValueSize;
74 }
75
76
77
78
79
80
81 public BufferedMutatorParams maxKeyValueSize(int maxKeyValueSize) {
82 this.maxKeyValueSize = maxKeyValueSize;
83 return this;
84 }
85
86 public ExecutorService getPool() {
87 return pool;
88 }
89
90
91
92
93
94 public BufferedMutatorParams pool(ExecutorService pool) {
95 this.pool = pool;
96 return this;
97 }
98
99 public BufferedMutator.ExceptionListener getListener() {
100 return listener;
101 }
102
103
104
105
106 public BufferedMutatorParams listener(BufferedMutator.ExceptionListener listener) {
107 this.listener = listener;
108 return this;
109 }
110 }