ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [12/15] incubator-ignite git commit: # Refactoring: minor method name changes.
Date Wed, 18 Feb 2015 14:55:01 GMT
# Refactoring: minor method name changes.


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

Branch: refs/heads/ignite-gg-9809
Commit: e63056420ee9db197ddcf82aa0cc8389709193d3
Parents: 8ef9b8b
Author: vozerov <vozerov@gridgain.com>
Authored: Wed Feb 18 17:37:44 2015 +0300
Committer: vozerov <vozerov@gridgain.com>
Committed: Wed Feb 18 17:37:44 2015 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          |  24 ++--
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  98 +++++++--------
 .../dht/atomic/GridNearAtomicUpdateRequest.java | 124 +++++++++----------
 3 files changed, 110 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6305642/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 4b04404..48ba518 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
@@ -1646,9 +1646,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                 if (entry == null)
                     continue;
 
-                GridCacheVersion newConflictVer = req.drVersion(i);
-                long newConflictTtl = req.drTtl(i);
-                long newConflictExpireTime = req.drExpireTime(i);
+                GridCacheVersion newConflictVer = req.conflictVersion(i);
+                long newConflictTtl = req.conflictTtl(i);
+                long newConflictExpireTime = req.conflictExpireTime(i);
 
                 assert !(newConflictVer instanceof GridCacheVersionEx) : newConflictVer;
// Plain version is expected here.
 
@@ -1860,7 +1860,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     ) {
         assert putMap == null ^ rmvKeys == null;
 
-        assert req.drVersions() == null : "updatePartialBatch cannot be called when there
are DR entries in the batch.";
+        assert req.conflictVersions() == null : "updatePartialBatch cannot be called when
there are DR entries in the batch.";
 
         long topVer = req.topologyVersion();
 
@@ -2266,7 +2266,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         Collection<GridCacheDrInfo<V>> drPutVals;
         Collection<GridCacheVersion> drRmvVals;
 
-        if (req.drVersions() == null) {
+        if (req.conflictVersions() == null) {
             vals = req.values();
 
             drPutVals = null;
@@ -2278,13 +2278,13 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             drPutVals = new ArrayList<>(size);
 
             for (int i = 0; i < size; i++) {
-                long ttl = req.drTtl(i);
+                long ttl = req.conflictTtl(i);
 
                 if (ttl == -1L)
-                    drPutVals.add(new GridCacheDrInfo<>(req.value(i), req.drVersion(i)));
+                    drPutVals.add(new GridCacheDrInfo<>(req.value(i), req.conflictVersion(i)));
                 else
-                    drPutVals.add(new GridCacheDrExpirationInfo<>(req.value(i), req.drVersion(i),
ttl,
-                        req.drExpireTime(i)));
+                    drPutVals.add(new GridCacheDrExpirationInfo<>(req.value(i), req.conflictVersion(i),
ttl,
+                        req.conflictExpireTime(i)));
             }
 
             vals = null;
@@ -2293,7 +2293,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         else {
             assert req.operation() == DELETE;
 
-            drRmvVals = req.drVersions();
+            drRmvVals = req.conflictVersions();
 
             vals = null;
             drPutVals = null;
@@ -2458,7 +2458,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                                 DELETE;
 
                         long ttl = req.ttl(i);
-                        long expireTime = req.drExpireTime(i);
+                        long expireTime = req.conflictExpireTime(i);
 
                         if (ttl != -1L && expireTime == -1L)
                             expireTime = CU.toExpireTime(ttl);
@@ -2482,7 +2482,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                             replicate ? DR_BACKUP : DR_NONE,
                             ttl,
                             expireTime,
-                            req.drVersion(i),
+                            req.conflictVersion(i),
                             false,
                             intercept,
                             req.subjectId(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6305642/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 7e4413a..f31fdcf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -75,15 +75,15 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
     @GridDirectCollection(GridCacheValueBytes.class)
     private List<GridCacheValueBytes> valBytes;
 
-    /** DR versions. */
+    /** Conflict versions. */
     @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> drVers;
+    private List<GridCacheVersion> conflictVers;
 
     /** TTLs. */
     private GridLongList ttls;
 
-    /** DR expire time. */
-    private GridLongList drExpireTimes;
+    /** Conflict expire time. */
+    private GridLongList conflictExpireTimes;
 
     /** Near TTLs. */
     private GridLongList nearTtls;
@@ -219,8 +219,8 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
      * @param valBytes Value bytes, {@code null} if should be removed.
      * @param entryProcessor Entry processor.
      * @param ttl TTL (optional).
-     * @param drExpireTime DR expire time (optional).
-     * @param drVer DR version (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
      */
     public void addWriteValue(K key,
         @Nullable byte[] keyBytes,
@@ -228,8 +228,8 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
         @Nullable byte[] valBytes,
         EntryProcessor<K, V, ?> entryProcessor,
         long ttl,
-        long drExpireTime,
-        @Nullable GridCacheVersion drVer) {
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer) {
         keys.add(key);
         this.keyBytes.add(keyBytes);
 
@@ -243,43 +243,43 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             this.valBytes.add(valBytes != null ? GridCacheValueBytes.marshaled(valBytes)
: null);
         }
 
-        // In case there is no DR, do not create the list.
-        if (drVer != null) {
-            if (drVers == null) {
-                drVers = new ArrayList<>();
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>();
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    drVers.add(null);
+                    conflictVers.add(null);
             }
 
-            drVers.add(drVer);
+            conflictVers.add(conflictVer);
         }
-        else if (drVers != null)
-            drVers.add(drVer);
+        else if (conflictVers != null)
+            conflictVers.add(null);
 
         if (ttl >= 0) {
             if (ttls == null) {
                 ttls = new GridLongList(keys.size());
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    ttls.add(-1);
+                    ttls.add(CU.TTL_NOT_CHANGED);
             }
         }
 
         if (ttls != null)
             ttls.add(ttl);
 
-        if (drExpireTime >= 0) {
-            if (drExpireTimes == null) {
-                drExpireTimes = new GridLongList(keys.size());
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    drExpireTimes.add(-1);
+                    conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
             }
         }
 
-        if (drExpireTimes != null)
-            drExpireTimes.add(drExpireTime);
+        if (conflictExpireTimes != null)
+            conflictExpireTimes.add(conflictExpireTime);
     }
 
     /**
@@ -331,7 +331,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 nearTtls = new GridLongList(nearKeys.size());
 
                 for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearTtls.add(-1);
+                    nearTtls.add(CU.TTL_NOT_CHANGED);
             }
         }
 
@@ -343,7 +343,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 nearExpireTimes = new GridLongList(nearKeys.size());
 
                 for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearExpireTimes.add(-1);
+                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
             }
         }
 
@@ -549,21 +549,14 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
     }
 
     /**
-     * @return DR versions.
-     */
-    @Nullable public List<GridCacheVersion> drVersions() {
-        return drVers;
-    }
-
-    /**
      * @param idx Index.
-     * @return DR version.
+     * @return Conflict version.
      */
-    @Nullable public GridCacheVersion drVersion(int idx) {
-        if (drVers != null) {
-            assert idx >= 0 && idx < drVers.size();
+    @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
 
-            return drVers.get(idx);
+            return conflictVers.get(idx);
         }
 
         return null;
@@ -580,7 +573,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             return ttls.get(idx);
         }
 
-        return -1L;
+        return CU.TTL_NOT_CHANGED;
     }
 
     /**
@@ -594,28 +587,21 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             return nearTtls.get(idx);
         }
 
-        return -1L;
-    }
-
-    /**
-     * @return DR TTLs.
-     */
-    @Nullable public GridLongList drExpireTimes() {
-        return drExpireTimes;
+        return CU.TTL_NOT_CHANGED;
     }
 
     /**
      * @param idx Index.
-     * @return DR TTL.
+     * @return Conflict expire time.
      */
-    public long drExpireTime(int idx) {
-        if (drExpireTimes != null) {
-            assert idx >= 0 && idx < drExpireTimes.size();
+    public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
 
-            return drExpireTimes.get(idx);
+            return conflictExpireTimes.get(idx);
         }
 
-        return -1L;
+        return CU.EXPIRE_TIME_CALCULATE;
     }
 
     /**
@@ -696,13 +682,13 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
 
         switch (writer.state()) {
             case 3:
-                if (!writer.writeMessage("drExpireTimes", drExpireTimes))
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
                     return false;
 
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeCollection("drVers", drVers, Type.MSG))
+                if (!writer.writeCollection("conflictVers", conflictVers, Type.MSG))
                     return false;
 
                 writer.incrementState();
@@ -829,7 +815,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
 
         switch (readState) {
             case 3:
-                drExpireTimes = reader.readMessage("drExpireTimes");
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -837,7 +823,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 readState++;
 
             case 4:
-                drVers = reader.readCollection("drVers", Type.MSG);
+                conflictVers = reader.readCollection("conflictVers", Type.MSG);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6305642/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index c206264..f5ec9fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -95,15 +95,15 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
     /** Entry processor arguments bytes. */
     private byte[][] invokeArgsBytes;
 
-    /** DR versions. */
+    /** Conflict versions. */
     @GridDirectCollection(GridCacheVersion.class)
-    private List<GridCacheVersion> drVers;
+    private List<GridCacheVersion> conflictVers;
 
-    /** DR TTLs. */
-    private GridLongList drTtls;
+    /** Conflict TTLs. */
+    private GridLongList conflictTtls;
 
-    /** DR TTLs. */
-    private GridLongList drExpireTimes;
+    /** Conflict expire times. */
+    private GridLongList conflictExpireTimes;
 
     /** Return value flag. */
     private boolean retval;
@@ -290,16 +290,16 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
     /**
      * @param key Key to add.
      * @param val Optional update value.
-     * @param drTtl DR TTL (optional).
-     * @param drExpireTime DR expire time (optional).
-     * @param drVer DR version (optional).
+     * @param conflictTtl Conflict TTL (optional).
+     * @param conflictExpireTime Conflict expire time (optional).
+     * @param conflictVer Conflict version (optional).
      * @param primary If given key is primary on this mapping.
      */
     public void addUpdateEntry(K key,
         @Nullable Object val,
-        long drTtl,
-        long drExpireTime,
-        @Nullable GridCacheVersion drVer,
+        long conflictTtl,
+        long conflictExpireTime,
+        @Nullable GridCacheVersion conflictVer,
         boolean primary) {
         assert val != null || op == DELETE;
         assert op != TRANSFORM || val instanceof EntryProcessor;
@@ -309,40 +309,40 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
 
         hasPrimary |= primary;
 
-        // In case there is no DR, do not create the list.
-        if (drVer != null) {
-            if (drVers == null) {
-                drVers = new ArrayList<>();
+        // In case there is no conflict, do not create the list.
+        if (conflictVer != null) {
+            if (conflictVers == null) {
+                conflictVers = new ArrayList<>();
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    drVers.add(null);
+                    conflictVers.add(null);
             }
 
-            drVers.add(drVer);
+            conflictVers.add(conflictVer);
         }
-        else if (drVers != null)
-            drVers.add(drVer);
+        else if (conflictVers != null)
+            conflictVers.add(null);
 
-        if (drTtl >= 0) {
-            if (drTtls == null) {
-                drTtls = new GridLongList(keys.size());
+        if (conflictTtl >= 0) {
+            if (conflictTtls == null) {
+                conflictTtls = new GridLongList(keys.size());
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    drTtls.add(-1);
+                    conflictTtls.add(-1);
             }
 
-            drTtls.add(drTtl);
+            conflictTtls.add(conflictTtl);
         }
 
-        if (drExpireTime >= 0) {
-            if (drExpireTimes == null) {
-                drExpireTimes = new GridLongList(keys.size());
+        if (conflictExpireTime >= 0) {
+            if (conflictExpireTimes == null) {
+                conflictExpireTimes = new GridLongList(keys.size());
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    drExpireTimes.add(-1);
+                    conflictExpireTimes.add(-1);
             }
 
-            drExpireTimes.add(drExpireTime);
+            conflictExpireTimes.add(conflictExpireTime);
         }
     }
 
@@ -378,6 +378,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
      * @param idx Key index.
      * @return Value.
      */
+    @SuppressWarnings("unchecked")
     public V value(int idx) {
         assert op == UPDATE : op;
 
@@ -388,6 +389,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
      * @param idx Key index.
      * @return Entry processor.
      */
+    @SuppressWarnings("unchecked")
     public EntryProcessor<K, V, ?> entryProcessor(int idx) {
         assert op == TRANSFORM : op;
 
@@ -432,63 +434,49 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
     }
 
     /**
-     * @return DR versions.
+     * @return COnflict versions.
      */
-    @Nullable public List<GridCacheVersion> drVersions() {
-        return drVers;
+    @Nullable public List<GridCacheVersion> conflictVersions() {
+        return conflictVers;
     }
 
     /**
      * @param idx Index.
-     * @return DR version.
+     * @return Conflict version.
      */
-    @Nullable public GridCacheVersion drVersion(int idx) {
-        if (drVers != null) {
-            assert idx >= 0 && idx < drVers.size();
+    @Nullable public GridCacheVersion conflictVersion(int idx) {
+        if (conflictVers != null) {
+            assert idx >= 0 && idx < conflictVers.size();
 
-            return drVers.get(idx);
+            return conflictVers.get(idx);
         }
 
         return null;
     }
 
     /**
-     * @return DR TTLs.
-     */
-    @Nullable public GridLongList drTtls() {
-        return drTtls;
-    }
-
-    /**
      * @param idx Index.
-     * @return DR TTL.
+     * @return Conflict TTL.
      */
-    public long drTtl(int idx) {
-        if (drTtls != null) {
-            assert idx >= 0 && idx < drTtls.size();
+    public long conflictTtl(int idx) {
+        if (conflictTtls != null) {
+            assert idx >= 0 && idx < conflictTtls.size();
 
-            return drTtls.get(idx);
+            return conflictTtls.get(idx);
         }
 
         return -1L;
     }
 
     /**
-     * @return DR TTLs.
-     */
-    @Nullable public GridLongList drExpireTimes() {
-        return drExpireTimes;
-    }
-
-    /**
      * @param idx Index.
-     * @return DR TTL.
+     * @return Conflict expire time.
      */
-    public long drExpireTime(int idx) {
-        if (drExpireTimes != null) {
-            assert idx >= 0 && idx < drExpireTimes.size();
+    public long conflictExpireTime(int idx) {
+        if (conflictExpireTimes != null) {
+            assert idx >= 0 && idx < conflictExpireTimes.size();
 
-            return drExpireTimes.get(idx);
+            return conflictExpireTimes.get(idx);
         }
 
         return -1L;
@@ -558,19 +546,19 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
 
         switch (writer.state()) {
             case 3:
-                if (!writer.writeMessage("drExpireTimes", drExpireTimes))
+                if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
                     return false;
 
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeMessage("drTtls", drTtls))
+                if (!writer.writeMessage("conflictTtls", conflictTtls))
                     return false;
 
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeCollection("drVers", drVers, Type.MSG))
+                if (!writer.writeCollection("conflictVers", conflictVers, Type.MSG))
                     return false;
 
                 writer.incrementState();
@@ -685,7 +673,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
 
         switch (readState) {
             case 3:
-                drExpireTimes = reader.readMessage("drExpireTimes");
+                conflictExpireTimes = reader.readMessage("conflictExpireTimes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -693,7 +681,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 readState++;
 
             case 4:
-                drTtls = reader.readMessage("drTtls");
+                conflictTtls = reader.readMessage("conflictTtls");
 
                 if (!reader.isLastRead())
                     return false;
@@ -701,7 +689,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 readState++;
 
             case 5:
-                drVers = reader.readCollection("drVers", Type.MSG);
+                conflictVers = reader.readCollection("conflictVers", Type.MSG);
 
                 if (!reader.isLastRead())
                     return false;


Mime
View raw message