You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2018/12/28 15:21:41 UTC

[GitHub] keith-turner commented on a change in pull request #48: Api updates for 2.0

keith-turner commented on a change in pull request #48: Api updates for 2.0
URL: https://github.com/apache/accumulo-testing/pull/48#discussion_r244342808
 
 

 ##########
 File path: src/main/java/org/apache/accumulo/testing/merkle/cli/GenerateHashes.java
 ##########
 @@ -151,82 +129,78 @@ public void setSplitsFile(String splitsFile) {
 
   public void run(GenerateHashesOpts opts) throws TableNotFoundException, AccumuloSecurityException, AccumuloException, NoSuchAlgorithmException,
       FileNotFoundException {
-    Collection<Range> ranges = getRanges(opts.getClient(), opts.getTableName(), opts.getSplitsFile());
-
-    run(opts.getClient(), opts.getTableName(), opts.getOutputTableName(), opts.getHashName(), opts.getNumThreads(), opts.isIteratorPushdown(), ranges);
+    try (AccumuloClient client = opts.createClient()) {
+      Collection<Range> ranges = getRanges(client, opts.getTableName(), opts.getSplitsFile());
+      run(client, opts.getTableName(), opts.getOutputTableName(), opts.getHashName(), opts.getNumThreads(), opts.isIteratorPushdown(), ranges);
+    }
   }
 
   public void run(final AccumuloClient client, final String inputTableName, final String outputTableName, final String digestName, int numThreads,
-      final boolean iteratorPushdown, final Collection<Range> ranges) throws TableNotFoundException, AccumuloSecurityException, AccumuloException,
+      final boolean iteratorPushdown, final Collection<Range> ranges) throws TableNotFoundException, AccumuloException,
       NoSuchAlgorithmException {
     if (!client.tableOperations().exists(outputTableName)) {
       throw new IllegalArgumentException(outputTableName + " does not exist, please create it");
     }
 
     // Get some parallelism
     ExecutorService svc = Executors.newFixedThreadPool(numThreads);
-    final BatchWriter bw = client.createBatchWriter(outputTableName, new BatchWriterConfig());
 
-    try {
+    try (BatchWriter bw = client.createBatchWriter(outputTableName, new BatchWriterConfig())) {
 
 Review comment:
   Could this be `try (BatchWriter bw = client.createBatchWriter(outputTableName)) {`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services