@@ -122,13 +122,6 @@ public class OHTable implements HTableInterface {
122
122
*/
123
123
private boolean closeClientOnClose = true ;
124
124
125
- /**
126
- * If the connection this ObTable obtains is created by the ObTable itself,
127
- * should set true and close the connection when this ObTable closes;
128
- * otherwise set false
129
- */
130
- private final boolean cleanupConnectionOnClose ;
131
-
132
125
/**
133
126
* when the operationExecuteInPool is true the <code>Get</code>
134
127
* will be executed in the pool.
@@ -166,11 +159,6 @@ public class OHTable implements HTableInterface {
166
159
167
160
private int scannerTimeout ;
168
161
169
- /**
170
- * the connection to obtain bufferedMutator for Put operations
171
- */
172
- private OHConnectionImpl connection ;
173
-
174
162
/**
175
163
* the bufferedMutator to execute Puts
176
164
*/
@@ -199,8 +187,6 @@ public OHTable(Configuration configuration, String tableName) throws IOException
199
187
this .configuration = configuration ;
200
188
this .tableName = tableName .getBytes ();
201
189
this .tableNameString = tableName ;
202
- this .connection = (OHConnectionImpl ) ConnectionFactory .createConnection (configuration );
203
- this .cleanupConnectionOnClose = true ;
204
190
205
191
int maxThreads = configuration .getInt (HBASE_HTABLE_PRIVATE_THREADS_MAX ,
206
192
DEFAULT_HBASE_HTABLE_PRIVATE_THREADS_MAX );
@@ -258,8 +244,6 @@ public OHTable(Configuration configuration, final byte[] tableName,
258
244
this .configuration = configuration ;
259
245
this .tableName = tableName ;
260
246
this .tableNameString = Bytes .toString (tableName );
261
- this .connection = (OHConnectionImpl ) ConnectionFactory .createConnection (configuration );
262
- this .cleanupConnectionOnClose = true ;
263
247
this .executePool = executePool ;
264
248
this .cleanupPoolOnClose = false ;
265
249
OHConnectionConfiguration ohConnectionConf = new OHConnectionConfiguration (configuration );
@@ -296,7 +280,6 @@ public OHTable(final byte[] tableName, final ObTableClient obTableClient,
296
280
this .tableNameString = Bytes .toString (tableName );
297
281
this .cleanupPoolOnClose = false ;
298
282
this .closeClientOnClose = false ;
299
- this .cleanupConnectionOnClose = false ;
300
283
this .executePool = executePool ;
301
284
this .obTableClient = obTableClient ;
302
285
this .configuration = HBaseConfiguration .create ();
@@ -314,8 +297,6 @@ public OHTable(TableName tableName, Connection connection,
314
297
this .tableNameString = Bytes .toString (tableName .getName ());
315
298
this .configuration = connection .getConfiguration ();
316
299
this .executePool = executePool ;
317
- this .connection = (OHConnectionImpl ) connection ;
318
- this .cleanupConnectionOnClose = false ;
319
300
if (executePool == null ) {
320
301
int maxThreads = configuration .getInt (HBASE_HTABLE_PRIVATE_THREADS_MAX ,
321
302
DEFAULT_HBASE_HTABLE_PRIVATE_THREADS_MAX );
@@ -1531,11 +1512,6 @@ public void close() throws IOException {
1531
1512
if (cleanupPoolOnClose ) {
1532
1513
executePool .shutdown ();
1533
1514
}
1534
- if (cleanupConnectionOnClose ) {
1535
- if (this .connection != null ) {
1536
- this .connection .close ();
1537
- }
1538
- }
1539
1515
this .isClosed = true ;
1540
1516
}
1541
1517
@@ -2262,10 +2238,9 @@ public Pair<byte[][], byte[][]> getStartEndKeys() throws IOException {
2262
2238
2263
2239
private BufferedMutator getBufferedMutator () throws IOException {
2264
2240
if (this .mutator == null ) {
2265
- this .mutator = (OHBufferedMutatorImpl ) this .connection .getBufferedMutator (
2266
- new BufferedMutatorParams (TableName .valueOf (this .tableNameString ))
2267
- .pool (this .executePool ).writeBufferSize (this .writeBufferSize )
2268
- .maxKeyValueSize (this .maxKeyValueSize ), this );
2241
+ this .mutator = new OHBufferedMutatorImpl (this .configuration , new BufferedMutatorParams (
2242
+ TableName .valueOf (this .tableNameString )).pool (this .executePool )
2243
+ .writeBufferSize (this .writeBufferSize ).maxKeyValueSize (this .maxKeyValueSize ), this );
2269
2244
}
2270
2245
return this .mutator ;
2271
2246
}
0 commit comments