Revert "HBASE-14361 Investigate unused connection objects"
This reverts commit 6c16d244bb
.
This commit is contained in:
parent
6c16d244bb
commit
66ed392412
|
@ -72,7 +72,7 @@ public class ReplicationSink {
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(ReplicationSink.class);
|
private static final Log LOG = LogFactory.getLog(ReplicationSink.class);
|
||||||
private final Configuration conf;
|
private final Configuration conf;
|
||||||
private Connection sharedHtableCon;
|
private final Connection sharedHtableCon;
|
||||||
private final MetricsSink metrics;
|
private final MetricsSink metrics;
|
||||||
private final AtomicLong totalReplicatedEdits = new AtomicLong();
|
private final AtomicLong totalReplicatedEdits = new AtomicLong();
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ public class ReplicationSink {
|
||||||
this.conf = HBaseConfiguration.create(conf);
|
this.conf = HBaseConfiguration.create(conf);
|
||||||
decorateConf();
|
decorateConf();
|
||||||
this.metrics = new MetricsSink();
|
this.metrics = new MetricsSink();
|
||||||
|
this.sharedHtableCon = ConnectionFactory.createConnection(this.conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,9 +213,7 @@ public class ReplicationSink {
|
||||||
*/
|
*/
|
||||||
public void stopReplicationSinkServices() {
|
public void stopReplicationSinkServices() {
|
||||||
try {
|
try {
|
||||||
if (this.sharedHtableCon != null) {
|
|
||||||
this.sharedHtableCon.close();
|
this.sharedHtableCon.close();
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.warn("IOException while closing the connection", e); // ignoring as we are closing.
|
LOG.warn("IOException while closing the connection", e); // ignoring as we are closing.
|
||||||
}
|
}
|
||||||
|
@ -233,9 +232,6 @@ public class ReplicationSink {
|
||||||
}
|
}
|
||||||
Table table = null;
|
Table table = null;
|
||||||
try {
|
try {
|
||||||
if (this.sharedHtableCon == null) {
|
|
||||||
this.sharedHtableCon = ConnectionFactory.createConnection(this.conf);
|
|
||||||
}
|
|
||||||
table = this.sharedHtableCon.getTable(tableName);
|
table = this.sharedHtableCon.getTable(tableName);
|
||||||
for (List<Row> rows : allRows) {
|
for (List<Row> rows : allRows) {
|
||||||
table.batch(rows);
|
table.batch(rows);
|
||||||
|
|
Loading…
Reference in New Issue