You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by es...@apache.org on 2017/10/04 22:15:53 UTC

[geode] branch feature/GEODE-3679 updated: Move the method from LocalRegion to DistributedRegion.

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

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


The following commit(s) were added to refs/heads/feature/GEODE-3679 by this push:
     new 91251e9  Move the method from LocalRegion to DistributedRegion.
91251e9 is described below

commit 91251e9801d23c9b4a50ce6a9566a4b699628b81
Author: eshu <es...@pivotal.io>
AuthorDate: Wed Oct 4 10:40:42 2017 -0700

    Move the method from LocalRegion to DistributedRegion.
---
 .../geode/internal/cache/DistributedRegion.java    | 27 ++++++++++++++++++++++
 .../apache/geode/internal/cache/LocalRegion.java   | 25 --------------------
 .../internal/cache/tx/DistributedTXRegionStub.java |  3 ++-
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index e882ed1..20d9f15 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -61,6 +61,8 @@ import org.apache.geode.cache.RegionMembershipListener;
 import org.apache.geode.cache.ResumptionAction;
 import org.apache.geode.cache.RoleException;
 import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.TransactionDataNotColocatedException;
+import org.apache.geode.cache.TransactionException;
 import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionException;
@@ -101,6 +103,7 @@ import org.apache.geode.internal.cache.execute.LocalResultCollector;
 import org.apache.geode.internal.cache.execute.RegionFunctionContextImpl;
 import org.apache.geode.internal.cache.execute.ServerToClientFunctionResultSender;
 import org.apache.geode.internal.cache.lru.LRUEntry;
+import org.apache.geode.internal.cache.partitioned.RemoteSizeMessage;
 import org.apache.geode.internal.cache.persistence.CreatePersistentRegionProcessor;
 import org.apache.geode.internal.cache.persistence.PersistenceAdvisor;
 import org.apache.geode.internal.cache.persistence.PersistenceAdvisorImpl;
@@ -3553,6 +3556,30 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
     return super.getOwnerForKey(key);
   }
 
+
+  /**
+   * Returns the size in this region.
+   *
+   * This is used in a transaction to find the size of the region on the transaction hosting node.
+   *
+   * @param target the host of the transaction TXState
+   * @return the number of entries in this region
+   */
+  public int getRegionSize(DistributedMember target) {
+    try {
+      RemoteSizeMessage.SizeResponse response =
+          RemoteSizeMessage.send(Collections.singleton(target), this);
+      return response.waitForSize();
+    } catch (RegionDestroyedException rde) {
+      throw new TransactionDataNotColocatedException(
+          LocalizedStrings.RemoteMessage_REGION_0_NOT_COLOCATED_WITH_TRANSACTION
+              .toLocalizedString(rde.getRegionFullPath()),
+          rde);
+    } catch (Exception e) {
+      throw new TransactionException(e);
+    }
+  }
+
   /**
    * Execute the provided named function in all locations that contain the given keys. So function
    * can be executed on just one fabric node, executed in parallel on a subset of nodes in parallel
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 3da04fe..bc384c2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -105,7 +105,6 @@ import org.apache.geode.cache.RegionReinitializedException;
 import org.apache.geode.cache.Scope;
 import org.apache.geode.cache.StatisticsDisabledException;
 import org.apache.geode.cache.TimeoutException;
-import org.apache.geode.cache.TransactionDataNotColocatedException;
 import org.apache.geode.cache.TransactionException;
 import org.apache.geode.cache.TransactionId;
 import org.apache.geode.cache.client.PoolManager;
@@ -180,7 +179,6 @@ import org.apache.geode.internal.cache.ha.ThreadIdentifier;
 import org.apache.geode.internal.cache.lru.LRUEntry;
 import org.apache.geode.internal.cache.partitioned.Bucket;
 import org.apache.geode.internal.cache.partitioned.RedundancyAlreadyMetException;
-import org.apache.geode.internal.cache.partitioned.RemoteSizeMessage;
 import org.apache.geode.internal.cache.persistence.DiskExceptionHandler;
 import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
 import org.apache.geode.internal.cache.persistence.DiskRegionView;
@@ -2035,29 +2033,6 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
   }
 
   /**
-   * Returns the size in this region.
-   *
-   * This is used in a transaction to find the size of the region on the transaction hosting node.
-   *
-   * @param target the host of the transaction TXState
-   * @return the number of entries in this region
-   */
-  public int getRegionSize(DistributedMember target) {
-    try {
-      RemoteSizeMessage.SizeResponse response =
-          RemoteSizeMessage.send(Collections.singleton(target), this);
-      return response.waitForSize();
-    } catch (RegionDestroyedException rde) {
-      throw new TransactionDataNotColocatedException(
-          LocalizedStrings.RemoteMessage_REGION_0_NOT_COLOCATED_WITH_TRANSACTION
-              .toLocalizedString(rde.getRegionFullPath()),
-          rde);
-    } catch (Exception e) {
-      throw new TransactionException(e);
-    }
-  }
-
-  /**
    * Returns the {@code DiskRegion} that this region uses to access data on disk.
    *
    * @return {@code null} if disk regions are not being used
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/DistributedTXRegionStub.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/DistributedTXRegionStub.java
index 6c0513f..f0294b7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/DistributedTXRegionStub.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/DistributedTXRegionStub.java
@@ -26,6 +26,7 @@ import org.apache.geode.cache.Region.Entry;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.DistributedPutAllOperation;
+import org.apache.geode.internal.cache.DistributedRegion;
 import org.apache.geode.internal.cache.DistributedRemoveAllOperation;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.KeyInfo;
@@ -223,7 +224,7 @@ public class DistributedTXRegionStub extends AbstractPeerTXRegionStub {
 
 
   public int entryCount() {
-    return this.region.getRegionSize(this.state.getTarget());
+    return ((DistributedRegion) this.region).getRegionSize(this.state.getTarget());
   }
 
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].