You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2021/04/30 01:16:42 UTC

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

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

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

commit f0d2f11946046e9791231cb26edfba183096ad6b
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 d676f92..dd6cdc0 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;
@@ -747,24 +750,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();
       }