ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject incubator-ignite git commit: # IGNITE-45 memory leak: GridDhtAtomicCache doesn't remove GridDisconnectListener
Date Mon, 16 Mar 2015 14:11:12 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-45 6d8f0403b -> 5b4225698


# IGNITE-45 memory leak: GridDhtAtomicCache doesn't remove GridDisconnectListener


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5b422569
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5b422569
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5b422569

Branch: refs/heads/ignite-45
Commit: 5b42256983e78f0fe16b9f50c70992e13691f2fa
Parents: 6d8f040
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Mon Mar 16 17:10:25 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Mon Mar 16 17:10:25 2015 +0300

----------------------------------------------------------------------
 .../managers/communication/GridIoManager.java        |  7 +++++++
 .../processors/cache/GridCacheIoManager.java         |  7 +++++++
 .../distributed/dht/atomic/GridDhtAtomicCache.java   | 15 ++++++++++-----
 3 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b422569/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 82bfb8d..68b3c2d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -1274,6 +1274,13 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
     }
 
     /**
+     * @param lsnr Listener to remove.
+     */
+    public void removeDisconnectListener(GridDisconnectListener lsnr) {
+        disconnectLsnrs.remove(lsnr);
+    }
+
+    /**
      * @param topic Listener's topic.
      * @param lsnr Listener to add.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b422569/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 4168033..cd96bbf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -627,6 +627,13 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter
{
     }
 
     /**
+     * @param lsnr Listener to remove.
+     */
+    public void removeDisconnectListener(GridDisconnectListener lsnr) {
+        cctx.kernalContext().io().removeDisconnectListener(lsnr);
+    }
+
+    /**
      * @param msgCls Message class to check.
      * @return Message index.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b422569/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index ec2621c..dadb3a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -89,6 +89,13 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     /** */
     private GridNearAtomicCache<K, V> near;
 
+    /** */
+    private final GridDisconnectListener disconnectLsnr = new GridDisconnectListener() {
+        @Override public void onNodeDisconnected(UUID nodeId) {
+            scheduleAtomicFutureRecheck();
+        }
+    };
+
     /**
      * Empty constructor required by {@link Externalizable}.
      */
@@ -222,17 +229,15 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             });
         }
 
-        ctx.io().addDisconnectListener(new GridDisconnectListener() {
-            @Override public void onNodeDisconnected(UUID nodeId) {
-                scheduleAtomicFutureRecheck();
-            }
-        });
+        ctx.io().addDisconnectListener(disconnectLsnr);
     }
 
     /** {@inheritDoc} */
     @Override public void stop() {
         for (DeferredResponseBuffer buf : pendingResponses.values())
             buf.finish();
+
+        ctx.io().removeDisconnectListener(disconnectLsnr);
     }
 
     /**


Mime
View raw message