ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] incubator-ignite git commit: #ignite-758: revert getAll operations in GridCacheAdapter.
Date Fri, 17 Apr 2015 08:55:42 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-758 15ee31bb0 -> 337c53111


#ignite-758: revert getAll operations in GridCacheAdapter.


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

Branch: refs/heads/ignite-758
Commit: 300c72d1bb9e9dc378827524fd2b5bbae7306649
Parents: 15ee31b
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Apr 17 11:44:52 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Apr 17 11:44:52 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 123 ++++++++++---------
 .../processors/cache/GridCacheProxyImpl.java    |  50 --------
 .../processors/cache/IgniteCacheProxy.java      |  18 +--
 .../processors/cache/IgniteInternalCache.java   |  31 -----
 4 files changed, 70 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/300c72d1/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 3d32bf5..cb8a581 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
@@ -1480,12 +1480,44 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
     /** {@inheritDoc} */
     @Override public Map<K, V> getAll(@Nullable Collection<? extends K> keys)
throws IgniteCheckedException {
-        return getAll(keys, true);
+        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;
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable final
Collection<? extends K> keys) {
-        return getAllAsync(keys, true);
+        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;
     }
 
     /**
@@ -4346,34 +4378,29 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 CU.cachePrimary(ctx.grid().affinity(ctx.name()), ctx.localNode())));
     }
 
-    /** {@inheritDoc} */
-    @Override @Nullable public V get(K key, boolean deserializePortable)
+    /**
+     * @param key Key.
+     * @param deserializePortable Deserialize portable flag.
+     * @return Cached value.
+     * @throws IgniteCheckedException If failed.
+     */
+    @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();
 
-        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;
+        return map.get(key);
     }
 
-    /** {@inheritDoc} */
-    @Override public final IgniteInternalFuture<V> getAsync(final K key, boolean deserializePortable)
{
+    /**
+     * @param key Key.
+     * @param deserializePortable Deserialize portable flag.
+     * @return Read operation future.
+     */
+    public final IgniteInternalFuture<V> getAsync(final K key, boolean deserializePortable)
{
         try {
-            checkJta();
+         checkJta();
         }
         catch (IgniteCheckedException e) {
             return new GridFinishedFuture<>(e);
@@ -4391,38 +4418,28 @@ 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 {
+    /**
+     * @param keys Keys.
+     * @param deserializePortable Deserialize portable flag.
+     * @return Map of cached values.
+     * @throws IgniteCheckedException If read failed.
+     */
+    public Map<K, V> getAll(Collection<? extends K> keys, boolean deserializePortable)
throws IgniteCheckedException {
         checkJta();
-        A.notNull(keys, "keys");
-
-        boolean statsEnabled = ctx.config().isStatisticsEnabled();
-
-        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;
+        return getAllAsync(keys, deserializePortable).get();
     }
 
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable final
Collection<? extends K> keys,
+    /**
+     * @param keys Keys.
+     * @param deserializePortable Deserialize portable flag.
+     * @return Read future.
+     */
+    public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable 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();
 
-        IgniteInternalFuture<Map<K, V>> fut = getAllAsync(keys,
+        return getAllAsync(keys,
             !ctx.config().isReadFromBackup(),
             /*skip tx*/false,
             null,
@@ -4430,19 +4447,7 @@ 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;
-    }
 
     /**
      * @param entry Entry.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/300c72d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 63e5329..4114dd8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -296,18 +296,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public V get(K key, boolean deserializePortable) throws IgniteCheckedException
{
-        CacheOperationContext prev = gate.enter(opCtx);
-
-        try {
-            return delegate.get(key, deserializePortable && !opCtx.isKeepPortable());
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteInternalFuture<V> getAsync(K key) {
         CacheOperationContext prev = gate.enter(opCtx);
 
@@ -320,18 +308,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> getAsync(K key, boolean deserializePortable)
{
-        CacheOperationContext prev = gate.enter(opCtx);
-
-        try {
-            return delegate.getAsync(key, deserializePortable && !opCtx.isKeepPortable());
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Override public V getForcePrimary(K key) throws IgniteCheckedException {
         CacheOperationContext prev = gate.enter(opCtx);
 
@@ -440,19 +416,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public Map<K, V> getAll(Collection<? extends K> keys, boolean deserializePortable)
-        throws IgniteCheckedException {
-        CacheOperationContext prev = gate.enter(opCtx);
-
-        try {
-            return delegate.getAll(keys, deserializePortable && !opCtx.isKeepPortable());
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable Collection<?
extends K> keys) {
         CacheOperationContext prev = gate.enter(opCtx);
 
@@ -465,19 +428,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable Collection<?
extends K> keys,
-        boolean deserializePortable) {
-        CacheOperationContext prev = gate.enter(opCtx);
-
-        try {
-            return delegate.getAllAsync(keys, deserializePortable && !opCtx.isKeepPortable());
-        }
-        finally {
-            gate.leave(prev);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public V getAndPut(K key, V val)
         throws IgniteCheckedException {
         CacheOperationContext prev = gate.enter(opCtx);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/300c72d1/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 35332d3..9c30c67 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
@@ -617,16 +617,14 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
         try {
             CacheOperationContext prev = gate.enter(prjCtx);
 
-            boolean deserializePortables = prjCtx == null ? false : !prjCtx.isKeepPortable();
-
             try {
                 if (isAsync()) {
-                    setFuture(delegate.getAsync(key, deserializePortables));
+                    setFuture(delegate.getAsync(key));
 
                     return null;
                 }
                 else
-                    return delegate.get(key, deserializePortables);
+                    return delegate.get(key);
             }
             finally {
                 gate.leave(prev);
@@ -642,16 +640,14 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
         try {
             CacheOperationContext prev = gate.enter(prjCtx);
 
-            boolean deserializePortables = prjCtx == null ? false : !prjCtx.isKeepPortable();
-
             try {
                 if (isAsync()) {
-                    setFuture(delegate.getAllAsync(keys, deserializePortables));
+                    setFuture(delegate.getAllAsync(keys));
 
                     return null;
                 }
                 else
-                    return delegate.getAll(keys, deserializePortables);
+                    return delegate.getAll(keys);
             }
             finally {
                 gate.leave(prev);
@@ -670,16 +666,14 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
         try {
             CacheOperationContext prev = gate.enter(prjCtx);
 
-            boolean deserializePortables = prjCtx == null ? false : !prjCtx.isKeepPortable();
-
             try {
                 if (isAsync()) {
-                    setFuture(delegate.getAllAsync(keys, deserializePortables));
+                    setFuture(delegate.getAllAsync(keys));
 
                     return null;
                 }
                 else
-                    return delegate.getAll(keys, deserializePortables);
+                    return delegate.getAll(keys);
             }
             finally {
                 gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/300c72d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index 20c1c20..e16af22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -322,14 +322,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K,
V>> {
     @Nullable public V get(K key) throws IgniteCheckedException;
 
     /**
-     * @param key Key.
-     * @param deserializePortable Deserialize portable flag.
-     * @return Cached value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable public V get(K key, boolean deserializePortable) throws IgniteCheckedException
;
-
-    /**
      * Asynchronously retrieves value mapped to the specified key from cache. Value will
only be returned if
      * its entry passed the optional filter provided. Filter check is atomic, and therefore
the
      * returned value is guaranteed to be consistent with the filter. The return value of
{@code null}
@@ -351,13 +343,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K,
V>> {
     public IgniteInternalFuture<V> getAsync(K key);
 
     /**
-     * @param key Key.
-     * @param deserializePortable Deserialize portable flag.
-     * @return Read operation future.
-     */
-    public IgniteInternalFuture<V> getAsync(final K key, boolean deserializePortable);
-
-    /**
      * Retrieves values mapped to the specified keys from cache. Value will only be returned
if
      * its entry passed the optional filter provided. Filter check is atomic, and therefore
the
      * returned value is guaranteed to be consistent with the filter. If requested key-value
pair
@@ -379,14 +364,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K,
V>> {
     public Map<K, V> getAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException;
 
     /**
-     * @param keys Keys.
-     * @param deserializePortable Deserialize portable flag.
-     * @return Map of cached values.
-     * @throws IgniteCheckedException If read failed.
-     */
-    public Map<K, V> getAll(Collection<? extends K> keys, boolean deserializePortable)
throws IgniteCheckedException;
-
-    /**
      * Asynchronously retrieves values mapped to the specified keys from cache. Value will
only be returned if
      * its entry passed the optional filter provided. Filter check is atomic, and therefore
the
      * returned value is guaranteed to be consistent with the filter. If requested key-value
pair
@@ -407,14 +384,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K,
V>> {
     public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable Collection<?
extends K> keys);
 
     /**
-     * @param keys Keys.
-     * @param deserializePortable Deserialize portable flag.
-     * @return Read future.
-     */
-    public IgniteInternalFuture<Map<K, V>> getAllAsync(@Nullable Collection<?
extends K> keys,
-        boolean deserializePortable);
-
-    /**
      * Stores given key-value pair in cache. If filters are provided, then entries will
      * be stored in cache only if they pass the filter. Note that filter check is atomic,
      * so value stored in cache is guaranteed to be consistent with the filters. If cache


Mime
View raw message