ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [17/50] [abbrv] incubator-ignite git commit: ignite-645 review fixes
Date Fri, 03 Apr 2015 22:46:09 GMT
ignite-645 review fixes


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

Branch: refs/heads/ignite-674
Commit: 07ed759a89d49e35ec0ef3122e69e094af666f8c
Parents: ef095dc
Author: Andrey Gura <agura@gridgain.com>
Authored: Thu Apr 2 15:25:24 2015 +0300
Committer: Andrey Gura <agura@gridgain.com>
Committed: Thu Apr 2 15:25:24 2015 +0300

----------------------------------------------------------------------
 .../distributed/near/GridNearCacheAdapter.java  | 24 --------
 .../near/GridCacheNearMultiNodeSelfTest.java    | 31 +++++-----
 .../near/GridCacheNearOneNodeSelfTest.java      |  8 +--
 .../near/GridCacheNearReadersSelfTest.java      | 62 ++++++++++----------
 4 files changed, 49 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index b08a49b..e05ec2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -419,15 +419,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
         return super.evict(key, filter) & dht().evict(key, filter);
     }
 
-    /**
-     * @param key Key to evict.
-     * @param filter Optional filter.
-     * @return {@code True} if evicted.
-     */
-    public boolean evictNearOnly(K key, @Nullable CacheEntryPredicate[] filter) {
-        return super.evict(key, filter);
-    }
-
     /** {@inheritDoc} */
     @Override public void evictAll(Collection<? extends K> keys,
         @Nullable CacheEntryPredicate[] filter) {
@@ -448,21 +439,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
         }
     }
 
-    /**
-     * Peeks only near cache without looking into DHT cache.
-     *
-     * @param key Key.
-     * @return Peeked value.
-     */
-    @Nullable public V peekNearOnly(K key) {
-        try {
-            return localPeek(key, CachePeekModes.ONHEAP_ONLY, null);
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException(e);
-        }
-    }
-
     /** {@inheritDoc} */
     @Override public boolean clearLocally0(K key, @Nullable CacheEntryPredicate[] filter)
{
         return super.clearLocally0(key, filter) | dht().clearLocally0(key, filter);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index 8a9816d..548564a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -585,14 +585,11 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
 
         cache.put(key, val);
 
-        GridNearCacheAdapter<Integer, String> near0 = near(0);
-        GridNearCacheAdapter<Integer, String> near1 = near(1);
-
         GridDhtCacheAdapter<Integer, String> dht0 = dht(0);
         GridDhtCacheAdapter<Integer, String> dht1 = dht(1);
 
-        assertNull(near0.peekNearOnly(key));
-        assertNull(near1.peekNearOnly(key));
+        assertNull(near(0).peekEx(key));
+        assertNull(near(1).peekEx(key));
 
         assertEquals(val, localPeek(dht0, key));
         assertEquals(val, localPeek(dht1, key));
@@ -690,8 +687,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
             assertNotNull(nearEntry3);
             assertTrue("Invalid near entry: " + nearEntry3, nearEntry3.valid(topVer));
 
-            assertNotNull(near(0).peekNearOnly(key));
-            assertNull(near(1).peekNearOnly(key));
+            assertNotNull(near(0).peekEx(key));
+            assertNull(near(1).peekEx(key));
 
             assertEquals(val, cache.get(key));
             assertEquals(val, cache.getAndRemove(key));
@@ -706,8 +703,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
             lock.unlock();
         }
 
-        assertNull(near(0).peekNearOnly(key));
-        assertNull(near(1).peekNearOnly(key));
+        assertNull(near(0).peekEx(key));
+        assertNull(near(1).peekEx(key));
 
         assertFalse(near(0).isLockedNearOnly(key));
         assertFalse(cache.isLocalLocked(key, true));
@@ -804,8 +801,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
         assertEquals(val, dhtPeek(0, key));
         assertEquals(val, dhtPeek(1, key));
 
-        assertNull(near(0).peekNearOnly(key));
-        assertNull(near(1).peekNearOnly(key));
+        assertNull(near(0).peekEx(key));
+        assertNull(near(1).peekEx(key));
 
         if (transactional()) {
 
@@ -822,8 +819,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
         assertEquals(val, dhtPeek(0, key));
         assertEquals(val, dhtPeek(1, key));
 
-        assertNull(near(0).peekNearOnly(key));
-        assertNull(near(1).peekNearOnly(key));
+        assertNull(near(0).peekEx(key));
+        assertNull(near(1).peekEx(key));
     }
 
     /** @throws Exception If failed. */
@@ -850,8 +847,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
         assertEquals(val, dhtPeek(0, key));
         assertEquals(val, dhtPeek(1, key));
 
-        assertNull(near(0).peekNearOnly(key));
-        assertNull(near(1).peekNearOnly(key));
+        assertNull(near(0).peekEx(key));
+        assertNull(near(1).peekEx(key));
 
         if (transactional()) {
             try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ))
{
@@ -875,8 +872,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
         assertNull(dhtPeek(0, key));
         assertNull(dhtPeek(1, key));
 
-        assertNull(near(0).peekNearOnly(key));
-        assertNull(near(1).peekNearOnly(key));
+        assertNull(near(0).peekEx(key));
+        assertNull(near(1).peekEx(key));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index 3cc4e01..d73c8ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -283,7 +283,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest
{
         cache.put(1, "val1");
 
         assertEquals("val1", dhtPeek(1));
-        assertNull(near().peekNearOnly(1));
+        assertNull(near().peekEx(1));
 
         Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
@@ -292,7 +292,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest
{
         tx.commit();
 
         assertEquals("val1", dhtPeek(1));
-        assertNull(near().peekNearOnly(1));
+        assertNull(near().peekEx(1));
     }
 
     /** @throws Exception If failed. */
@@ -302,7 +302,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest
{
         cache.put(1, "val1");
 
         assertEquals("val1", dhtPeek(1));
-        assertNull(near().peekNearOnly(1));
+        assertNull(near().peekEx(1));
 
         Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
@@ -313,7 +313,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest
{
         tx.commit();
 
         assertNull(dhtPeek(1));
-        assertNull(near().peekNearOnly(1));
+        assertNull(near().peekEx(1));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index a0d9f03..59378bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -245,8 +245,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertEquals("v1", dhtPeek(cache1, 1));
         assertEquals("v1", dhtPeek(cache2, 1));
 
-        assertNull(near(cache1).peekNearOnly(1));
-        assertNull(near(cache2).peekNearOnly(1));
+        assertNull(near(cache1).peekEx(1));
+        assertNull(near(cache2).peekEx(1));
 
         GridDhtCacheEntry e1 = (GridDhtCacheEntry)dht(cache1).entryEx(1);
 
@@ -261,8 +261,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertEquals("v2", dhtPeek(cache1, 2));
         assertEquals("v2", dhtPeek(cache2, 2));
 
-        assertNull(near(cache1).peekNearOnly(2));
-        assertNull(near(cache2).peekNearOnly(2));
+        assertNull(near(cache1).peekEx(2));
+        assertNull(near(cache2).peekEx(2));
 
         GridDhtCacheEntry c2e2 = (GridDhtCacheEntry)dht(cache2).entryEx(2);
 
@@ -274,7 +274,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertEquals("v1", cache2.get(1));
 
         // Since DHT cache2 has the value, Near cache2 should not have it.
-        assertNull(near(cache2).peekNearOnly(1));
+        assertNull(near(cache2).peekEx(1));
 
         // Since v1 was retrieved locally from cache2, cache1 should not know about it.
         assertFalse(e1.readers().contains(n2.id()));
@@ -283,7 +283,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         // It should not be successful since it's not allowed to evict entry on backup node.
         cache2.localEvict(Collections.singleton(1));
 
-        assertNull(near(cache2).peekNearOnly(1));
+        assertNull(near(cache2).peekEx(1));
         assertEquals("v1", dhtPeek(cache2, 1));
 
         assertEquals("v1", cache1.getAndPut(1, "z1"));
@@ -291,7 +291,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         // Node 1 should not have node2 in readers map.
         assertFalse(e1.readers().contains(n2.id()));
 
-        assertNull(near(cache2).peekNearOnly(1));
+        assertNull(near(cache2).peekEx(1));
         assertEquals("z1", dhtPeek(cache2, 1));
     }
 
@@ -447,9 +447,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertEquals(val1, dhtPeek(1, key1));
         assertNull(dhtPeek(2, key1));
 
-        assertNull(near(0).peekNearOnly(key1));
-        assertNull(near(1).peekNearOnly(key1));
-        assertNull(near(2).peekNearOnly(key1));
+        assertNull(near(0).peekEx(key1));
+        assertNull(near(1).peekEx(key1));
+        assertNull(near(2).peekEx(key1));
 
         cache.put(key2, val2);
 
@@ -457,9 +457,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertEquals(val2, dhtPeek(1, key2));
         assertEquals(val2, dhtPeek(2, key2));
 
-        assertEquals(val2, near(0).peekNearOnly(key2));
-        assertNull(near(1).peekNearOnly(key2));
-        assertNull(near(2).peekNearOnly(key2));
+        assertEquals(val2, near(0).peekEx(key2).wrap().getValue());
+        assertNull(near(1).peekEx(key2));
+        assertNull(near(2).peekEx(key2));
 
         String val22 = val2 + "2";
 
@@ -469,9 +469,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertEquals(val22, dhtPeek(1, key2));
         assertEquals(val22, dhtPeek(2, key2));
 
-        assertEquals(val22, near(0).peekNearOnly(key2));
-        assertNull(near(1).peekNearOnly(key2));
-        assertNull(near(2).peekNearOnly(key2));
+        assertEquals(val22, near(0).peekEx(key2).wrap().getValue());
+        assertNull(near(1).peekEx(key2));
+        assertNull(near(2).peekEx(key2));
 
         cache.remove(key2);
 
@@ -479,9 +479,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertNull(dhtPeek(1, key2));
         assertNull(dhtPeek(2, key2));
 
-        assertNull(near(0).peekNearOnly(key2));
-        assertNull(near(1).peekNearOnly(key2));
-        assertNull(near(2).peekNearOnly(key2));
+        assertNull(near(0).peekEx(key2));
+        assertNull(near(1).peekEx(key2));
+        assertNull(near(2).peekEx(key2));
 
         cache.remove(key1);
 
@@ -489,9 +489,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
         assertNull(dhtPeek(1, key1));
         assertNull(dhtPeek(2, key1));
 
-        assertNull(near(0).peekNearOnly(key1));
-        assertNull(near(1).peekNearOnly(key1));
-        assertNull(near(2).peekNearOnly(key1));
+        assertNull(near(0).peekEx(key1));
+        assertNull(near(1).peekEx(key1));
+        assertNull(near(2).peekEx(key1));
 
         for (int i = 0; i < grids; i++) {
             assert !jcache(i).isLocalLocked(key1, false);
@@ -542,10 +542,10 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
 
                 // Since near entry holds the lock, it should
                 // contain correct value.
-                assertEquals(val1, near(0).peekNearOnly(key1));
+                assertEquals(val1, near(0).peekEx(key1).wrap().getValue());
 
-                assertNull(near(1).peekNearOnly(key1));
-                assertNull(near(2).peekNearOnly(key1));
+                assertNull(near(1).peekEx(key1));
+                assertNull(near(2).peekEx(key1));
 
                 cache.put(key2, val2);
 
@@ -553,9 +553,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
                 assertEquals(val2, dhtPeek(1, key2));
                 assertEquals(val2, dhtPeek(2, key2));
 
-                assertEquals(val2, near(0).peekNearOnly(key2));
-                assertNull(near(1).peekNearOnly(key2));
-                assertNull(near(2).peekNearOnly(key2));
+                assertEquals(val2, near(0).peekEx(key2).wrap().getValue());
+                assertNull(near(1).peekEx(key2));
+                assertNull(near(2).peekEx(key2));
 
                 String val22 = val2 + "2";
 
@@ -565,9 +565,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest
{
                 assertEquals(val22, dhtPeek(1, key2));
                 assertEquals(val22, dhtPeek(2, key2));
 
-                assertEquals(val22, near(0).peekNearOnly(key2));
-                assertNull(near(1).peekNearOnly(key2));
-                assertNull(near(2).peekNearOnly(key2));
+                assertEquals(val22, near(0).peekEx(key2).wrap().getValue());
+                assertNull(near(1).peekEx(key2));
+                assertNull(near(2).peekEx(key2));
 
                 cache.remove(key2);
 


Mime
View raw message