#IGNITE-443 Extracted interface CacheVersionConflictResolver.

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

Branch: refs/heads/ignite-424
Commit: 67b7ffd93540b4578ef28e6b2d7608dea09fad5c
Parents: f881307
Author: nikolay_tikhonov <ntikho...@gridgain.com>
Authored: Tue Mar 31 11:31:50 2015 +0300
Committer: nikolay_tikhonov <ntikho...@gridgain.com>
Committed: Tue Mar 31 11:31:50 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridKernalContextImpl.java  |   5 +-
 .../processors/cache/CacheConflictManager.java  |  30 ------
 .../cache/CacheConflictResolverManager.java     |  30 ++++++
 .../cache/CacheOsConflictManager.java           |  33 ------
 .../cache/CacheOsConflictResolverManager.java   |  58 ++++++++++
 .../processors/cache/GridCacheContext.java      |   4 +-
 .../processors/cache/GridCacheProcessor.java    |   2 +-
 .../cache/dr/GridOsCacheDrManager.java          | 106 +++++++++++++++++++
 .../cache/dr/os/GridOsCacheDrManager.java       | 106 -------------------
 .../version/CacheVersionConflictResolver.java   |  56 +---------
 .../CacheVersionConflictResolverImpl.java       |  82 ++++++++++++++
 .../loadtests/hashmap/GridCacheTestContext.java |   4 +-
 12 files changed, 288 insertions(+), 228 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/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 7472413..ee82950 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
@@ -32,7 +32,6 @@ import org.apache.ignite.internal.managers.swapspace.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.dr.*;
-import org.apache.ignite.internal.processors.cache.dr.os.*;
 import org.apache.ignite.internal.processors.cacheobject.*;
 import org.apache.ignite.internal.processors.clock.*;
 import org.apache.ignite.internal.processors.closure.*;
@@ -791,8 +790,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(CacheConflictManager.class))
-            return (T)new CacheOsConflictManager<>();
+        else if (cls.equals(CacheConflictResolverManager.class))
+            return (T)new CacheOsConflictResolverManager<>();
 
         throw new IgniteException("Unsupported component type: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictManager.java
deleted file mode 100644
index 5f4e35d..0000000
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheConflictManager.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 interface CacheConflictManager<K, V> extends GridCacheManager<K, V> {
-    /**
-     * @return Cache conflict resolver.
-     */
-    public CacheVersionConflictResolver conflictResolver();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/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..73b98eb
--- /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 interface CacheConflictResolverManager<K, V> extends 
GridCacheManager<K, V> {
+    /**
+     * @return Cache conflict resolver.
+     */
+    public CacheVersionConflictResolver conflictResolver();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictManager.java
deleted file mode 100644
index b63580e..0000000
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictManager.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.*;
-
-/**
- * OS conflict resolver manager.
- */
-public class CacheOsConflictManager<K ,V> extends GridCacheManagerAdapter<K ,V>
-    implements CacheConflictManager<K, V> {
-    /**
-     * @return Cache conflict resolver.
-     */
-    @Override public CacheVersionConflictResolver conflictResolver() {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictResolverManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictResolverManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictResolverManager.java
new file mode 100644
index 0000000..2f6aacd
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOsConflictResolverManager.java
@@ -0,0 +1,58 @@
+/*
+ * 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.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.version.*;
+
+/**
+ * OS conflict resolver manager.
+ */
+public class CacheOsConflictResolverManager<K ,V> implements 
CacheConflictResolverManager<K, V> {
+    /**
+     * @return Cache conflict resolver.
+     */
+    @Override public CacheVersionConflictResolver conflictResolver() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(GridCacheContext<K, V> cctx) throws 
IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onKernalStart() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onKernalStop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void printMemoryStats() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/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 9dfb356..d56214e 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
@@ -136,7 +136,7 @@ public class GridCacheContext<K, V> implements 
Externalizable {
     private CacheJtaManagerAdapter jtaMgr;
 
     /** Conflict resolver manager. */
-    private CacheConflictManager rslvrMgr;
+    private CacheConflictResolverManager rslvrMgr;
 
     /** Managers. */
     private List<GridCacheManager<K, V>> mgrs = new LinkedList<>();
@@ -247,7 +247,7 @@ public class GridCacheContext<K, V> implements 
Externalizable {
         GridCacheTtlManager ttlMgr,
         GridCacheDrManager drMgr,
         CacheJtaManagerAdapter jtaMgr,
-        CacheConflictManager<K, V> rslvrMgr) {
+        CacheConflictResolverManager<K, V> rslvrMgr) {
         assert ctx != null;
         assert sharedCtx != null;
         assert cacheCfg != null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/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 cadeb3c..41ff94e 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
@@ -1014,7 +1014,7 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
         CacheDataStructuresManager dataStructuresMgr = new 
CacheDataStructuresManager();
         GridCacheTtlManager ttlMgr = new GridCacheTtlManager();
         GridCacheDrManager drMgr = 
ctx.createComponent(GridCacheDrManager.class);
-        CacheConflictManager rslvrMgr = 
ctx.createComponent(CacheConflictManager.class);
+        CacheConflictResolverManager rslvrMgr = 
ctx.createComponent(CacheConflictResolverManager.class);
 
         GridCacheStoreManager storeMgr = new GridCacheStoreManager(ctx, 
sesHolders, cfgStore, cfg);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridOsCacheDrManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridOsCacheDrManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridOsCacheDrManager.java
new file mode 100644
index 0000000..00ed020
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridOsCacheDrManager.java
@@ -0,0 +1,106 @@
+/*
+ * 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.dr;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.dr.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.processors.dr.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * No-op implementation for {@link GridCacheDrManager}.
+ */
+public class GridOsCacheDrManager implements GridCacheDrManager {
+    /** {@inheritDoc} */
+    @Override public boolean enabled() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void start(GridCacheContext cctx) throws 
IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onKernalStart() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onKernalStop(boolean cancel) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void printMemoryStats() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte dataCenterId() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void replicate(KeyCacheObject key,
+        @Nullable CacheObject val,
+        long ttl,
+        long expireTime,
+        GridCacheVersion ver,
+        GridDrType drType) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void beforeExchange(AffinityTopologyVersion topVer, 
boolean left) throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void partitionEvicted(int part) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onReceiveCacheEntriesReceived(int entriesCnt) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onReceiveCacheConflictResolved(boolean useNew, 
boolean useOld, boolean merge) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void resetMetrics() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean receiveEnabled() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/os/GridOsCacheDrManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/os/GridOsCacheDrManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/os/GridOsCacheDrManager.java
deleted file mode 100644
index 1bfb6fc..0000000
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/os/GridOsCacheDrManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.dr.os;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.affinity.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.dr.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.processors.dr.*;
-import org.jetbrains.annotations.*;
-
-/**
- * No-op implementation for {@link GridCacheDrManager}.
- */
-public class GridOsCacheDrManager implements GridCacheDrManager {
-    /** {@inheritDoc} */
-    @Override public boolean enabled() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void start(GridCacheContext cctx) throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop(boolean cancel) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onKernalStart() throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onKernalStop(boolean cancel) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void printMemoryStats() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte dataCenterId() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void replicate(KeyCacheObject key,
-        @Nullable CacheObject val,
-        long ttl,
-        long expireTime,
-        GridCacheVersion ver,
-        GridDrType drType) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void beforeExchange(AffinityTopologyVersion topVer, 
boolean left) throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void partitionEvicted(int part) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onReceiveCacheEntriesReceived(int entriesCnt) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onReceiveCacheConflictResolved(boolean useNew, 
boolean useOld, boolean merge) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void resetMetrics() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean receiveEnabled() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
index a18eedd..f570634 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
@@ -18,12 +18,11 @@
 package org.apache.ignite.internal.processors.cache.version;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.*;
 
 /**
  * Cache version conflict resolver.
  */
-public class CacheVersionConflictResolver {
+public interface CacheVersionConflictResolver {
     /**
      * Resolve the conflict.
      *
@@ -33,53 +32,8 @@ public class CacheVersionConflictResolver {
      * @return Conflict resolution context.
      * @throws IgniteCheckedException If failed.
      */
-    public <K, V> GridCacheVersionConflictContext<K, V> 
resolve(GridCacheVersionedEntryEx<K, V> oldEntry,
-        GridCacheVersionedEntryEx<K, V> newEntry, boolean atomicVerComparator) 
throws IgniteCheckedException {
-        GridCacheVersionConflictContext<K, V> ctx = new 
GridCacheVersionConflictContext<>(oldEntry, newEntry);
-
-        resolve0(ctx, oldEntry, newEntry, atomicVerComparator);
-
-        return ctx;
-    }
-
-    /**
-     * Internal conflict resolution routine.
-     *
-     * @param ctx Context.
-     * @param oldEntry Old entry.
-     * @param newEntry New entry.
-     * @param atomicVerComparator Whether to use atomic version comparator.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected <K, V> void resolve0(GridCacheVersionConflictContext<K, V> ctx,
-        GridCacheVersionedEntryEx<K, V> oldEntry, GridCacheVersionedEntryEx<K, 
V> newEntry,
-        boolean atomicVerComparator) throws IgniteCheckedException {
-        if (newEntry.dataCenterId() != oldEntry.dataCenterId())
-            ctx.useNew();
-        else {
-            if (oldEntry.isStartVersion())
-                ctx.useNew();
-            else {
-                if (atomicVerComparator) {
-                    // Handle special case when version check using ATOMIC 
cache comparator is required.
-                    if 
(GridCacheMapEntry.ATOMIC_VER_COMPARATOR.compare(oldEntry.version(), 
newEntry.version(), false) >= 0)
-                        ctx.useOld();
-                    else
-                        ctx.useNew();
-                }
-                else {
-                    long topVerDiff = newEntry.topologyVersion() - 
oldEntry.topologyVersion();
-
-                    if (topVerDiff > 0)
-                        ctx.useNew();
-                    else if (topVerDiff < 0)
-                        ctx.useOld();
-                    else if (newEntry.order() > oldEntry.order())
-                        ctx.useNew();
-                    else
-                        ctx.useOld();
-                }
-            }
-        }
-    }
+    public <K, V> GridCacheVersionConflictContext<K, V> resolve(
+        GridCacheVersionedEntryEx<K, V> oldEntry,
+        GridCacheVersionedEntryEx<K, V> newEntry,
+        boolean atomicVerComparator) throws IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolverImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolverImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolverImpl.java
new file mode 100644
index 0000000..175a451
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolverImpl.java
@@ -0,0 +1,82 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Cache version conflict resolver.
+ */
+public class CacheVersionConflictResolverImpl implements 
CacheVersionConflictResolver {
+    /** {@inheritDoc} */
+    @Override public <K, V> GridCacheVersionConflictContext<K, V> resolve(
+        GridCacheVersionedEntryEx<K, V> oldEntry,
+        GridCacheVersionedEntryEx<K, V> newEntry,
+        boolean atomicVerComparator) throws IgniteCheckedException {
+        GridCacheVersionConflictContext<K, V> ctx = new 
GridCacheVersionConflictContext<>(oldEntry, newEntry);
+
+        resolve0(ctx, oldEntry, newEntry, atomicVerComparator);
+
+        return ctx;
+    }
+
+    /**
+     * Internal conflict resolution routine.
+     *
+     * @param ctx Context.
+     * @param oldEntry Old entry.
+     * @param newEntry New entry.
+     * @param atomicVerComparator Whether to use atomic version comparator.
+     * @throws IgniteCheckedException If failed.
+     */
+    protected <K, V> void resolve0(
+        GridCacheVersionConflictContext<K, V> ctx,
+        GridCacheVersionedEntryEx<K, V> oldEntry,
+        GridCacheVersionedEntryEx<K, V> newEntry,
+        boolean atomicVerComparator) throws IgniteCheckedException {
+        if (newEntry.dataCenterId() != oldEntry.dataCenterId())
+            ctx.useNew();
+        else {
+            if (oldEntry.isStartVersion())
+                ctx.useNew();
+            else {
+                if (atomicVerComparator) {
+                    // Handle special case when version check using ATOMIC 
cache comparator is required.
+                    if 
(GridCacheMapEntry.ATOMIC_VER_COMPARATOR.compare(oldEntry.version(),
+                        newEntry.version(), false) >= 0)
+                        ctx.useOld();
+                    else
+                        ctx.useNew();
+                }
+                else {
+                    long topVerDiff = newEntry.topologyVersion() - 
oldEntry.topologyVersion();
+
+                    if (topVerDiff > 0)
+                        ctx.useNew();
+                    else if (topVerDiff < 0)
+                        ctx.useOld();
+                    else if (newEntry.order() > oldEntry.order())
+                        ctx.useNew();
+                    else
+                        ctx.useOld();
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/67b7ffd9/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 b96707d..b34e6e6 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
@@ -21,7 +21,7 @@ import org.apache.ignite.cache.store.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.datastructures.*;
-import org.apache.ignite.internal.processors.cache.dr.os.*;
+import org.apache.ignite.internal.processors.cache.dr.GridOsCacheDrManager;
 import org.apache.ignite.internal.processors.cache.jta.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.cache.query.continuous.*;
@@ -70,6 +70,6 @@ public class GridCacheTestContext<K, V> extends 
GridCacheContext<K, V> {
             new GridCacheTtlManager(),
             new GridOsCacheDrManager(),
             new CacheNoopJtaManager(),
-            new CacheOsConflictManager<K, V>());
+            new CacheOsConflictResolverManager<K, V>());
     }
 }

Reply via email to