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/18 18:59:41 UTC

[GitHub] ctubbsii commented on a change in pull request #835: Close some unclosed objects causing resource leaks

ctubbsii commented on a change in pull request #835: Close some unclosed objects causing resource leaks
URL: https://github.com/apache/accumulo/pull/835#discussion_r242663736
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
 ##########
 @@ -480,121 +480,123 @@ public void initialize(InputSplit inSplit, JobConf job) throws IOException {
       baseSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) inSplit;
       log.debug("Initializing input split: " + baseSplit);
 
-      ClientContext context = new ClientContext(getClientProperties(job));
-      Authorizations authorizations = getScanAuthorizations(job);
-      String classLoaderContext = getClassLoaderContext(job);
-      String table = baseSplit.getTableName();
-
-      // in case the table name changed, we can still use the previous name for terms of
-      // configuration, but the scanner will use the table id resolved at job setup time
-      InputTableConfig tableConfig = getInputTableConfig(job, baseSplit.getTableName());
-
-      log.debug("Created client with user: " + context.whoami());
-      log.debug("Creating scanner for table: " + table);
-      log.debug("Authorizations are: " + authorizations);
-
-      if (baseSplit instanceof BatchInputSplit) {
-        BatchScanner scanner;
-        BatchInputSplit multiRangeSplit = (BatchInputSplit) baseSplit;
-
-        try {
-          // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit
-          // will not span tablets
-          int scanThreads = 1;
-          scanner = context.createBatchScanner(baseSplit.getTableName(), authorizations,
-              scanThreads);
-          setupIterators(job, scanner, baseSplit.getTableName(), baseSplit);
-          if (null != classLoaderContext) {
-            scanner.setClassLoaderContext(classLoaderContext);
+      try (ClientContext context = new ClientContext(getClientProperties(job))) {
 
 Review comment:
   No. There is no AccumuloClient object inside ClientContext anymore. ClientContext was merged with AccumuloClientImpl, so ClientContext is itself an AccumuloClient.

----------------------------------------------------------------
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