jojochuang commented on a change in pull request #2592:
URL: https://github.com/apache/hbase/pull/2592#discussion_r513153293
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java
##########
@@ -67,24 +67,14 @@ protected void processOptions(CommandLine cmd) {
@Override
protected int doWork() throws Exception {
- Connection connection = null;
- Admin admin = null;
- try {
- connection = ConnectionFactory.createConnection(getConf());
- admin = connection.getAdmin();
+ try (Connection connection =
ConnectionFactory.createConnection(getConf())) {
Review comment:
A syntax sugar, but you can do try with multiple resources
`
try (Connection connection = ConnectionFactory.createConnection(getConf());
Admin admin = connection.getAdmin()) {
}
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]