ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [17/17] incubator-ignite git commit: ignite-146 changes to flags
Date Thu, 29 Jan 2015 12:57:16 GMT
ignite-146 changes to flags


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

Branch: refs/heads/ignite-146
Commit: d5a88381a9d192382fe923eceb6467878bfa051b
Parents: b4ead8a
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Thu Jan 29 15:56:51 2015 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Thu Jan 29 15:56:51 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheProxy.java      | 22 +++++++++++++-------
 .../service/GridServiceProcessor.java           |  2 +-
 .../GridCacheReturnValueTransferSelfTest.java   |  2 +-
 .../cache/IgniteCacheInvokeAbstractTest.java    |  4 ++--
 ...GridCacheValueConsistencyAtomicSelfTest.java |  2 +-
 .../cache/GridCacheCommandHandlerSelfTest.java  |  4 ++--
 6 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5a88381/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 743e5b9..dd7b781 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
@@ -143,7 +143,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter<IgniteCach
 
     /** {@inheritDoc} */
     @Override public IgniteCache<K, V> withSkipStore() {
-        return flagsOn(CacheFlag.SKIP_STORE);
+        return flagOn(CacheFlag.SKIP_STORE);
     }
 
     /** {@inheritDoc} */
@@ -1018,21 +1018,27 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter<IgniteCach
     }
 
     /**
-     * @param flags Flags to turn on (if empty, then no-op).
+     * @param flag Flag to turn on.
      * @return Cache with given flags enabled.
      */
-    public IgniteCache<K, V> flagsOn(@Nullable CacheFlag... flags) {
+    public IgniteCache<K, V> flagOn(CacheFlag flag) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
-            Set<CacheFlag> res = EnumSet.noneOf(CacheFlag.class);
+            Set<CacheFlag> res;
 
-            Set<CacheFlag> flags0 = prj !=null ? prj.flags() : null;
+            Set<CacheFlag> flags0 = prj != null ? prj.flags() : null;
 
-            if (flags0 != null && !flags0.isEmpty())
-                res.addAll(flags0);
+            if (flags0 != null) {
+                if (flags0.contains(flag))
+                    return this;
 
-            res.addAll(EnumSet.copyOf(F.asList(flags)));
+                res = EnumSet.copyOf(flags0);
+            }
+            else
+                res = EnumSet.noneOf(CacheFlag.class);
+
+            res.add(flag);
 
             GridCacheProjectionImpl<K, V> prj0 = new GridCacheProjectionImpl<>(
                 (prj != null ? prj : delegate),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5a88381/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 8db40b9..4bcad37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -481,7 +481,7 @@ public class GridServiceProcessor extends GridProcessorAdapter {
             ManagedServiceDescriptorImpl desc = new ManagedServiceDescriptorImpl(dep);
 
             try {
-                GridServiceAssignments assigns = (GridServiceAssignments)cache.//flagsOn(CacheFlag.GET_PRIMARY).
+                GridServiceAssignments assigns = (GridServiceAssignments)cache.//flagOn(CacheFlag.GET_PRIMARY).
                     get(new GridServiceAssignmentsKey(dep.configuration().getName()));
 
                 if (assigns != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5a88381/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
index 7657842..d70bc82 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
@@ -141,7 +141,7 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
             IgniteCache<Integer, TestObject> cache = grid(2).jcache(null);
 
             if (backups > 0 && atomicityMode == ATOMIC)
-                cache = ((IgniteCacheProxy<Integer, TestObject>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+                cache = ((IgniteCacheProxy<Integer, TestObject>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
 
             for (int i = 0; i < 100; i++)
                 cache.put(i, new TestObject());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5a88381/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 784bd38..ca760e9 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
@@ -57,7 +57,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
             invoke(cache, OPTIMISTIC);
         }
         else if (gridCount() > 1) {
-            cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+            cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
 
             invoke(cache, null);
         }
@@ -186,7 +186,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
             invokeAll(cache, OPTIMISTIC);
         }
         else if (gridCount() > 1) {
-            cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+            cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
 
             invokeAll(cache, null);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5a88381/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
index 41fb81d..0ea0852 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
@@ -74,7 +74,7 @@ public class GridCacheValueConsistencyAtomicSelfTest extends GridCacheValueConsi
 
                             IgniteCache<Integer, Integer> cache = grid(idx).jcache(null);
 
-                            cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+                            cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
 
                             cache.invoke(i, new Transformer(i));
                         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5a88381/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
index d36726c..7a1765b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
@@ -248,8 +248,8 @@ public class GridCacheCommandHandlerSelfTest extends GridCommonAbstractTest
{
 
                             return fut;
                         }
-                        // Rewriting flagsOn result to keep intercepting invocations after
it.
-                        else if ("flagsOn".equals(mtd.getName()))
+                        // Rewriting flagOn result to keep intercepting invocations after
it.
+                        else if ("flagOn".equals(mtd.getName()))
                             return proxy;
                         else if ("forSubjectId".equals(mtd.getName()))
                             return proxy;


Mime
View raw message