ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/50] [abbrv] incubator-ignite git commit: #ignite-758: fix tests.
Date Mon, 20 Apr 2015 11:48:20 GMT
#ignite-758: fix tests.


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

Branch: refs/heads/ignite-sprint-4
Commit: b98f669912fa43d15a0d0143a221eb1fdb303c2f
Parents: 228736f
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Apr 16 16:35:25 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Apr 16 16:35:25 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 89 +++++++++++---------
 .../processors/cache/IgniteCacheProxy.java      |  6 +-
 2 files changed, 55 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b98f6699/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 6f14351..3a12e4d 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
@@ -1494,44 +1494,12 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
     /** {@inheritDoc} */
     @Override public Map<K, V> getAll(@Nullable Collection<? extends K> keys)
throws IgniteCheckedException {
-        A.notNull(keys, "keys");
-
-        boolean statsEnabled = ctx.config().isStatisticsEnabled();
-
-        long start = statsEnabled ? System.nanoTime() : 0L;
-
-        Map<K, V> map = getAll(keys, true);
-
-        if (ctx.config().getInterceptor() != null)
-            map = interceptGet(keys, map);
-
-        if (statsEnabled)
-            metrics0().addGetTimeNanos(System.nanoTime() - start);
-
-        return map;
+        return getAll(keys, true);
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable final
Collection<? extends K> keys) {
-        A.notNull(keys, "keys");
-
-        final boolean statsEnabled = ctx.config().isStatisticsEnabled();
-
-        final long start = statsEnabled ? System.nanoTime() : 0L;
-
-        IgniteInternalFuture<Map<K, V>> fut = getAllAsync(keys, true);
-
-        if (ctx.config().getInterceptor() != null)
-            return fut.chain(new CX1<IgniteInternalFuture<Map<K, V>>, Map<K,
V>>() {
-                @Override public Map<K, V> applyx(IgniteInternalFuture<Map<K,
V>> f) throws IgniteCheckedException {
-                    return interceptGet(keys, f.get());
-                }
-            });
-
-        if (statsEnabled)
-            fut.listen(new UpdateGetTimeStatClosure<Map<K, V>>(metrics0(), start));
-
-        return fut;
+        return getAllAsync(keys, true);
     }
 
     /**
@@ -4395,11 +4363,25 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
     /** {@inheritDoc} */
     @Override @Nullable public V get(K key, boolean deserializePortable)
         throws IgniteCheckedException {
+        A.notNull(key, "key");
+
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         Map<K, V> map = getAllAsync(F.asList(key), deserializePortable).get();
 
         assert map.isEmpty() || map.size() == 1 : map.size();
 
-        return map.get(key);
+        V val = map.get(key);
+
+        if (ctx.config().getInterceptor() != null)
+            val = (V)ctx.config().getInterceptor().onGet(key, val);
+
+        if (statsEnabled)
+            metrics0().addGetTimeNanos(System.nanoTime() - start);
+
+        return val;
     }
 
     /** {@inheritDoc} */
@@ -4426,16 +4408,35 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
     /** {@inheritDoc} */
     @Override public Map<K, V> getAll(Collection<? extends K> keys, boolean deserializePortable)
throws IgniteCheckedException {
         checkJta();
+        A.notNull(keys, "keys");
+
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
 
-        return getAllAsync(keys, deserializePortable).get();
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
+        Map<K, V> map = getAllAsync(keys, deserializePortable).get();
+
+        if (ctx.config().getInterceptor() != null)
+            map = interceptGet(keys, map);
+
+        if (statsEnabled)
+            metrics0().addGetTimeNanos(System.nanoTime() - start);
+
+        return map;
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable Collection<?
extends K> keys,
+    @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable final
Collection<? extends K> keys,
         boolean deserializePortable) {
+        A.notNull(keys, "keys");
+
+        final boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        final long start = statsEnabled ? System.nanoTime() : 0L;
+
         String taskName = ctx.kernalContext().job().currentTaskName();
 
-        return getAllAsync(keys,
+        IgniteInternalFuture<Map<K, V>> fut = getAllAsync(keys,
             !ctx.config().isReadFromBackup(),
             /*skip tx*/false,
             null,
@@ -4443,6 +4444,18 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
             taskName,
             deserializePortable,
             false);
+
+        if (ctx.config().getInterceptor() != null)
+            return fut.chain(new CX1<IgniteInternalFuture<Map<K, V>>, Map<K,
V>>() {
+                @Override public Map<K, V> applyx(IgniteInternalFuture<Map<K,
V>> f) throws IgniteCheckedException {
+                    return interceptGet(keys, f.get());
+                }
+            });
+
+        if (statsEnabled)
+            fut.listen(new UpdateGetTimeStatClosure<Map<K, V>>(metrics0(), start));
+
+        return fut;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b98f6699/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 7fa0a51..cef7da9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -677,14 +677,16 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
         try {
             CacheProjectionContext prev = gate.enter(prjCtx);
 
+            boolean deserializePortables = prjCtx == null ? false : prjCtx.deserializePortables();
+
             try {
                 if (isAsync()) {
-                    setFuture(delegate.getAllAsync(keys));
+                    setFuture(delegate.getAllAsync(keys, deserializePortables));
 
                     return null;
                 }
                 else
-                    return delegate.getAll(keys);
+                    return delegate.getAll(keys, deserializePortables);
             }
             finally {
                 gate.leave(prev);


Mime
View raw message