ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [35/50] [abbrv] incubator-ignite git commit: # ignite-283: Minor refactorings.
Date Wed, 18 Feb 2015 15:43:56 GMT
# ignite-283: Minor refactorings.


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

Branch: refs/heads/ignite-224
Commit: e3d563ba201d8d05fe760d31c1b92173a53d80a0
Parents: eb2b178
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Feb 18 13:15:09 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Feb 18 13:15:09 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |  4 +-
 .../processors/cache/GridCacheEntryEx.java      | 16 +++---
 .../processors/cache/GridCacheMapEntry.java     | 52 ++++++++++----------
 .../GridDistributedTxRemoteAdapter.java         |  3 +-
 .../processors/cache/dr/GridCacheDrInfo.java    |  5 +-
 .../transactions/IgniteTxLocalAdapter.java      |  2 +-
 .../dataload/IgniteDataLoaderImpl.java          |  3 +-
 .../processors/cache/GridCacheTestEntryEx.java  |  8 +--
 8 files changed, 46 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/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 e5cc9c3..f80e3a5 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
@@ -1572,11 +1572,9 @@ public class GridCacheContext<K, V> implements Externalizable
{
     /**
      * Check whether conflict resolution is required.
      *
-     * @param oldVer Old version.
-     * @param newVer New version.
      * @return {@code True} in case DR is required.
      */
-    public boolean conflictNeedResolve(GridCacheVersion oldVer, GridCacheVersion newVer)
{
+    public boolean conflictNeedResolve() {
         return conflictRslvr != null;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index f044347..1ffed64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -423,10 +423,10 @@ public interface GridCacheEntryEx<K, V> {
      *      greater than passed in.
      * @param filter Optional filter to check.
      * @param drType DR type.
-     * @param drTtl DR TTL (if any).
-     * @param drExpireTime DR expire time (if any).
-     * @param drVer DR version (if any).
-     * @param drResolve If {@code true} then performs DR conflicts resolution.
+     * @param conflictTtl Conflict TTL (if any).
+     * @param conflictExpireTime Conflict expire time (if any).
+     * @param conflictVer DR version (if any).
+     * @param conflictResolve If {@code true} then performs conflicts resolution.
      * @param intercept If {@code true} then calls cache interceptor.
      * @param subjId Subject ID initiated this update.
      * @param taskName Task name.
@@ -455,10 +455,10 @@ public interface GridCacheEntryEx<K, V> {
         boolean checkVer,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter,
         GridDrType drType,
-        long drTtl,
-        long drExpireTime,
-        @Nullable GridCacheVersion drVer,
-        boolean drResolve,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean conflictResolve,
         boolean intercept,
         @Nullable UUID subjId,
         String taskName

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/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 dcdc0d9..60a80fd 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
@@ -1569,10 +1569,10 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
         boolean verCheck,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter,
         GridDrType drType,
-        long drTtl,
-        long drExpireTime,
-        @Nullable GridCacheVersion drVer,
-        boolean drResolve,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean conflictResolve,
         boolean intercept,
         @Nullable UUID subjId,
         String taskName
@@ -1606,10 +1606,10 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
 
             Object transformClo = null;
 
-            if (drResolve) {
+            if (conflictResolve) {
                 GridCacheVersion oldDrVer = version().conflictVersion();
 
-                boolean drNeedResolve = cctx.conflictNeedResolve(oldDrVer, drVer);
+                boolean drNeedResolve = cctx.conflictNeedResolve();
 
                 if (drNeedResolve) {
                     // Get old value.
@@ -1626,12 +1626,12 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
 
                     K k = key();
 
-                    if (drTtl >= 0L) {
+                    if (conflictTtl >= 0L) {
                         // DR TTL is set explicitly
-                        assert drExpireTime >= 0L;
+                        assert conflictExpireTime >= 0L;
 
-                        newTtl = drTtl;
-                        newExpireTime = drExpireTime;
+                        newTtl = conflictTtl;
+                        newExpireTime = conflictExpireTime;
                     }
                     else {
                         long ttl = expiryPlc != null ? (isNew() ? expiryPlc.forCreate() :
expiryPlc.forUpdate()) : -1L;
@@ -1642,7 +1642,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
 
                     GridCacheVersionedEntryEx<K, V> oldEntry = versionedEntry();
                     GridCacheVersionedEntryEx<K, V> newEntry =
-                        new GridCachePlainVersionedEntry<>(k, (V)writeObj, newTtl,
newExpireTime, drVer);
+                        new GridCachePlainVersionedEntry<>(k, (V)writeObj, newTtl,
newExpireTime, conflictVer);
 
                     drRes = cctx.conflictResolve(oldEntry, newEntry, verCheck);
 
@@ -1650,12 +1650,12 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
 
                     if (drRes.isUseOld()) {
                         // Handle special case with atomic comparator.
-                        if (!isNew() &&                                         
  // Not initial value,
-                            verCheck &&                                         
  // and atomic version check,
-                            oldDrVer.dataCenterId() == drVer.dataCenterId() &&  
  // and data centers are equal,
-                            ATOMIC_VER_COMPARATOR.compare(oldDrVer, drVer) == 0 &&
// and both versions are equal,
-                            cctx.writeThrough() &&                              
  // and store is enabled,
-                            primary)                                               // and
we are primary.
+                        if (!isNew() &&                                         
        // Not initial value,
+                            verCheck &&                                         
        // and atomic version check,
+                            oldDrVer.dataCenterId() == conflictVer.dataCenterId() &&
    // and data centers are equal,
+                            ATOMIC_VER_COMPARATOR.compare(oldDrVer, conflictVer) == 0 &&
// and both versions are equal,
+                            cctx.writeThrough() &&                              
        // and store is enabled,
+                            primary)                                                    
// and we are primary.
                         {
                             V val = rawGetOrUnmarshalUnlocked(false);
 
@@ -1688,7 +1688,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                         writeObj = drRes.mergeValue();
                         valBytes = null;
 
-                        drVer = null; // Update will be considered as local.
+                        conflictVer = null; // Update will be considered as local.
 
                         op = writeObj != null ? GridCacheOperation.UPDATE : GridCacheOperation.DELETE;
                     }
@@ -1705,7 +1705,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 }
                 else
                     // Nullify DR version on this update, so that we will use regular version
during next updates.
-                    drVer = null;
+                    conflictVer = null;
             }
 
             if (drRes == null) { // Perform version check only in case there will be no explicit
conflict resolution.
@@ -1891,13 +1891,13 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
             boolean hadVal = hasValueUnlocked();
 
             // Incorporate DR version into new version if needed.
-            if (drVer != null && drVer != newVer)
+            if (conflictVer != null && conflictVer != newVer)
                 newVer = new GridCacheVersionEx(newVer.topologyVersion(),
                     newVer.globalTime(),
                     newVer.order(),
                     newVer.nodeOrder(),
                     newVer.dataCenterId(),
-                    drVer);
+                    conflictVer);
 
             IgniteBiTuple<Boolean, V> interceptRes = null;
 
@@ -1906,14 +1906,14 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
             if (op == GridCacheOperation.UPDATE) {
                 if (drRes == null) {
                     // Calculate TTL and expire time for local update.
-                    if (drTtl >= 0L) {
-                        assert drExpireTime >= 0L : drExpireTime;
+                    if (conflictTtl >= 0L) {
+                        assert conflictExpireTime >= 0L : conflictExpireTime;
 
-                        ttl0 = drTtl;
-                        newExpireTime = drExpireTime;
+                        ttl0 = conflictTtl;
+                        newExpireTime = conflictExpireTime;
                     }
                     else {
-                        assert drExpireTime == CU.TTL_NOT_CHANGED : drExpireTime;
+                        assert conflictExpireTime == CU.TTL_NOT_CHANGED : conflictExpireTime;
 
                         if (expiryPlc != null)
                             newTtl = hadVal ? expiryPlc.forUpdate() : expiryPlc.forCreate();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/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 0513cc7..a266bc6 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
@@ -510,8 +510,7 @@ public class GridDistributedTxRemoteAdapter<K, V> extends IgniteTxAdapter<K,
V>
                                         op = DELETE;
 
 
-                                    boolean drNeedResolve =
-                                        cacheCtx.conflictNeedResolve(cached.version(), explicitVer);
+                                    boolean drNeedResolve = cacheCtx.conflictNeedResolve();
 
                                         if (drNeedResolve) {
                                             IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K,
V>>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridCacheDrInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridCacheDrInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridCacheDrInfo.java
index 0ab7f67..6c875d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridCacheDrInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/dr/GridCacheDrInfo.java
@@ -74,14 +74,14 @@ public class GridCacheDrInfo<V> implements Externalizable {
      * @return TTL.
      */
     public long ttl() {
-        return 0L;
+        return CU.TTL_ETERNAL;
     }
 
     /**
      * @return Expire time.
      */
     public long expireTime() {
-        return 0L;
+        return CU.EXPIRE_TIME_ETERNAL;
     }
 
     /** {@inheritDoc} */
@@ -96,6 +96,7 @@ public class GridCacheDrInfo<V> implements Externalizable {
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
         val = (V)in.readObject();
         ver = CU.readVersion(in);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/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 8ffe224..2fd8d18 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
@@ -766,7 +766,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K,
V>
                                         }
                                     }
 
-                                    boolean drNeedResolve = cacheCtx.conflictNeedResolve(cached.version(),
explicitVer);
+                                    boolean drNeedResolve = cacheCtx.conflictNeedResolve();
 
                                     if (drNeedResolve) {
                                         IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K,
V>>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
index 05799fe..10ccfd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
@@ -1419,7 +1419,8 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K,
V>, Delay
 
                     entry.unswap(true, false);
 
-                    entry.initialValue(val, null, ver, 0, 0, false, topVer, GridDrType.DR_LOAD);
+                    entry.initialValue(val, null, ver, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL,
false, topVer,
+                        GridDrType.DR_LOAD);
 
                     cctx.evicts().touch(entry, topVer);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3d563ba/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 17d0bfc..b5e226f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -478,10 +478,10 @@ public class GridCacheTestEntryEx<K, V> extends GridMetadataAwareAdapter
impleme
         boolean checkVer,
         @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter,
         GridDrType drType,
-        long drTtl,
-        long drExpireTime,
-        @Nullable GridCacheVersion drVer,
-        boolean drResolve,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
+        boolean conflictResolve,
         boolean intercept,
         UUID subjId,
         String taskName) throws IgniteCheckedException,


Mime
View raw message