Vladsz83 commented on code in PR #13447:
URL: https://github.com/apache/ignite/pull/13447#discussion_r3759365896


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java:
##########
@@ -64,58 +68,80 @@ public class GridCacheEntryInfo implements 
SelfMarshallingMessage, CacheIdAware
     /** Deleted flag. */
     private boolean deleted;
 
-    /** {@inheritDoc} */
-    @Override public int cacheId() {
-        return cacheId;
-    }
-
     /**
-     * @param cacheId Cache ID.
+     * Empty constructor for serialization purposes. Initializes {@link 
#initTime} to properly calculate {@link #expireTime()}
+     * if {@link #expireTimeDelta} and the expiration is effective. If no 
expiration is set, initialization of {@link #initTime}
+     * is not required, but it is a tradeoff for absence of the message 
serealization lifecycle awareness.
      */
-    public void cacheId(int cacheId) {
+    public GridCacheEntryInfo() {
+        initTime = U.currentTimeMillis();
+    }
+
+    /** */
+    public GridCacheEntryInfo(
+        int cacheId,
+        KeyCacheObject key,
+        @Nullable CacheObject val,
+        GridCacheVersion ver,
+        long initTime,
+        long expireTime,
+        long ttl
+    ) {
+        assert expireTime >= 0;
+        assert initTime > 0;
+
+        this.initTime = initTime;
+
+        expireTimeDelta = expireTime - initTime;
+
+        // Timeouted mark.
+        if (expireTimeDelta < 0)
+            expireTimeDelta = 0;
+
         this.cacheId = cacheId;
+        this.key = key;
+        this.val = val;
+        this.ver = ver;
+        this.ttl = ttl;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int cacheId() {
+        return cacheId;
     }
 
     /**
      * @param key Entry key.
      */
-    public void key(KeyCacheObject key) {
+    public void key(@Nullable KeyCacheObject key) {
         this.key = key;
     }
 
     /**
      * @return Entry key.
      */
-    public KeyCacheObject key() {
+    @Nullable public KeyCacheObject key() {
         return key;
     }
 
     /**
      * @return Entry value.
      */
-    public CacheObject value() {
+    public @Nullable CacheObject value() {
         return val;
     }
 
     /**
-     * @param val Entry value.
-     */
-    public void value(CacheObject val) {
-        this.val = val;
-    }
-
-    /**
-     * @return Expire time.
+     * @return Expire time >= 0. 0 means no expiration is set.
      */
     public long expireTime() {
-        return expireTime;
-    }
+        if (expireTimeDelta == -1L)

Review Comment:
   -1 is if the expiration isnt set at all. Then -1



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to