Repository: storm
Updated Branches:
  refs/heads/1.x-branch 2b0d6a1da -> e606a9be5


STORM-1872 : Release Jedis connection when topology shutdown


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

Branch: refs/heads/1.x-branch
Commit: 7a33dbe9c646853d61cbeb829e9cf3aa3bb78b43
Parents: 2b0d6a1
Author: darionyaphet <darion.yap...@gmail.com>
Authored: Wed Jun 1 00:06:04 2016 +0800
Committer: Jungtaek Lim <kabh...@gmail.com>
Committed: Fri Sep 23 10:07:56 2016 +0900

----------------------------------------------------------------------
 .../org/apache/storm/redis/bolt/AbstractRedisBolt.java    |  5 +++++
 .../redis/common/container/JedisClusterContainer.java     |  3 +--
 .../common/container/JedisCommandsInstanceContainer.java  | 10 +++++++++-
 .../storm/redis/common/container/JedisContainer.java      |  3 +--
 4 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/7a33dbe9/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java
----------------------------------------------------------------------
diff --git 
a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java
 
b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java
index 0c64f43..e569ac9 100644
--- 
a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java
+++ 
b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java
@@ -106,4 +106,9 @@ public abstract class AbstractRedisBolt extends 
BaseRichBolt {
     protected void returnInstance(JedisCommands instance) {
         this.container.returnInstance(instance);
     }
+
+    @Override
+    public void cleanup() {
+        container.close();
+    }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/7a33dbe9/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java
----------------------------------------------------------------------
diff --git 
a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java
 
b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java
index a588d1c..a432281 100644
--- 
a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java
+++ 
b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java
@@ -20,7 +20,6 @@ package org.apache.storm.redis.common.container;
 import redis.clients.jedis.JedisCluster;
 import redis.clients.jedis.JedisCommands;
 
-import java.io.Closeable;
 import java.io.IOException;
 
 /**
@@ -28,7 +27,7 @@ import java.io.IOException;
  * <p/>
  * Note that JedisCluster doesn't need to be pooled since it's thread-safe and 
it stores pools internally.
  */
-public class JedisClusterContainer implements JedisCommandsInstanceContainer, 
Closeable {
+public class JedisClusterContainer implements JedisCommandsInstanceContainer {
 
     private JedisCluster jedisCluster;
 

http://git-wip-us.apache.org/repos/asf/storm/blob/7a33dbe9/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java
----------------------------------------------------------------------
diff --git 
a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java
 
b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java
index 743d7f8..7a3e115 100644
--- 
a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java
+++ 
b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java
@@ -19,10 +19,12 @@ package org.apache.storm.redis.common.container;
 
 import redis.clients.jedis.JedisCommands;
 
+import java.io.Closeable;
+
 /**
  * Interfaces for containers which stores instances implementing JedisCommands.
  */
-public interface JedisCommandsInstanceContainer {
+public interface JedisCommandsInstanceContainer extends Closeable {
     /**
      * Borrows instance from container.
      * @return instance which implements JedisCommands
@@ -34,4 +36,10 @@ public interface JedisCommandsInstanceContainer {
      * @param jedisCommands borrowed instance
      */
     void returnInstance(JedisCommands jedisCommands);
+
+    /**
+     * Release Container
+     */
+    @Override
+    public void close();
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/7a33dbe9/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java
----------------------------------------------------------------------
diff --git 
a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java
 
b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java
index e704712..81d4732 100644
--- 
a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java
+++ 
b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java
@@ -19,7 +19,6 @@ package org.apache.storm.redis.common.container;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
 import redis.clients.jedis.JedisCommands;
 import redis.clients.jedis.JedisPool;
 
@@ -29,7 +28,7 @@ import java.io.IOException;
 /**
  * Container for managing Jedis instances.
  */
-public class JedisContainer implements JedisCommandsInstanceContainer, 
Closeable {
+public class JedisContainer implements JedisCommandsInstanceContainer {
     private static final Logger LOG = 
LoggerFactory.getLogger(JedisContainer.class);
 
     private JedisPool jedisPool;

Reply via email to