You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2016/06/09 20:53:51 UTC

[10/35] storm git commit: STORM-1771. HiveState should flushAndClose before closing old or idle Hive connections.

STORM-1771. HiveState should flushAndClose before closing old or idle Hive connections.

Signed-off-by: P. Taylor Goetz <pt...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/f5eb4790
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/f5eb4790
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/f5eb4790

Branch: refs/heads/master
Commit: f5eb4790e77ec1cda9706c68a9a728808034ffec
Parents: 02c4f6b
Author: Sriharsha Chintalapani <ha...@hortonworks.com>
Authored: Mon Jun 6 10:39:45 2016 -0700
Committer: P. Taylor Goetz <pt...@gmail.com>
Committed: Thu Jun 9 16:04:22 2016 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/storm/hive/trident/HiveState.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f5eb4790/external/storm-hive/src/main/java/org/apache/storm/hive/trident/HiveState.java
----------------------------------------------------------------------
diff --git a/external/storm-hive/src/main/java/org/apache/storm/hive/trident/HiveState.java b/external/storm-hive/src/main/java/org/apache/storm/hive/trident/HiveState.java
index 08a5953..cef1a4f 100644
--- a/external/storm-hive/src/main/java/org/apache/storm/hive/trident/HiveState.java
+++ b/external/storm-hive/src/main/java/org/apache/storm/hive/trident/HiveState.java
@@ -236,12 +236,14 @@ public class HiveState implements State {
         }
         try {
             LOG.info("Closing least used Writer to Hive end point : " + eldest);
-            allWriters.remove(eldest).close();
+            allWriters.remove(eldest).flushAndClose();
         } catch (IOException e) {
             LOG.warn("Failed to close writer for end point: " + eldest, e);
         } catch (InterruptedException e) {
             LOG.warn("Interrupted when attempting to close writer for end point: " + eldest, e);
             Thread.currentThread().interrupt();
+        } catch (Exception e) {
+            LOG.warn("Interrupted when attempting to close writer for end point: " + ep, e);
         }
     }
 
@@ -265,12 +267,14 @@ public class HiveState implements State {
         for(HiveEndPoint ep : retirees) {
             try {
                 LOG.info("Closing idle Writer to Hive end point : {}", ep);
-                allWriters.remove(ep).close();
+                allWriters.remove(ep).flushAndClose();
             } catch (IOException e) {
                 LOG.warn("Failed to close writer for end point: {}. Error: "+ ep, e);
             } catch (InterruptedException e) {
                 LOG.warn("Interrupted when attempting to close writer for end point: " + ep, e);
                 Thread.currentThread().interrupt();
+            } catch (Exception e) {
+                LOG.warn("Interrupted when attempting to close writer for end point: " + ep, e);
             }
         }
         return count;