You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2019/06/12 13:11:49 UTC

[GitHub] [hive] ShubhamChaurasia commented on a change in pull request #669: HIVE-21864: LlapBaseInputFormat#closeAll() throws ConcurrentModificationException

ShubhamChaurasia commented on a change in pull request #669: HIVE-21864: LlapBaseInputFormat#closeAll() throws ConcurrentModificationException
URL: https://github.com/apache/hive/pull/669#discussion_r292904914
 
 

 ##########
 File path: llap-ext-client/src/java/org/apache/hadoop/hive/llap/LlapBaseInputFormat.java
 ##########
 @@ -345,8 +346,11 @@ public static void close(String handleId) throws IOException {
    */
   public static void closeAll() {
     LOG.debug("Closing all handles");
-    for (String handleId : connectionMap.keySet()) {
+    Iterator<String> handleIds = connectionMap.keySet().iterator();
+    String handleId = null;
+    while (handleIds.hasNext()) {
       try {
+        handleId = handleIds.next();
 
 Review comment:
   Thanks Ashutosh, good catch. 
   I just realized, even without doing all these changes we can avoid it by just changing the original code `for (String handleId : connectionMap.keySet())` 
   to `for (String handleId : new ArrayList<>(connectionMap.keySet()))`
   
   Looks good?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org