ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [14/21] incubator-ignite git commit: ignite-800: Fixed.
Date Tue, 28 Apr 2015 08:46:49 GMT
ignite-800: Fixed.


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

Branch: refs/heads/ignite-789
Commit: 3e8db5b94b3526defd4d86b7429a111f0d0b0143
Parents: cf55393
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Mon Apr 27 16:18:47 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Mon Apr 27 16:18:47 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheInvokeResult.java     | 24 ++++++++++++++++----
 .../processors/cache/GridCacheAdapter.java      |  2 +-
 .../processors/cache/GridCacheMapEntry.java     |  4 ++--
 .../processors/cache/GridCacheReturn.java       |  5 ++--
 .../dht/atomic/GridDhtAtomicCache.java          |  3 +--
 .../local/atomic/GridLocalAtomicCache.java      |  6 ++---
 .../GridSwapSpaceSpiAbstractSelfTest.java       |  2 +-
 7 files changed, 31 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
index 422b763..21dad67 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
@@ -45,17 +45,33 @@ public class CacheInvokeResult<T> implements EntryProcessorResult<T>,
Externaliz
     }
 
     /**
+     * Static constructor.
+     *
      * @param res Computed result.
+     * @return New instance.
      */
-    public CacheInvokeResult(T res) {
-        this.res = res;
+    public static <T> CacheInvokeResult<T> fromResult(T res) {
+        CacheInvokeResult<T> cacheRes = new CacheInvokeResult<>();
+
+        cacheRes.res = res;
+
+        return cacheRes;
     }
 
     /**
+     * Static constructor.
+     *
      * @param err Exception thrown by {@link EntryProcessor#process(MutableEntry, Object...)}.
+     * @return New instance.
      */
-    public CacheInvokeResult(Exception err) {
-        this.err = err;
+    public static <T> CacheInvokeResult<T> fromError(Exception err) {
+        assert err != null;
+
+        CacheInvokeResult<T> res = new CacheInvokeResult<>();
+
+        res.err = err;
+
+        return res;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index c246661..3f4e97b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -2098,7 +2098,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                     res = resMap.isEmpty() ? null : resMap.values().iterator().next();
                 }
 
-                return res != null ? res : new CacheInvokeResult<>((T)null);
+                return res != null ? res : new CacheInvokeResult();
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/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 c9f55f5..3dcd0ec 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
@@ -1402,12 +1402,12 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
 
                     key0 = entry.key();
 
-                    invokeRes = computed != null ? new CacheInvokeResult<>(cctx.unwrapTemporary(computed))
: null;
+                    invokeRes = computed != null ? CacheInvokeResult.fromResult(cctx.unwrapTemporary(computed))
: null;
                 }
                 catch (Exception e) {
                     updated = old;
 
-                    invokeRes = new CacheInvokeResult<>(e);
+                    invokeRes = CacheInvokeResult.fromError(e);
                 }
 
                 if (!entry.modified()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index c21dcef..743d42c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -223,7 +223,7 @@ public class GridCacheReturn implements Externalizable, Message {
                 v = resMap;
             }
 
-            CacheInvokeResult res0 = err == null ? new CacheInvokeResult(res) : new CacheInvokeResult(err);
+            CacheInvokeResult res0 = err == null ? CacheInvokeResult.fromResult(res) : CacheInvokeResult.fromError(err);
 
             resMap.put(key0 != null ? key0 : CU.value(key, cctx, true), res0);
         }
@@ -313,7 +313,8 @@ public class GridCacheReturn implements Externalizable, Message {
 
             for (CacheInvokeDirectResult res : invokeResCol) {
                 CacheInvokeResult<?> res0 = res.error() == null ?
-                    new CacheInvokeResult<>(CU.value(res.result(), ctx, false)) : new
CacheInvokeResult<>(res.error());
+                    CacheInvokeResult.fromResult(CU.value(res.result(), ctx, false)) :
+                    CacheInvokeResult.fromError(res.error());
 
                 map0.put(res.key().value(ctx.cacheObjectContext(), false), res0);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index ccacca1..905f7bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.cluster.*;
-import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
@@ -604,7 +603,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         throws IgniteCheckedException {
         EntryProcessorResult<T> res = invokeAsync(key, entryProcessor, args).get();
 
-        return res != null ? res : new CacheInvokeResult<>((T)null);
+        return res != null ? res : new CacheInvokeResult<T>();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 8095600..936ed9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -570,7 +570,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
         Object... args) throws IgniteCheckedException {
         EntryProcessorResult<T> res = invokeAsync(key, entryProcessor, args).get();
 
-        return res != null ? res : new CacheInvokeResult<>((T)null);
+        return res != null ? res : new CacheInvokeResult<T>();
     }
 
     /** {@inheritDoc} */
@@ -1056,10 +1056,10 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
                             updated = ctx.toCacheObject(updatedVal);
 
                             if (computed != null)
-                                invokeRes = new CacheInvokeResult<>(ctx.unwrapTemporary(computed));
+                                invokeRes = CacheInvokeResult.fromResult(ctx.unwrapTemporary(computed));
                         }
                         catch (Exception e) {
-                            invokeRes = new CacheInvokeResult<>(e);
+                            invokeRes = CacheInvokeResult.fromError(e);
 
                             updated = old;
                         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8db5b9/modules/core/src/test/java/org/apache/ignite/spi/swapspace/GridSwapSpaceSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/GridSwapSpaceSpiAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/GridSwapSpaceSpiAbstractSelfTest.java
index da673d9..5740915 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/GridSwapSpaceSpiAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/GridSwapSpaceSpiAbstractSelfTest.java
@@ -608,7 +608,7 @@ public abstract class GridSwapSpaceSpiAbstractSelfTest extends GridCommonAbstrac
     /**
      * Key.
      */
-    private static class Key {
+    private static class Key implements Serializable {
         /** Index. */
         private final int i;
 


Mime
View raw message