ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [02/50] [abbrv] incubator-ignite git commit: # sprint-1 Fixed unwrap for MutableEntry used in Cache.invoke
Date Thu, 12 Feb 2015 23:23:43 GMT
# sprint-1 Fixed unwrap for MutableEntry used in Cache.invoke


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

Branch: refs/heads/ignite-9655-merge
Commit: 362820e775985b1f243725f277ab895c08249d9f
Parents: 1c5681a
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Feb 12 11:44:05 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Feb 12 11:44:05 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/CacheInvokeEntry.java      | 5 ++++-
 .../processors/cache/IgniteCacheInvokeAbstractTest.java         | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362820e7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
index 829c6a0..541993c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
@@ -43,6 +43,7 @@ public class CacheInvokeEntry<K, V> implements MutableEntry<K,
V> {
     private boolean modified;
 
     /**
+     * @param cctx Cache context.
      * @param key Key.
      * @param val Value.
      */
@@ -90,7 +91,9 @@ public class CacheInvokeEntry<K, V> implements MutableEntry<K,
V> {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public <T> T unwrap(Class<T> cls) {
-        if(cls.isAssignableFrom(getClass()))
+        if (cls.equals(Ignite.class))
+            return (T)cctx.kernalContext().grid();
+        else if (cls.isAssignableFrom(getClass()))
             return cls.cast(this);
 
         throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362820e7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
index 04150e3..a4f8297 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
@@ -561,6 +561,10 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
         /** {@inheritDoc} */
         @Override public Integer process(MutableEntry<Integer, Integer> e,
             Object... arguments) throws EntryProcessorException {
+            Ignite ignite = e.unwrap(Ignite.class);
+
+            assertNotNull(ignite);
+
             if (e.exists()) {
                 Integer val = e.getValue();
 


Mime
View raw message