HBASE-18473 VC.listLabels() erroneously closes any connection.
This commit is contained in:
parent
12b9a151e6
commit
d776a3caae
|
@ -259,9 +259,7 @@ public class VisibilityClient {
|
||||||
*/
|
*/
|
||||||
public static ListLabelsResponse listLabels(Connection connection, final String regex)
|
public static ListLabelsResponse listLabels(Connection connection, final String regex)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
Table table = null;
|
try (Table table = connection.getTable(LABELS_TABLE_NAME)) {
|
||||||
try {
|
|
||||||
table = connection.getTable(LABELS_TABLE_NAME);
|
|
||||||
Batch.Call<VisibilityLabelsService, ListLabelsResponse> callable =
|
Batch.Call<VisibilityLabelsService, ListLabelsResponse> callable =
|
||||||
new Batch.Call<VisibilityLabelsService, ListLabelsResponse>() {
|
new Batch.Call<VisibilityLabelsService, ListLabelsResponse>() {
|
||||||
ServerRpcController controller = new ServerRpcController();
|
ServerRpcController controller = new ServerRpcController();
|
||||||
|
@ -289,14 +287,6 @@ public class VisibilityClient {
|
||||||
return result.values().iterator().next(); // There will be exactly one region for labels
|
return result.values().iterator().next(); // There will be exactly one region for labels
|
||||||
// table and so one entry in result Map.
|
// table and so one entry in result Map.
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
if (table != null) {
|
|
||||||
table.close();
|
|
||||||
}
|
|
||||||
if (connection != null) {
|
|
||||||
connection.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue