You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2022/03/19 00:00:04 UTC

[geode] 04/21: GEODE-9132: Fixup PartitionResponse constructors

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

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

commit eb3a5b5f0db8e694447ee0b1d6a3677bd0df215f
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Fri Apr 9 15:22:46 2021 -0700

    GEODE-9132: Fixup PartitionResponse constructors
    
    * Chain constructors to only one constructor that calls super
    * Expose all arguments for dependency injection
    * Provide type to recipients
---
 .../cache/partitioned/PartitionMessage.java        | 32 ++++++++++++++--------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
index 49e5f51..6e3eed5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
@@ -14,6 +14,8 @@
  */
 package org.apache.geode.internal.cache.partitioned;
 
+import static java.util.Collections.singleton;
+
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
@@ -22,6 +24,7 @@ import java.util.Set;
 
 import org.apache.logging.log4j.Logger;
 
+import org.apache.geode.CancelCriterion;
 import org.apache.geode.CancelException;
 import org.apache.geode.InternalGemFireError;
 import org.apache.geode.SystemFailure;
@@ -754,24 +757,31 @@ public abstract class PartitionMessage extends DistributionMessage
      */
     boolean responseRequired;
 
-    public PartitionResponse(InternalDistributedSystem dm, Set initMembers) {
-      this(dm, initMembers, true);
+    protected PartitionResponse(InternalDistributedSystem dm,
+        Set<InternalDistributedMember> recipients) {
+      this(dm, recipients, true);
     }
 
-    public PartitionResponse(InternalDistributedSystem dm, Set initMembers, boolean register) {
-      super(dm, initMembers);
-      if (register) {
-        register();
-      }
+    protected PartitionResponse(InternalDistributedSystem system,
+        Set<InternalDistributedMember> recipients, boolean register) {
+      this(system.getDistributionManager(), system, recipients, system.getCancelCriterion(),
+          register);
+    }
+
+    protected PartitionResponse(InternalDistributedSystem system,
+        InternalDistributedMember member) {
+      this(system.getDistributionManager(), system, singleton(member), system.getCancelCriterion());
     }
 
-    public PartitionResponse(InternalDistributedSystem dm, InternalDistributedMember member) {
-      this(dm, member, true);
+    protected PartitionResponse(DistributionManager dm, InternalDistributedSystem system,
+        Set<InternalDistributedMember> recipients, CancelCriterion cancelCriterion) {
+      this(dm, system, recipients, cancelCriterion, true);
     }
 
-    public PartitionResponse(InternalDistributedSystem dm, InternalDistributedMember member,
+    private PartitionResponse(DistributionManager dm, InternalDistributedSystem system,
+        Set<InternalDistributedMember> recipients, CancelCriterion cancelCriterion,
         boolean register) {
-      super(dm, member);
+      super(dm, system, recipients, cancelCriterion);
       if (register) {
         register();
       }