ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [21/50] ignite git commit: IGNITE-2833: GridCacheTtlManager pending queue retention size optimization.
Date Wed, 14 Sep 2016 11:10:37 GMT
IGNITE-2833: GridCacheTtlManager pending queue retention size optimization.


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

Branch: refs/heads/ignite-3661
Commit: 355082958b476009179254df9be20e225179cb7c
Parents: 2c397d2
Author: Andrey V. Mashenkov <andrey.mashenkov@gmail.com>
Authored: Mon Sep 5 18:06:27 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Sep 5 18:06:27 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheTtlManager.java   | 24 ++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/35508295/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
index ae2895e..8ff0358 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache;
 
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -106,7 +107,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
                     break;
                 }
-            } else
+            }
+            else
                 break;
         }
     }
@@ -156,10 +158,11 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
                 if (log.isTraceEnabled())
                     log.trace("Trying to remove expired entry from cache: " + e);
 
-                GridCacheEntryEx entry = e.entry;
 
                 boolean touch = false;
 
+                GridCacheEntryEx entry = e.ctx.cache().entryEx(e.key);
+
                 while (true) {
                     try {
                         if (entry.onTtlExpired(obsoleteVer))
@@ -278,8 +281,11 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
         /** Entry expire time. */
         private final long expireTime;
 
-        /** Entry. */
-        private final GridCacheMapEntry entry;
+        /** Cache Object Context */
+        private final GridCacheContext ctx;
+
+        /** Cache Object Key */
+        private final CacheObject key;
 
         /**
          * @param entry Cache entry to create wrapper for.
@@ -289,7 +295,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
             assert expireTime != 0;
 
-            this.entry = entry;
+            this.ctx = entry.context();
+            this.key = entry.key();
         }
 
         /** {@inheritDoc} */
@@ -297,7 +304,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
             int res = Long.compare(expireTime, o.expireTime);
 
             if (res == 0)
-                res = compareKeys(entry.context(), entry.key(), o.entry.context(), o.entry.key());
+                res = compareKeys(ctx, key, o.ctx, o.key);
 
             return res;
         }
@@ -312,15 +319,14 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
             EntryWrapper that = (EntryWrapper)o;
 
-            return expireTime == that.expireTime &&
-                compareKeys(entry.context(), entry.key(), that.entry.context(), that.entry.key())
== 0;
+            return expireTime == that.expireTime && compareKeys(ctx, key, that.ctx,
that.key) == 0;
         }
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
             int res = (int)(expireTime ^ (expireTime >>> 32));
 
-            res = 31 * res + entry.key().hashCode();
+            res = 31 * res + key.hashCode();
 
             return res;
         }


Mime
View raw message