You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/07/31 08:57:00 UTC

[14/26] ignite git commit: IGNITE-5729 - Fixed TCK tests

IGNITE-5729 - Fixed TCK tests


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

Branch: refs/heads/ignite-5757
Commit: 39f7c03ea45280bc8d1fbaf461933141b2f03506
Parents: f975110
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Fri Jul 28 17:06:50 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jul 28 17:07:02 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java        | 16 +++++++---------
 .../processors/cache/IgniteCacheProxyImpl.java      | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/39f7c03e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index bbd7500..3406f48 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -3215,8 +3215,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      */
     public Collection<IgniteCacheProxy<?, ?>> jcaches() {
         return F.viewReadOnly(jCacheProxies.values(), new IgniteClosure<IgniteCacheProxyImpl<?, ?>, IgniteCacheProxy<?, ?>>() {
-            @Override public IgniteCacheProxy<?, ?> apply(IgniteCacheProxyImpl<?, ?> entry) {
-                return new GatewayProtectedCacheProxy<>(entry, new CacheOperationContext(), true);
+            @Override public IgniteCacheProxy<?, ?> apply(IgniteCacheProxyImpl<?, ?> proxy) {
+                return proxy.gatewayWrapper();
             }
         });
     }
@@ -3315,7 +3315,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (desc != null && !desc.cacheType().userCache())
             throw new IllegalStateException("Failed to get cache because it is a system cache: " + cacheName);
 
-        IgniteCacheProxy<?, ?> cache = jCacheProxies.get(cacheName);
+        IgniteCacheProxyImpl<?, ?> cache = jCacheProxies.get(cacheName);
 
         // Try to start cache, there is no guarantee that cache will be instantiated.
         if (cache == null) {
@@ -3324,9 +3324,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             cache = jCacheProxies.get(cacheName);
         }
 
-        return cache != null ?
-            new GatewayProtectedCacheProxy<>((IgniteCacheProxy<K, V>)cache, new CacheOperationContext(), true) :
-            null;
+        return cache != null ? (IgniteCacheProxy<K, V>) cache.gatewayWrapper() : null;
     }
 
     /**
@@ -3465,9 +3463,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     public Collection<IgniteCacheProxy<?, ?>> publicCaches() {
         Collection<IgniteCacheProxy<?, ?>> res = new ArrayList<>(jCacheProxies.size());
 
-        for (Map.Entry<String, IgniteCacheProxyImpl<?, ?>> entry : jCacheProxies.entrySet()) {
-            if (entry.getValue().context().userCache())
-                res.add(new GatewayProtectedCacheProxy(entry.getValue(), new CacheOperationContext(), true));
+        for (IgniteCacheProxyImpl<?, ?> proxy : jCacheProxies.values()) {
+            if (proxy.context().userCache())
+                res.add(proxy.gatewayWrapper());
         }
 
         return res;

http://git-wip-us.apache.org/repos/asf/ignite/blob/39f7c03e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
index 0bc3ba2..ef351ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
@@ -113,6 +113,9 @@ public class IgniteCacheProxyImpl<K, V> extends AsyncSupportAdapter<IgniteCache<
     @GridToStringInclude
     private volatile IgniteInternalCache<K, V> delegate;
 
+    /** Cached proxy wrapper. */
+    private volatile IgniteCacheProxy<K, V> cachedProxy;
+
     /** */
     @GridToStringExclude
     private CacheManager cacheMgr;
@@ -178,6 +181,17 @@ public class IgniteCacheProxyImpl<K, V> extends AsyncSupportAdapter<IgniteCache<
         return new GatewayProtectedCacheProxy<>(this, new CacheOperationContext(), false);
     }
 
+    /**
+     * @return Default cached proxy wrapper {@link GatewayProtectedCacheProxy}.
+     */
+    public IgniteCacheProxy<K, V> gatewayWrapper() {
+        if (cachedProxy != null)
+            return cachedProxy;
+
+        cachedProxy = new GatewayProtectedCacheProxy<>(this, new CacheOperationContext(), true);
+        return cachedProxy;
+    }
+
     /** {@inheritDoc} */
     @Override public CacheMetrics metrics() {
         return ctx.cache().clusterMetrics();