You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/11 10:19:12 UTC

[27/38] ignite git commit: GridCacheEntryInfo: removed old code.

GridCacheEntryInfo: removed old code.


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

Branch: refs/heads/ignite-5075
Commit: 51069c5ca5cac5c0b7b86ba0146e2c019c578ecc
Parents: 68b6838
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 10 14:04:22 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 10 14:04:22 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheEntryInfo.java    | 68 +++-----------------
 .../GridDhtPartitionSupplyMessage.java          | 30 +--------
 2 files changed, 12 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/51069c5c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
index e50fbfe..c0e1c55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
@@ -42,9 +42,6 @@ public class GridCacheEntryInfo implements Message {
     @GridToStringInclude
     private KeyCacheObject key;
 
-    /** Key bytes, set when entry is read from swap and there is no key instance. */
-    private byte[] keyBytes;
-
     /** Cache ID. */
     private int cacheId;
 
@@ -90,20 +87,6 @@ public class GridCacheEntryInfo implements Message {
     }
 
     /**
-     * @param bytes Key bytes.
-     */
-    public void keyBytes(byte[] bytes) {
-        this.keyBytes = bytes;
-    }
-
-    /**
-     * @return Key bytes.
-     */
-    public byte[] keyBytes() {
-        return keyBytes;
-    }
-
-    /**
      * @return Entry key.
      */
     public KeyCacheObject key() {
@@ -230,24 +213,18 @@ public class GridCacheEntryInfo implements Message {
                 writer.incrementState();
 
             case 3:
-                if (!writer.writeByteArray("keyBytes", keyBytes))
-                    return false;
-
-                writer.incrementState();
-
-            case 4:
                 if (!writer.writeLong("ttl", ttl))
                     return false;
 
                 writer.incrementState();
 
-            case 5:
+            case 4:
                 if (!writer.writeMessage("val", val))
                     return false;
 
                 writer.incrementState();
 
-            case 6:
+            case 5:
                 if (!writer.writeMessage("ver", ver))
                     return false;
 
@@ -291,14 +268,6 @@ public class GridCacheEntryInfo implements Message {
                 reader.incrementState();
 
             case 3:
-                keyBytes = reader.readByteArray("keyBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 4:
                 ttl = reader.readLong("ttl");
 
                 if (!reader.isLastRead())
@@ -306,7 +275,7 @@ public class GridCacheEntryInfo implements Message {
 
                 reader.incrementState();
 
-            case 5:
+            case 4:
                 val = reader.readMessage("val");
 
                 if (!reader.isLastRead())
@@ -314,7 +283,7 @@ public class GridCacheEntryInfo implements Message {
 
                 reader.incrementState();
 
-            case 6:
+            case 5:
                 ver = reader.readMessage("ver");
 
                 if (!reader.isLastRead())
@@ -334,7 +303,7 @@ public class GridCacheEntryInfo implements Message {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 7;
+        return 6;
     }
 
     /**
@@ -358,13 +327,7 @@ public class GridCacheEntryInfo implements Message {
         if (val != null)
             size += val.valueBytes(cacheObjCtx).length;
 
-        if (key == null) {
-            assert keyBytes != null;
-
-            size += keyBytes.length;
-        }
-        else
-            size += key.valueBytes(cacheObjCtx).length;
+        size += key.valueBytes(cacheObjCtx).length;
 
         return SIZE_OVERHEAD + size;
     }
@@ -374,10 +337,9 @@ public class GridCacheEntryInfo implements Message {
      * @throws IgniteCheckedException In case of error.
      */
     public void marshal(GridCacheContext ctx) throws IgniteCheckedException {
-        assert key != null ^ keyBytes != null;
+        assert key != null;
 
-        if (key != null)
-            key.prepareMarshal(ctx.cacheObjectContext());
+        key.prepareMarshal(ctx.cacheObjectContext());
 
         if (val != null)
             val.prepareMarshal(ctx.cacheObjectContext());
@@ -400,17 +362,7 @@ public class GridCacheEntryInfo implements Message {
      * @throws IgniteCheckedException If unmarshalling failed.
      */
     public void unmarshal(GridCacheContext ctx, ClassLoader clsLdr) throws IgniteCheckedException {
-        if (key == null) {
-            assert keyBytes != null;
-
-            CacheObjectContext cacheObjCtx = ctx.cacheObjectContext();
-
-            Object key0 = ctx.cacheObjects().unmarshal(cacheObjCtx, keyBytes, clsLdr);
-
-            key = ctx.cacheObjects().toCacheKeyObject(cacheObjCtx, ctx, key0, false);
-        }
-        else
-            key.finishUnmarshal(ctx.cacheObjectContext(), clsLdr);
+        key.finishUnmarshal(ctx.cacheObjectContext(), clsLdr);
 
         if (val != null)
             val.finishUnmarshal(ctx.cacheObjectContext(), clsLdr);
@@ -428,4 +380,4 @@ public class GridCacheEntryInfo implements Message {
     @Override public String toString() {
         return S.toString(GridCacheEntryInfo.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/51069c5c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
index ee461ab..903a7da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
@@ -206,36 +206,10 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage implements G
      * @param ctx Cache context.
      * @throws IgniteCheckedException If failed.
      */
-    void addEntry(int p, GridCacheEntryInfo info, GridCacheContext ctx) throws IgniteCheckedException {
-        assert info != null;
-
-        marshalInfo(info, ctx);
-
-        msgSize += info.marshalledSize(ctx);
-
-        CacheEntryInfoCollection infoCol = infos().get(p);
-
-        if (infoCol == null) {
-            msgSize += 4;
-
-            infos().put(p, infoCol = new CacheEntryInfoCollection());
-
-            infoCol.init();
-        }
-
-        infoCol.add(info);
-    }
-
-    /**
-     * @param p Partition.
-     * @param info Entry to add.
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
     void addEntry0(int p, GridCacheEntryInfo info, GridCacheContext ctx) throws IgniteCheckedException {
         assert info != null;
-        assert (info.key() != null || info.keyBytes() != null);
-        assert info.value() != null;
+        assert info.key() != null : info;
+        assert info.value() != null : info;
 
         // Need to call this method to initialize info properly.
         marshalInfo(info, ctx);