ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [35/50] [abbrv] incubator-ignite git commit: # Refactoring: introduced ocmmon method to calculate pre-expired expire time.
Date Fri, 20 Feb 2015 02:50:33 GMT
# Refactoring: introduced ocmmon method to calculate pre-expired expire time.


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

Branch: refs/heads/ignite-281
Commit: bc6553b2c14d57c4f3e2e26282b51b3ef3389af8
Parents: 47fa3ce
Author: vozerov <vozerov@gridgain.com>
Authored: Thu Feb 19 15:03:59 2015 +0300
Committer: vozerov <vozerov@gridgain.com>
Committed: Thu Feb 19 15:03:59 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheMapEntry.java    | 12 ++++++------
 .../internal/processors/cache/GridCacheUtils.java       |  7 +++++++
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc6553b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index a36f546..578b095 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -1327,15 +1327,15 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 (cctx.readThrough() && (op == GridCacheOperation.TRANSFORM || cctx.loadPreviousValue())))
{
                 old = readThrough(null, key, false, subjId, taskName);
 
-                long ttl = 0;
-                long expireTime = 0;
+                long ttl = CU.TTL_ETERNAL;
+                long expireTime = CU.EXPIRE_TIME_ETERNAL;
 
                 if (expiryPlc != null && old != null) {
                     ttl = CU.toTtl(expiryPlc.getExpiryForCreation());
 
                     if (ttl == CU.TTL_ZERO) {
-                        ttl = 1;
-                        expireTime = U.currentTimeMillis() - 1;
+                        ttl = CU.TTL_MINIMUM;
+                        expireTime = CU.expireTimeInPast();
                     }
                     else if (ttl == CU.TTL_NOT_CHANGED)
                         ttl = 0;
@@ -2544,8 +2544,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
         long expireTime;
 
         if (ttl == CU.TTL_ZERO) {
-            ttl = 1;
-            expireTime = U.currentTimeMillis() - 1;
+            ttl = CU.TTL_MINIMUM;
+            expireTime = CU.expireTimeInPast();
         }
         else
             expireTime = toExpireTime(ttl);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bc6553b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index f5c2836..7f8b278 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1712,6 +1712,13 @@ public class GridCacheUtils {
     }
 
     /**
+     * @return Expire time denoting a point in the past.
+     */
+    public static long expireTimeInPast() {
+        return U.currentTimeMillis() - 1L;
+    }
+
+    /**
      * Reads array from input stream.
      *
      * @param in Input stream.


Mime
View raw message