ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: IGNITE-443 Added conflict resolver manager.
Date Thu, 12 Mar 2015 11:51:06 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-443 [created] 110443fbc


IGNITE-443 Added conflict resolver manager.


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

Branch: refs/heads/ignite-443
Commit: 110443fbc58028e686c4e9127402f98222855fc8
Parents: d423fc7
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu Mar 12 14:51:09 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Mar 12 14:51:09 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridKernalContextImpl.java  |  2 ++
 .../cache/CacheConflictResolverManager.java     | 30 ++++++++++++++++++
 .../cache/CacheStubConflictResolverManager.java | 32 ++++++++++++++++++++
 .../processors/cache/GridCacheContext.java      | 16 +++++-----
 .../processors/cache/GridCacheProcessor.java    |  7 +++--
 .../loadtests/hashmap/GridCacheTestContext.java |  3 +-
 6 files changed, 79 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/110443fb/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 1da4b1f..333a852 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -800,6 +800,8 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
             return (T)new GridOsCacheDrManager();
         else if (cls.equals(IgniteCacheObjectProcessor.class))
             return (T)new IgniteCacheObjectProcessorImpl(this);
+        else if (cls.equals(CacheConflictResolverManager.class))
+            return (T)new CacheStubConflictResolverManager<>();
 
         throw new IgniteException("Unsupported component type: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/110443fb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictResolverManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictResolverManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictResolverManager.java
new file mode 100644
index 0000000..cd11278
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictResolverManager.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.internal.processors.cache.version.*;
+
+/**
+ * Conflict resolver manager.
+ */
+public abstract class CacheConflictResolverManager<K, V> extends GridCacheManagerAdapter<K,
V> {
+    /**
+     * @return Cache conflict resolver.
+     */
+    public abstract GridCacheVersionAbstractConflictResolver conflictResolver();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/110443fb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStubConflictResolverManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStubConflictResolverManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStubConflictResolverManager.java
new file mode 100644
index 0000000..e284d69
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStubConflictResolverManager.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.internal.processors.cache.version.*;
+
+/**
+ * Stub conflict resolver manager.
+ */
+public class CacheStubConflictResolverManager<K ,V> extends CacheConflictResolverManager<K
,V> {
+    /**
+     * @return Cache conflict resolver.
+     */
+    @Override public GridCacheVersionAbstractConflictResolver conflictResolver() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/110443fb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index ec94e04..3dace7a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -134,6 +134,9 @@ public class GridCacheContext<K, V> implements Externalizable {
     /** JTA manager. */
     private CacheJtaManagerAdapter jtaMgr;
 
+    /** Conflict resolver manager. */
+    private CacheConflictResolverManager rslvrMgr;
+
     /** Managers. */
     private List<GridCacheManager<K, V>> mgrs = new LinkedList<>();
 
@@ -235,7 +238,8 @@ public class GridCacheContext<K, V> implements Externalizable {
         CacheDataStructuresManager dataStructuresMgr,
         GridCacheTtlManager ttlMgr,
         GridCacheDrManager drMgr,
-        CacheJtaManagerAdapter jtaMgr) {
+        CacheJtaManagerAdapter jtaMgr,
+        CacheConflictResolverManager<K, V> rslvrMgr) {
         assert ctx != null;
         assert sharedCtx != null;
         assert cacheCfg != null;
@@ -249,6 +253,7 @@ public class GridCacheContext<K, V> implements Externalizable {
         assert affMgr != null;
         assert dataStructuresMgr != null;
         assert ttlMgr != null;
+        assert rslvrMgr != null;
 
         this.ctx = ctx;
         this.sharedCtx = sharedCtx;
@@ -269,6 +274,7 @@ public class GridCacheContext<K, V> implements Externalizable {
         this.ttlMgr = add(ttlMgr);
         this.drMgr = add(drMgr);
         this.jtaMgr = add(jtaMgr);
+        this.rslvrMgr = add(rslvrMgr);
 
         log = ctx.log(getClass());
 
@@ -312,13 +318,7 @@ public class GridCacheContext<K, V> implements Externalizable {
      * Initialize conflict resolver after all managers are started.
      */
     void initConflictResolver() {
-        // Conflict resolver is determined in two stages:
-        // 1. If DR receiver hub is enabled, then pick it from DR manager.
-        // 2. Otherwise instantiate default resolver in case local store is configured.
-        conflictRslvr = drMgr.conflictResolver();
-
-        if (conflictRslvr == null && storeMgr.isLocalStore())
-            conflictRslvr = new GridCacheVersionConflictResolver();
+        conflictRslvr = rslvrMgr.conflictResolver();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/110443fb/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 7deb1fe..6019fde 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
@@ -625,6 +625,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             CacheDataStructuresManager dataStructuresMgr = new CacheDataStructuresManager();
             GridCacheTtlManager ttlMgr = new GridCacheTtlManager();
             GridCacheDrManager drMgr = ctx.createComponent(GridCacheDrManager.class);
+            CacheConflictResolverManager rslvrMgr = ctx.createComponent(CacheConflictResolverManager.class);
 
             GridCacheStoreManager storeMgr = new GridCacheStoreManager(ctx, sesHolders, cfgStore,
cfg);
 
@@ -647,7 +648,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 dataStructuresMgr,
                 ttlMgr,
                 drMgr,
-                jta);
+                jta,
+                rslvrMgr);
 
             cacheCtx.cacheObjectContext(cacheObjCtx);
 
@@ -786,7 +788,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                     dataStructuresMgr,
                     ttlMgr,
                     drMgr,
-                    jta);
+                    jta,
+                    rslvrMgr);
 
                 cacheCtx.cacheObjectContext(cacheObjCtx);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/110443fb/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index 459043e..0ee8434 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -68,6 +68,7 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K,
V> {
             new CacheDataStructuresManager(),
             new GridCacheTtlManager(),
             new GridOsCacheDrManager(),
-            new CacheNoopJtaManager());
+            new CacheNoopJtaManager(),
+            new CacheStubConflictResolverManager<K, V>());
     }
 }


Mime
View raw message