ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # ignite-684
Date Tue, 07 Apr 2015 06:33:36 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-684 360a41f25 -> ed0b8646d


# ignite-684


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

Branch: refs/heads/ignite-684
Commit: ed0b8646deadb20ab0cd86e987c2a326d380ed78
Parents: 360a41f
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Apr 7 09:31:43 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Apr 7 09:31:43 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheLazyEntry.java        | 10 ++++----
 .../processors/cache/KeyCacheObjectImpl.java    | 13 +---------
 .../IgniteCacheObjectProcessorImpl.java         |  5 ----
 .../GridCacheOnCopyFlagAbstractSelfTest.java    | 27 +++++---------------
 .../IgniteCacheStoreValueAbstractTest.java      | 18 +++++++++++++
 5 files changed, 30 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed0b8646/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
index a2b0bff..d0f0d4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
@@ -68,18 +68,18 @@ public class CacheLazyEntry<K, V> implements Cache.Entry<K, V>
{
 
     /**
      * @param ctx Cache context.
-     * @param keyObject Key cache object.
+     * @param keyObj Key cache object.
      * @param key Key value.
      * @param valObj Cache object
      * @param val Cache value.
      */
     public CacheLazyEntry(GridCacheContext<K, V> ctx, 
-        KeyCacheObject keyObject, 
-        K key, 
-        CacheObject valObj, 
+        KeyCacheObject keyObj,
+        K key,
+        CacheObject valObj,
         V val) {
         this.cctx = ctx;
-        this.keyObj = keyObject;
+        this.keyObj = keyObj;
         this.key = key;
         this.valObj = valObj;
         this.val = val;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed0b8646/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
index 429b30c..61ca882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/KeyCacheObjectImpl.java
@@ -72,18 +72,7 @@ public class KeyCacheObjectImpl extends CacheObjectAdapter implements KeyCacheOb
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
-        cpy = cpy && needCopy(ctx);
-
-        if (cpy) {
-            try {
-                return (T)ctx.processor().unmarshal(ctx,
-                    valBytes,
-                    val.getClass().getClassLoader());
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException("Failed to unmarshal object.", e);
-            }
-        }
+        assert val != null;
 
         return (T)val;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed0b8646/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index bd79d0c..7815e91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -278,11 +278,6 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter
impleme
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy)
{
-            return super.value(ctx, false);  // Do not need copy since user value is not
in cache.
-        }
-
-        /** {@inheritDoc} */
         @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
             try {
                 if (!ctx.processor().immutable(val)) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed0b8646/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
index c1ad283..cea6ca1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
@@ -138,8 +138,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
                     assertSame(entry.getValue(), entry.getValue());
                     assertSame(entry.getKey(), entry.getKey());
 
-                    // Try change key and value.
-                    entry.getKey().field(WRONG_VALUE);
+                    // Try change value.
                     entry.getValue().val(WRONG_VALUE);
                 }
             });
@@ -161,8 +160,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
 
                     assertEquals(newTestVal, newVal);
 
-                    // Try change key and value.
-                    entry.getKey().field(WRONG_VALUE);
+                    // Try change value.
                     entry.getValue().val(WRONG_VALUE);
 
                     return newVal;
@@ -174,8 +172,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
                     assertSame(entry.getValue(), entry.getValue());
                     assertSame(entry.getKey(), entry.getKey());
 
-                    // Try change key and value.
-                    entry.getKey().field(WRONG_VALUE);
+                    // Try change value.
                     entry.getValue().val(WRONG_VALUE);
                 }
             });
@@ -221,7 +218,6 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
                 assertEquals(entry.getKey().key(), entry.getKey().field());
 
                 // Try changed entry.
-                entry.getKey().field(WRONG_VALUE);
                 entry.getValue().val(WRONG_VALUE);
 
                 return super.onBeforePut(entry, newVal);
@@ -231,7 +227,6 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
                 assertEquals(entry.getKey().key(), entry.getKey().field());
 
                 entry.getValue().val(WRONG_VALUE);
-                entry.getKey().field(WRONG_VALUE);
 
                 super.onAfterPut(entry);
             }
@@ -241,12 +236,10 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
             cache.invoke(new TestKey(i, i), new EntryProcessor<TestKey, TestValue, Object>()
{
                 @Override public Object process(MutableEntry<TestKey, TestValue> entry,
Object... arguments)
                     throws EntryProcessorException {
-                    // Check that we have correct value and key.
-                    assertEquals(entry.getKey().key(), entry.getKey().field());
+                    // Check that we have correct value.
                     assertEquals(entry.getKey().key(), entry.getValue().val());
 
                     // Try changed entry.
-                    entry.getKey().field(WRONG_VALUE);
                     entry.getValue().val(WRONG_VALUE);
 
                     return -1;
@@ -294,7 +287,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
 
             TestKey key1 = entry.key().value(cctx.cacheObjectContext(), true);
 
-            assertNotSame(key0, key1);
+            assertSame(key0, key1);
 
             TestValue val0 = entry.rawGet().value(cctx.cacheObjectContext(), false);
 
@@ -340,7 +333,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
 
             TestKey key1 = entry.key().value(cctx.cacheObjectContext(), true);
 
-            assertNotSame(key0, key1);
+            assertSame(key0, key1);
 
             byte[] val0 = entry.rawGet().value(cctx.cacheObjectContext(), false);
 
@@ -442,14 +435,6 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
             return field;
         }
 
-        /**
-         * *
-         * @param field Test field.
-         */
-        public void field(int field) {
-            this.field = field;
-        }
-
         /** {@inheritDoc} */
         @Override public boolean equals(Object o) {
             if (this == o) return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed0b8646/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
index 3835c8e..6c7c38d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
@@ -251,6 +251,15 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
                 assertNotNull("Unexpected value, node: " + g,
                     GridTestUtils.getFieldValue(keyObj, CacheObjectAdapter.class, "val"));
 
+                Object key0 = keyObj.value(cache0.context().cacheObjectContext(), true);
+                Object key1 = keyObj.value(cache0.context().cacheObjectContext(), false);
+                Object key2 = keyObj.value(cache0.context().cacheObjectContext(), true);
+                Object key3 = keyObj.value(cache0.context().cacheObjectContext(), false);
+
+                assertSame(key0, key1);
+                assertSame(key1, key2);
+                assertSame(key2, key3);
+
                 CacheObject obj = e.rawGet();
 
                 if (obj != null) {
@@ -379,6 +388,15 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
                 assertNotNull("Unexpected value, node: " + g,
                     GridTestUtils.getFieldValue(keyObj, CacheObjectAdapter.class, "val"));
 
+                Object key0 = keyObj.value(cache0.context().cacheObjectContext(), true);
+                Object key1 = keyObj.value(cache0.context().cacheObjectContext(), false);
+                Object key2 = keyObj.value(cache0.context().cacheObjectContext(), true);
+                Object key3 = keyObj.value(cache0.context().cacheObjectContext(), false);
+
+                assertSame(key0, key1);
+                assertSame(key1, key2);
+                assertSame(key2, key3);
+
                 CacheObject obj = e.rawGet();
 
                 if (obj != null) {


Mime
View raw message