You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jc...@apache.org on 2020/03/16 21:03:31 UTC

[geode] 08/08: Use Region.clear instead of Region.removeAll

This is an automated email from the ASF dual-hosted git repository.

jchen21 pushed a commit to branch feature/GEODE-7681
in repository https://gitbox.apache.org/repos/asf/geode.git

commit f350555fd281b2c1355e29548fa87d62d93326ad
Author: Jianxia Chen <jc...@apache.org>
AuthorDate: Mon Mar 16 13:46:08 2020 -0700

    Use Region.clear instead of Region.removeAll
    
    Authored-by: Jianxia Chen <jc...@apache.org>
---
 .../cache/PartitionedRegionClearPerformanceDUnitTest.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearPerformanceDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearPerformanceDUnitTest.java
index f9b0cc1..c659982 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearPerformanceDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionClearPerformanceDUnitTest.java
@@ -99,7 +99,7 @@ public class PartitionedRegionClearPerformanceDUnitTest implements Serializable
   }
 
   private void assertRegionSizeOnServer(int size) {
-    server1.invoke(()-> {
+    server1.invoke(() -> {
       Region region = ClusterStartupRule.getCache().getRegion(regionName);
       assertThat(region.size()).isEqualTo(size);
     });
@@ -108,9 +108,11 @@ public class PartitionedRegionClearPerformanceDUnitTest implements Serializable
   private void assertRegionAttributesOnServer(int numBuckets, boolean persistent, int redundancy) {
     server1.invoke(() -> {
       Region region = ClusterStartupRule.getCache().getRegion(regionName);
-      assertThat(region.getAttributes().getPartitionAttributes().getTotalNumBuckets()).isEqualTo(numBuckets);
+      assertThat(region.getAttributes().getPartitionAttributes().getTotalNumBuckets())
+          .isEqualTo(numBuckets);
       assertThat(region.getAttributes().getDataPolicy().withPersistence()).isEqualTo(persistent);
-      assertThat(region.getAttributes().getPartitionAttributes().getRedundantCopies()).isEqualTo(redundancy);
+      assertThat(region.getAttributes().getPartitionAttributes().getRedundantCopies())
+          .isEqualTo(redundancy);
     });
   }
 
@@ -119,7 +121,7 @@ public class PartitionedRegionClearPerformanceDUnitTest implements Serializable
       client.invoke(() -> {
         Region clientRegion = ClusterStartupRule.getClientCache().getRegion(regionName);
         long startTime = System.currentTimeMillis();
-        clientRegion.removeAll(clientRegion.keySet()); // should be clientRegion.clear();
+        clientRegion.clear();
         long endTime = System.currentTimeMillis();
         System.out.println(
             "Partitioned region with " + numEntries + " entries takes " + (endTime - startTime)
@@ -130,7 +132,7 @@ public class PartitionedRegionClearPerformanceDUnitTest implements Serializable
       server1.invoke(() -> {
         Region region = ClusterStartupRule.getCache().getRegion(regionName);
         long startTime = System.currentTimeMillis();
-        region.removeAll(region.keySet()); // should be region.clear();
+        region.clear();
         long endTime = System.currentTimeMillis();
         System.out.println(
             "Partitioned region with " + numEntries + " entries takes " + (endTime - startTime)