ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [13/26] ignite git commit: Quick fix for NPE in PageMemoryImpl.loadedPages
Date Wed, 28 Jun 2017 06:10:33 GMT
Quick fix for NPE in PageMemoryImpl.loadedPages


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: f2a5a93f0748f905ede77ff84787947a0893c3f8
Parents: fd09d30
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Jun 27 13:43:13 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Jun 27 13:43:13 2017 +0300

----------------------------------------------------------------------
 .../persistence/pagemem/PageMemoryImpl.java     | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f2a5a93f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index fb9bd3e..6bb5c33 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -1014,14 +1014,21 @@ public class PageMemoryImpl implements PageMemoryEx {
     @Override public long loadedPages() {
         long total = 0;
 
-        for (Segment seg : segments) {
-            seg.readLock().lock();
+        Segment[] segments = this.segments;
 
-            try {
-                total += seg.loadedPages.size();
-            }
-            finally {
-                seg.readLock().unlock();
+        if (segments != null) {
+            for (Segment seg : segments) {
+                if (seg == null)
+                    break;
+
+                seg.readLock().lock();
+
+                try {
+                    total += seg.loadedPages.size();
+                }
+                finally {
+                    seg.readLock().unlock();
+                }
             }
         }
 


Mime
View raw message