ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject incubator-ignite git commit: # IGNITE-200: Removed cache versioned entry.
Date Tue, 10 Feb 2015 12:25:48 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/sprint-1 4e60207b2 -> d70e59f08


# IGNITE-200: Removed cache versioned entry.


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

Branch: refs/heads/sprint-1
Commit: d70e59f0867306f48859763444c10315dabca0c0
Parents: 4e60207
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Feb 10 15:15:26 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Feb 10 15:15:26 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |   4 +-
 .../processors/cache/GridCacheMapEntry.java     |   2 +-
 .../cache/GridCacheUpdateAtomicResult.java      |   6 +-
 .../GridDistributedTxRemoteAdapter.java         |   4 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   4 +-
 .../cache/transactions/IgniteTxAdapter.java     |   6 +-
 .../transactions/IgniteTxLocalAdapter.java      |   4 +-
 ...ridCacheVersionAbstractConflictResolver.java |   6 +-
 .../GridCacheVersionConflictContext.java        | 166 +++++++++++++++-
 .../GridCacheVersionConflictContextImpl.java    | 187 -------------------
 .../GridCacheVersionConflictResolver.java       |   2 +-
 11 files changed, 175 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/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 21e572d..8fe80e3 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
@@ -1581,11 +1581,11 @@ public class GridCacheContext<K, V> implements Externalizable
{
      * @return Conflict resolution result.
      * @throws IgniteCheckedException In case of exception.
      */
-    public GridCacheVersionConflictContextImpl<K, V> conflictResolve(GridCacheVersionedEntryEx<K,
V> oldEntry,
+    public GridCacheVersionConflictContext<K, V> conflictResolve(GridCacheVersionedEntryEx<K,
V> oldEntry,
         GridCacheVersionedEntryEx<K, V> newEntry, boolean atomicVerComparator) throws
IgniteCheckedException {
         assert conflictRslvr != null : "Should not reach this place.";
 
-        GridCacheVersionConflictContextImpl<K, V> ctx = conflictRslvr.resolve(oldEntry,
newEntry, atomicVerComparator);
+        GridCacheVersionConflictContext<K, V> ctx = conflictRslvr.resolve(oldEntry,
newEntry, atomicVerComparator);
 
         if (ctx.isManualResolve())
             drMgr.onReceiveCacheConflictResolved(ctx.isUseNew(), ctx.isUseOld(), ctx.isMerge());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index d57648b..ca7b740 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -1657,7 +1657,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
 
         GridCacheVersion enqueueVer = null;
 
-        GridCacheVersionConflictContextImpl<K, V> drRes = null;
+        GridCacheVersionConflictContext<K, V> drRes = null;
 
         EntryProcessorResult<?> invokeRes = null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUpdateAtomicResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUpdateAtomicResult.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUpdateAtomicResult.java
index 16ab38d..cabfaa5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUpdateAtomicResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUpdateAtomicResult.java
@@ -51,7 +51,7 @@ public class GridCacheUpdateAtomicResult<K, V> {
 
     /** DR resolution result. */
     @GridToStringInclude
-    private final GridCacheVersionConflictContextImpl<K, V> drRes;
+    private final GridCacheVersionConflictContext<K, V> drRes;
 
     /** Whether update should be propagated to DHT node. */
     private final boolean sndToDht;
@@ -79,7 +79,7 @@ public class GridCacheUpdateAtomicResult<K, V> {
         long newTtl,
         long drExpireTime,
         @Nullable GridCacheVersion rmvVer,
-        @Nullable GridCacheVersionConflictContextImpl<K, V> drRes,
+        @Nullable GridCacheVersionConflictContext<K, V> drRes,
         boolean sndToDht) {
         this.success = success;
         this.oldVal = oldVal;
@@ -144,7 +144,7 @@ public class GridCacheUpdateAtomicResult<K, V> {
     /**
      * @return DR conflict resolution context.
      */
-    @Nullable public GridCacheVersionConflictContextImpl<K, V> drResolveResult() {
+    @Nullable public GridCacheVersionConflictContext<K, V> drResolveResult() {
         return drRes;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index 3807cc9..be65c00 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -514,13 +514,13 @@ public class GridDistributedTxRemoteAdapter<K, V> extends IgniteTxAdapter<K,
V>
                                             cacheCtx.conflictNeedResolve(cached.version(),
explicitVer);
 
                                         if (drNeedResolve) {
-                                            IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContextImpl<K,
V>>
+                                            IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K,
V>>
                                                 drRes = conflictResolve(op, txEntry.key(),
val, valBytes,
                                                 txEntry.ttl(), txEntry.drExpireTime(), explicitVer,
cached);
 
                                             assert drRes != null;
 
-                                            GridCacheVersionConflictContextImpl<K, V>
drCtx = drRes.get2();
+                                            GridCacheVersionConflictContext<K, V> drCtx
= drRes.get2();
 
                                             if (drCtx.isUseOld())
                                                 op = NOOP;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index c757ad2..cf67c15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1709,7 +1709,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
 
                 if (dhtFut != null) {
                     if (updRes.sendToDht()) { // Send to backups even in case of remove-remove
scenarios.
-                        GridCacheVersionConflictContextImpl<K, V> ctx = updRes.drResolveResult();
+                        GridCacheVersionConflictContext<K, V> ctx = updRes.drResolveResult();
 
                         long ttl = updRes.newTtl();
                         long expireTime = updRes.drExpireTime();
@@ -1755,7 +1755,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                 if (hasNear) {
                     if (primary && updRes.sendToDht()) {
                         if (!ctx.affinity().belongs(node, entry.partition(), topVer)) {
-                            GridCacheVersionConflictContextImpl<K, V> ctx = updRes.drResolveResult();
+                            GridCacheVersionConflictContext<K, V> ctx = updRes.drResolveResult();
 
                             long ttl = updRes.newTtl();
                             long expireTime = updRes.drExpireTime();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 01e06ba..eb5e662 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1257,7 +1257,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
      * @throws org.apache.ignite.IgniteCheckedException In case of eny exception.
      * @throws GridCacheEntryRemovedException If entry got removed.
      */
-    protected IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContextImpl<K,
V>> conflictResolve(
+    protected IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K,
V>> conflictResolve(
         GridCacheOperation op, K key, V newVal, byte[] newValBytes, long newTtl, long newDrExpireTime,
         GridCacheVersion newVer, GridCacheEntryEx<K, V> old)
         throws IgniteCheckedException, GridCacheEntryRemovedException {
@@ -1271,9 +1271,9 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         long newExpireTime = newDrExpireTime >= 0L ? newDrExpireTime : CU.toExpireTime(newTtl);
 
         GridCacheVersionedEntryEx<K, V> newEntry =
-            new GridCachePlainVersionedEntry<K, V>(key, newVal, newTtl, newExpireTime,
newVer);
+            new GridCachePlainVersionedEntry<>(key, newVal, newTtl, newExpireTime,
newVer);
 
-        GridCacheVersionConflictContextImpl<K, V> ctx = old.context().conflictResolve(oldEntry,
newEntry, false);
+        GridCacheVersionConflictContext<K, V> ctx = old.context().conflictResolve(oldEntry,
newEntry, false);
 
         if (ctx.isMerge()) {
             V resVal = ctx.mergeValue();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 71eda97..f985753 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -737,13 +737,13 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K,
V>
                                     boolean drNeedResolve = cacheCtx.conflictNeedResolve(cached.version(),
explicitVer);
 
                                     if (drNeedResolve) {
-                                        IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContextImpl<K,
V>>
+                                        IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K,
V>>
                                             drRes = conflictResolve(op, txEntry.key(), val,
valBytes, txEntry.ttl(),
                                                 txEntry.drExpireTime(), explicitVer, cached);
 
                                         assert drRes != null;
 
-                                        GridCacheVersionConflictContextImpl<K, V> conflictCtx
= drRes.get2();
+                                        GridCacheVersionConflictContext<K, V> conflictCtx
= drRes.get2();
 
                                         if (conflictCtx.isUseOld())
                                             op = NOOP;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAbstractConflictResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAbstractConflictResolver.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAbstractConflictResolver.java
index a91bd4d..8bc6425 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAbstractConflictResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAbstractConflictResolver.java
@@ -32,9 +32,9 @@ public abstract class GridCacheVersionAbstractConflictResolver {
      * @return Conflict resolution context.
      * @throws IgniteCheckedException If failed.
      */
-    public <K, V> GridCacheVersionConflictContextImpl<K, V> resolve(GridCacheVersionedEntryEx<K,
V> oldEntry,
+    public <K, V> GridCacheVersionConflictContext<K, V> resolve(GridCacheVersionedEntryEx<K,
V> oldEntry,
         GridCacheVersionedEntryEx<K, V> newEntry, boolean atomicVerComparator) throws
IgniteCheckedException {
-        GridCacheVersionConflictContextImpl<K, V> ctx = new GridCacheVersionConflictContextImpl<>(oldEntry,
newEntry);
+        GridCacheVersionConflictContext<K, V> ctx = new GridCacheVersionConflictContext<>(oldEntry,
newEntry);
 
         resolve0(ctx, oldEntry, newEntry, atomicVerComparator);
 
@@ -50,7 +50,7 @@ public abstract class GridCacheVersionAbstractConflictResolver {
      * @param atomicVerComparator Whether to use atomic version comparator.
      * @throws IgniteCheckedException If failed.
      */
-    protected abstract <K, V> void resolve0(GridCacheVersionConflictContextImpl<K,
V> ctx,
+    protected abstract <K, V> void resolve0(GridCacheVersionConflictContext<K, V>
ctx,
         GridCacheVersionedEntryEx<K, V> oldEntry, GridCacheVersionedEntryEx<K, V>
newEntry,
         boolean atomicVerComparator) throws IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
index 72c323b..ab690e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
@@ -17,38 +17,87 @@
 
 package org.apache.ignite.internal.processors.cache.version;
 
-import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
 
 /**
- * Cache version conflict context.
+ * Conflict context implementation.
  */
-public interface GridCacheVersionConflictContext<K, V> {
+public class GridCacheVersionConflictContext<K, V> {
+    /** Old entry. */
+    @GridToStringInclude
+    private final GridCacheVersionedEntry<K, V> oldEntry;
+
+    /** New entry. */
+    @GridToStringInclude
+    private final GridCacheVersionedEntry<K, V> newEntry;
+
+    /** Current state. */
+    private State state;
+
+    /** Current merge value. */
+    @GridToStringExclude
+    private V mergeVal;
+
+    /** TTL. */
+    private long ttl;
+
+    /** Explicit TTL flag. */
+    private boolean explicitTtl;
+
+    /** Manual resolve flag. */
+    private boolean manualResolve;
+
+    /**
+     * Constructor.
+     *
+     * @param oldEntry Old entry.
+     * @param newEntry New entry.
+     */
+    public GridCacheVersionConflictContext(GridCacheVersionedEntry<K, V> oldEntry,
+        GridCacheVersionedEntry<K, V> newEntry) {
+        assert oldEntry != null && newEntry != null;
+        assert oldEntry.ttl() >= 0 && newEntry.ttl() >= 0;
+
+        this.oldEntry = oldEntry;
+        this.newEntry = newEntry;
+
+        // Set initial state.
+        useNew();
+    }
+
     /**
      * Gets old (existing) cache entry.
      *
      * @return Old (existing) cache entry.
      */
-    public GridCacheVersionedEntry<K, V> oldEntry();
+    public GridCacheVersionedEntry<K, V> oldEntry() {
+        return oldEntry;
+    }
 
     /**
      * Gets new cache entry.
      *
      * @return New cache entry.
      */
-    public GridCacheVersionedEntry<K, V> newEntry();
+    public GridCacheVersionedEntry<K, V> newEntry() {
+        return newEntry;
+    }
 
     /**
      * Force cache to ignore new entry and leave old (existing) entry unchanged.
      */
-    public void useOld();
+    public void useOld() {
+        state = State.USE_OLD;
+    }
 
     /**
      * Force cache to apply new entry overwriting old (existing) entry.
      * <p>
      * Note that updates from remote data centers always have explicit TTL , while local
data center
-     * updates will only have explicit TTL in case {@link CacheEntry#timeToLive(long)} was
called
-     * before update. In the latter case new entry will pick TTL of the old (existing) entry,
even
+     * updates will only have explicit TTL in case {@link org.apache.ignite.cache.CacheEntry#timeToLive(long)}
was
+     * called before update. In the latter case new entry will pick TTL of the old (existing)
entry, even
      * if it was set through update from remote data center. it means that depending on concurrent
      * update timings new update might pick unexpected TTL. For example, consider that three
updates
      * of the same key are performed: local update with explicit TTL (1) followed by another
local
@@ -58,7 +107,12 @@ public interface GridCacheVersionConflictContext<K, V> {
      * update (3). To have predictable TTL in such cases you should either always set it
explicitly
      * through {@code GridCacheEntry.timeToLive(long)} or use {@link #merge(Object, long)}.
      */
-    public void useNew();
+    public void useNew() {
+        state = State.USE_NEW;
+
+        if (!explicitTtl)
+            ttl = newEntry.ttl();
+    }
 
     /**
      * Force cache to use neither old, nor new, but some other value passed as argument.
In this case old
@@ -69,5 +123,97 @@ public interface GridCacheVersionConflictContext<K, V> {
      * @param mergeVal Merge value or {@code null} to force remove.
      * @param ttl Time to live in milliseconds.
      */
-    public void merge(@Nullable V mergeVal, long ttl);
+    public void merge(@Nullable V mergeVal, long ttl) {
+        state = State.MERGE;
+
+        this.mergeVal = mergeVal;
+        this.ttl = ttl;
+
+        explicitTtl = true;
+    }
+
+    /**
+     * @return {@code True} in case old value should be used.
+     */
+    public boolean isUseOld() {
+        return state == State.USE_OLD;
+    }
+
+    /**
+     * @return {@code True} in case new value should be used.
+     */
+    public boolean isUseNew() {
+        return state == State.USE_NEW;
+    }
+
+    /**
+     * @return {@code True} in case merge is to be performed.
+     */
+    public boolean isMerge() {
+        return state == State.MERGE;
+    }
+
+    /**
+     * Set manual resolve class.
+     */
+    public void manualResolve() {
+        this.manualResolve = true;
+    }
+
+    /**
+     * @return Manual resolve flag.
+     */
+    public boolean isManualResolve() {
+        return manualResolve;
+    }
+
+    /**
+     * @return Value to merge (if any).
+     */
+    @Nullable public V mergeValue() {
+        return mergeVal;
+    }
+
+    /**
+     * @return TTL.
+     */
+    public long ttl() {
+        return ttl;
+    }
+
+    /**
+     * @return Expire time.
+     */
+    public long expireTime() {
+        return explicitTtl ? CU.toExpireTime(ttl) : isUseNew() ? newEntry.expireTime() :
+            isUseOld() ? oldEntry.expireTime() : 0L;
+    }
+
+    /**
+     * @return Explicit TTL flag.
+     */
+    public boolean explicitTtl() {
+        return explicitTtl;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return state == State.MERGE ?
+            S.toString(GridCacheVersionConflictContext.class, this, "mergeValue", mergeVal)
:
+            S.toString(GridCacheVersionConflictContext.class, this);
+    }
+
+    /**
+     * State.
+     */
+    private enum State {
+        /** Use old. */
+        USE_OLD,
+
+        /** Use new. */
+        USE_NEW,
+
+        /** Merge. */
+        MERGE
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContextImpl.java
deleted file mode 100644
index ed901ec..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContextImpl.java
+++ /dev/null
@@ -1,187 +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.version;
-
-import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Conflict context implementation.
- */
-public class GridCacheVersionConflictContextImpl<K, V> implements GridCacheVersionConflictContext<K,
V> {
-    /** Old entry. */
-    @GridToStringInclude
-    private final GridCacheVersionedEntry<K, V> oldEntry;
-
-    /** New entry. */
-    @GridToStringInclude
-    private final GridCacheVersionedEntry<K, V> newEntry;
-
-    /** Current state. */
-    private State state;
-
-    /** Current merge value. */
-    @GridToStringExclude
-    private V mergeVal;
-
-    /** TTL. */
-    private long ttl;
-
-    /** Explicit TTL flag. */
-    private boolean explicitTtl;
-
-    /** Manual resolve flag. */
-    private boolean manualResolve;
-
-    /**
-     * Constructor.
-     *
-     * @param oldEntry Old entry.
-     * @param newEntry New entry.
-     */
-    public GridCacheVersionConflictContextImpl(GridCacheVersionedEntry<K, V> oldEntry,
-        GridCacheVersionedEntry<K, V> newEntry) {
-        assert oldEntry != null && newEntry != null;
-        assert oldEntry.ttl() >= 0 && newEntry.ttl() >= 0;
-
-        this.oldEntry = oldEntry;
-        this.newEntry = newEntry;
-
-        // Set initial state.
-        useNew();
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersionedEntry<K, V> oldEntry() {
-        return oldEntry;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersionedEntry<K, V> newEntry() {
-        return newEntry;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void useOld() {
-        state = State.USE_OLD;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void useNew() {
-        state = State.USE_NEW;
-
-        if (!explicitTtl)
-            ttl = newEntry.ttl();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void merge(@Nullable V mergeVal, long ttl) {
-        state = State.MERGE;
-
-        this.mergeVal = mergeVal;
-        this.ttl = ttl;
-
-        explicitTtl = true;
-    }
-
-    /**
-     * @return {@code True} in case old value should be used.
-     */
-    public boolean isUseOld() {
-        return state == State.USE_OLD;
-    }
-
-    /**
-     * @return {@code True} in case new value should be used.
-     */
-    public boolean isUseNew() {
-        return state == State.USE_NEW;
-    }
-
-    /**
-     * @return {@code True} in case merge is to be performed.
-     */
-    public boolean isMerge() {
-        return state == State.MERGE;
-    }
-
-    /**
-     * Set manual resolve class.
-     */
-    public void manualResolve() {
-        this.manualResolve = true;
-    }
-
-    /**
-     * @return Manual resolve flag.
-     */
-    public boolean isManualResolve() {
-        return manualResolve;
-    }
-
-    /**
-     * @return Value to merge (if any).
-     */
-    @Nullable public V mergeValue() {
-        return mergeVal;
-    }
-
-    /**
-     * @return TTL.
-     */
-    public long ttl() {
-        return ttl;
-    }
-
-    /**
-     * @return Expire time.
-     */
-    public long expireTime() {
-        return explicitTtl ? CU.toExpireTime(ttl) : isUseNew() ? newEntry.expireTime() :
-            isUseOld() ? oldEntry.expireTime() : 0L;
-    }
-
-    /**
-     * @return Explicit TTL flag.
-     */
-    public boolean explicitTtl() {
-        return explicitTtl;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return state == State.MERGE ?
-            S.toString(GridCacheVersionConflictContextImpl.class, this, "mergeValue", mergeVal)
:
-            S.toString(GridCacheVersionConflictContextImpl.class, this);
-    }
-
-    /**
-     * State.
-     */
-    private enum State {
-        /** Use old. */
-        USE_OLD,
-
-        /** Use new. */
-        USE_NEW,
-
-        /** Merge. */
-        MERGE
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d70e59f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictResolver.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictResolver.java
index e327fb9..869993c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictResolver.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.processors.cache.*;
  */
 public class GridCacheVersionConflictResolver extends GridCacheVersionAbstractConflictResolver
{
     /** {@inheritDoc} */
-    @Override protected <K, V> void resolve0(GridCacheVersionConflictContextImpl<K,
V> ctx,
+    @Override 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())


Mime
View raw message