You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2019/09/12 19:53:38 UTC

[geode] branch feature/GEODE-7196 created (now ca27333)

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

bschuchardt pushed a change to branch feature/GEODE-7196
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at ca27333  remove membership collections from ClusterDistributionManager

This branch includes the following new commits:

     new 8e5130a  GEODE-7196 Simplify ClusterDistributionManage
     new ca27333  remove membership collections from ClusterDistributionManager

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[geode] 02/02: remove membership collections from ClusterDistributionManager

Posted by bs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ca27333daf17fd752cbe052994a0667baad94aa9
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Thu Sep 12 12:49:51 2019 -0700

    remove membership collections from ClusterDistributionManager
    
    this also makes GMSMembershipManager's latestView immutable and removes
    the latestViewId instance variable, which is left over from very old
    GemFire code
---
 .../geode/management/CacheManagementDUnitTest.java |  10 +-
 .../geode/management/DLockManagementDUnitTest.java |   6 +-
 .../geode/management/DiskManagementDUnitTest.java  |   3 +-
 .../geode/management/ManagementTestRule.java       |  10 +-
 .../stats/DistributedSystemStatsDUnitTest.java     |   4 +-
 .../adapter/GMSMembershipManagerJUnitTest.java     |   5 +-
 .../internal/ClusterDistributionManager.java       | 293 ++++-----------------
 .../distributed/internal/DistributionManager.java  |  14 +-
 .../internal/InternalDistributedSystem.java        |   2 +-
 .../internal/LonerDistributionManager.java         |  21 +-
 .../distributed/internal/ReplyProcessor21.java     |  12 +-
 .../distributed/internal/SerialAckedMessage.java   |   4 +-
 .../distributed/internal/direct/DirectChannel.java |   3 +-
 .../distributed/internal/locks/DLockGrantor.java   |   2 +-
 .../locks/DLockRecoverGrantorProcessor.java        |   5 +-
 .../internal/membership/MembershipView.java        |  19 +-
 .../membership/adapter/GMSMembershipManager.java   |  52 ++--
 .../internal/membership/gms/api/Membership.java    |   3 +
 .../org/apache/geode/internal/SystemAdmin.java     |   2 +-
 .../admin/remote/RemoteGfManagerAgent.java         |   4 +-
 .../internal/cache/InitialImageFlowControl.java    |   4 +-
 .../internal/cache/PRHARedundancyProvider.java     |   6 +-
 .../cache/PartitionedRegionBucketMgmtHelper.java   |   3 +-
 .../internal/cache/PartitionedRegionHelper.java    |   2 +-
 .../geode/internal/cache/StateFlushOperation.java  |   3 +-
 .../geode/internal/cache/TXFarSideCMTracker.java   |   2 +-
 .../internal/cache/UpdateAttributesProcessor.java  |   4 +-
 .../geode/internal/cache/backup/BackupService.java |   2 +-
 .../cache/execute/MemberFunctionExecutor.java      |   5 +-
 .../rebalance/ExplicitMoveDirector.java            |   4 +-
 .../cache/persistence/PersistentMemberManager.java |   2 +-
 .../internal/cache/backup/BackupServiceTest.java   |   3 +-
 32 files changed, 177 insertions(+), 337 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/CacheManagementDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/CacheManagementDUnitTest.java
index 056768b..5610b64 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/CacheManagementDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/CacheManagementDUnitTest.java
@@ -304,7 +304,7 @@ public class CacheManagementDUnitTest implements Serializable {
   private void verifyQueryMBeans(final VM managerVM) {
     managerVM.invoke("validateQueryMBeans", () -> {
       SystemManagementService service = this.managementTestRule.getSystemManagementService();
-      Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
       Set<ObjectName> superSet = new HashSet<>();
 
       for (DistributedMember member : otherMembers) {
@@ -329,7 +329,7 @@ public class CacheManagementDUnitTest implements Serializable {
   private void verifyGetMBeanInstance(final VM managerVM) {
     managerVM.invoke("verifyGetMBeanInstance", () -> {
       SystemManagementService service = this.managementTestRule.getSystemManagementService();
-      Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
 
       for (DistributedMember member : otherMembers) {
         ObjectName memberMBeanName = service.getMemberMBeanName(member);
@@ -381,7 +381,7 @@ public class CacheManagementDUnitTest implements Serializable {
       assertThat(service.getLocalManager().getFederationSheduler().isShutdown()).isFalse();
 
       // Check for Proxies
-      Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
       assertThat(otherMembers).hasSize(otherMembersCount);
 
       for (DistributedMember member : otherMembers) {
@@ -416,7 +416,7 @@ public class CacheManagementDUnitTest implements Serializable {
    */
   private void verifyConfigDataRemote(final Map<DistributedMember, DistributionConfig> configMap) {
     SystemManagementService service = this.managementTestRule.getSystemManagementService();
-    Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+    List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
 
     for (DistributedMember member : otherMembers) {
       MemberMXBean memberMXBean = MXBeanAwaitility.awaitMemberMXBeanProxy(member, service);
@@ -582,7 +582,7 @@ public class CacheManagementDUnitTest implements Serializable {
 
   private void invokeRemoteMemberMXBeanOps() {
     SystemManagementService service = this.managementTestRule.getSystemManagementService();
-    Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+    List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
 
     for (DistributedMember member : otherMembers) {
       MemberMXBean memberMXBean = MXBeanAwaitility.awaitMemberMXBeanProxy(member, service);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/DLockManagementDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/DLockManagementDUnitTest.java
index b41f15f..de25420 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/DLockManagementDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/DLockManagementDUnitTest.java
@@ -20,8 +20,8 @@ import static org.apache.geode.management.internal.MBeanJMXAdapter.getLockServic
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.Serializable;
+import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import javax.management.ObjectName;
 
@@ -96,7 +96,7 @@ public class DLockManagementDUnitTest implements Serializable {
 
   private void verifyProxyCleanupInManager(final VM managerVM) {
     managerVM.invoke("verifyProxyCleanupInManager", () -> {
-      Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
       SystemManagementService service = this.managementTestRule.getSystemManagementService();
 
       for (final DistributedMember member : otherMembers) {
@@ -183,7 +183,7 @@ public class DLockManagementDUnitTest implements Serializable {
    */
   private void verifyLockServiceMXBeanInManager(final VM managerVM) throws Exception {
     managerVM.invoke("verifyLockServiceMXBeanInManager", () -> {
-      Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
 
       for (DistributedMember member : otherMembers) {
         LockServiceMXBean lockServiceMXBean =
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/DiskManagementDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/DiskManagementDUnitTest.java
index 4b7ea10..9e8371b 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/DiskManagementDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/DiskManagementDUnitTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
 import java.io.Serializable;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
@@ -300,7 +301,7 @@ public class DiskManagementDUnitTest implements Serializable {
    */
   private void compactDiskStoresRemote(final VM managerVM, final int memberCount) {
     managerVM.invoke("compactDiskStoresRemote", () -> {
-      Set<DistributedMember> otherMemberSet = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMemberSet = this.managementTestRule.getOtherNormalMembers();
       assertThat(otherMemberSet.size()).isEqualTo(memberCount);
 
       SystemManagementService service = this.managementTestRule.getSystemManagementService();
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/ManagementTestRule.java b/geode-core/src/distributedTest/java/org/apache/geode/management/ManagementTestRule.java
index e40aac2..3925356 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/ManagementTestRule.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/ManagementTestRule.java
@@ -27,9 +27,9 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
-import java.util.HashSet;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Properties;
-import java.util.Set;
 
 import org.junit.rules.MethodRule;
 import org.junit.runners.model.FrameworkMethod;
@@ -234,13 +234,13 @@ public class ManagementTestRule implements MethodRule, Serializable {
     managerVM.invoke("stopManager", () -> stopManager());
   }
 
-  public Set<DistributedMember> getOtherNormalMembers() {
-    Set<DistributedMember> allMembers = new HashSet<>(getAllNormalMembers());
+  public List<DistributedMember> getOtherNormalMembers() {
+    List<DistributedMember> allMembers = new ArrayList<>(getAllNormalMembers());
     allMembers.remove(getDistributedMember());
     return allMembers;
   }
 
-  private Set<InternalDistributedMember> getAllNormalMembers() {
+  private List<InternalDistributedMember> getAllNormalMembers() {
     return getDistributionManager().getNormalDistributionManagerIds(); // excludes LOCATOR_DM_TYPE
   }
 
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
index 7e2445d..0f9992d 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/bean/stats/DistributedSystemStatsDUnitTest.java
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.io.Serializable;
-import java.util.Set;
+import java.util.List;
 
 import javax.management.ObjectName;
 
@@ -59,7 +59,7 @@ public class DistributedSystemStatsDUnitTest implements Serializable {
 
       // next block awaits all memberMXBeanName to refresh (getLastUpdateTime)
       SystemManagementService service = this.managementTestRule.getSystemManagementService();
-      Set<DistributedMember> otherMemberSet = this.managementTestRule.getOtherNormalMembers();
+      List<DistributedMember> otherMemberSet = this.managementTestRule.getOtherNormalMembers();
       assertEquals(3, otherMemberSet.size());
       for (DistributedMember member : otherMemberSet) {
         MemberMXBean memberMXBean = awaitMemberMXBeanProxy(member);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManagerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManagerJUnitTest.java
index 58619fa..97a7dee 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManagerJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManagerJUnitTest.java
@@ -41,7 +41,6 @@ import static org.mockito.Mockito.when;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
 import java.util.Random;
@@ -464,10 +463,10 @@ public class GMSMembershipManagerJUnitTest {
     when(dm.getCancelCriterion()).thenReturn(stopper);
     when(dm.getMembershipManager()).thenReturn(manager);
     when(dm.getViewMembers()).thenReturn(members);
-    when(dm.getDistributionManagerIds()).thenReturn(new HashSet(members));
+    when(dm.getDistributionManagerIds()).thenReturn(members);
     when(dm.addMembershipListenerAndGetDistributionManagerIds(any(
         org.apache.geode.distributed.internal.MembershipListener.class)))
-            .thenReturn(new HashSet(members));
+            .thenReturn(members);
 
     manager.getGMSManager().start();
     manager.getGMSManager().started();
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
index a288af5..d41f103 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
@@ -25,6 +25,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -34,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.Semaphore;
+import java.util.stream.Collectors;
 
 import org.apache.logging.log4j.Logger;
 
@@ -199,18 +201,6 @@ public class ClusterDistributionManager implements DistributionManager {
   private MembershipManager membershipManager;
 
   /**
-   * The (non-admin-only) members of the distributed system. This is a map of memberid->memberid for
-   * fast access to canonical ID references. All accesses to this field must be synchronized on
-   * {@link #membersLock}.
-   */
-  private Map<InternalDistributedMember, InternalDistributedMember> members =
-      Collections.emptyMap();
-  /**
-   * All (admin and non-admin) members of the distributed system. All accesses to this field must be
-   * synchronized on {@link #membersLock}.
-   */
-  private Set<InternalDistributedMember> membersAndAdmin = Collections.emptySet();
-  /**
    * Map of all locator members of the distributed system. The value is a collection of locator
    * strings that are hosted in that member. All accesses to this field must be synchronized on
    * {@link #membersLock}.
@@ -226,25 +216,6 @@ public class ClusterDistributionManager implements DistributionManager {
   private Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration =
       Collections.emptyMap();
 
-  /**
-   * The lock held while accessing the field references to the following:<br>
-   * 1) {@link #members}<br>
-   * 2) {@link #membersAndAdmin}<br>
-   * 3) {@link #hostedLocatorsAll}<br>
-   * 4) {@link #hostedLocatorsWithSharedConfiguration}<br>
-   */
-  private final Object membersLock = new Object();
-
-  /**
-   * The lock held while writing {@link #adminConsoles}.
-   */
-  private final Object adminConsolesLock = new Object();
-  /**
-   * The ids of all known admin consoles Uses Copy on Write. Writers must sync on adminConsolesLock.
-   * Readers don't need to sync.
-   */
-  private volatile Set<InternalDistributedMember> adminConsoles = Collections.emptySet();
-
   /** a map keyed on InternalDistributedMember, to direct channels to other systems */
   // protected final Map channelMap = CFactory.createCM();
 
@@ -305,6 +276,8 @@ public class ClusterDistributionManager implements DistributionManager {
 
   private final AlertingService alertingService;
 
+  private Object membersLock = new Object();
+
   ////////////////////// Static Methods //////////////////////
 
   /**
@@ -857,7 +830,7 @@ public class ClusterDistributionManager implements DistributionManager {
 
   @Override
   public DistributedMember getMemberWithName(String name) {
-    for (DistributedMember id : members.values()) {
+    for (DistributedMember id : getViewMembers()) {
       if (Objects.equals(id.getName(), name)) {
         return id;
       }
@@ -881,12 +854,8 @@ public class ClusterDistributionManager implements DistributionManager {
    * distribution managers.
    */
   @Override
-  public Set<InternalDistributedMember> getDistributionManagerIds() {
-    // access to members synchronized under membersLock in order to
-    // ensure serialization
-    synchronized (membersLock) {
-      return members.keySet();
-    }
+  public List<InternalDistributedMember> getDistributionManagerIds() {
+    return getViewMembers();
   }
 
   /**
@@ -1013,12 +982,8 @@ public class ClusterDistributionManager implements DistributionManager {
    * distribution managers.
    */
   @Override
-  public Set<InternalDistributedMember> getDistributionManagerIdsIncludingAdmin() {
-    // access to members synchronized under membersLock in order to
-    // ensure serialization
-    synchronized (membersLock) {
-      return membersAndAdmin;
-    }
+  public List<InternalDistributedMember> getDistributionManagerIdsIncludingAdmin() {
+    return getViewMembers();
   }
 
 
@@ -1055,18 +1020,15 @@ public class ClusterDistributionManager implements DistributionManager {
   @Override
   public InternalDistributedMember getCanonicalId(DistributedMember id) {
     // the members set is copy-on-write, so it is safe to iterate over it
-    InternalDistributedMember result = members.get(id);
-    if (result == null) {
-      return (InternalDistributedMember) id;
-    }
-    return result;
+    return membershipManager.getView().getCanonicalID(
+        (InternalDistributedMember) id);
   }
 
   /**
    * Add a membership listener and return other DistributionManagerIds as an atomic operation
    */
   @Override
-  public Set<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds(
+  public List<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds(
       MembershipListener l) {
     // switched sync order to fix bug 30360
     synchronized (membersLock) {
@@ -1076,7 +1038,7 @@ public class ClusterDistributionManager implements DistributionManager {
       addMembershipListener(l);
       // Note it is ok to return the members set
       // because we will never modify the returned set.
-      return members.keySet();
+      return getViewMembers();
     }
   }
 
@@ -1545,12 +1507,7 @@ public class ClusterDistributionManager implements DistributionManager {
 
   @Override
   public void addAdminConsole(InternalDistributedMember theId) {
-    logger.info("New administration member detected at {}.", theId);
-    synchronized (adminConsolesLock) {
-      HashSet<InternalDistributedMember> tmp = new HashSet<>(adminConsoles);
-      tmp.add(theId);
-      adminConsoles = Collections.unmodifiableSet(tmp);
-    }
+    // no-op: new members are added to the membership manager's view
   }
 
   @Override
@@ -1589,20 +1546,15 @@ public class ClusterDistributionManager implements DistributionManager {
   }
 
   @Override
-  public Set<InternalDistributedMember> addAllMembershipListenerAndGetAllIds(MembershipListener l) {
-    MembershipManager mgr = membershipManager;
-    mgr.getViewLock().writeLock().lock();
-    try {
-      synchronized (membersLock) {
-        // Don't let the members come and go while we are adding this
-        // listener. This ensures that the listener (probably a
-        // ReplyProcessor) gets a consistent view of the members.
-        addAllMembershipListener(l);
-        return getDistributionManagerIdsIncludingAdmin();
-      }
-    } finally {
-      mgr.getViewLock().writeLock().unlock();
-    }
+  public List<InternalDistributedMember> addAllMembershipListenerAndGetAllIds(
+      MembershipListener l) {
+    return membershipManager.withViewLock((manager) -> {
+      // Don't let the members come and go while we are adding this
+      // listener. This ensures that the listener (probably a
+      // ReplyProcessor) gets a consistent view of the members.
+      addAllMembershipListener(l);
+      return membershipManager.getView().getMembers();
+    });
   }
 
   /**
@@ -1829,47 +1781,14 @@ public class ClusterDistributionManager implements DistributionManager {
     String reason = p_reason;
     boolean result = false; // initialization shouldn't be required, but...
 
-    // Test once before acquiring the lock, fault tolerance for potentially
-    // recursive (and deadlock) conditions -- bug33626
-    // Note that it is always safe to _read_ {@link members} without locking
     if (isCurrentMember(theId)) {
-      // Destroy underlying member's resources
       reason = prettifyReason(reason);
-      synchronized (membersLock) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("DistributionManager: removing member <{}>; crashed {}; reason = {}", theId,
-              crashed, reason);
-        }
-        Map<InternalDistributedMember, InternalDistributedMember> tmp = new HashMap<>(members);
-        if (tmp.remove(theId) != null) {
-          // Note we don't modify in place. This allows reader to get snapshots
-          // without locking.
-          if (tmp.isEmpty()) {
-            tmp = Collections.emptyMap();
-          } else {
-            tmp = Collections.unmodifiableMap(tmp);
-          }
-          members = tmp;
-          result = true;
-
-        } else {
-          result = false;
-          // Don't get upset since this can happen twice due to
-          // an explicit remove followed by an implicit one caused
-          // by a JavaGroup view change
-        }
-        Set<InternalDistributedMember> tmp2 = new HashSet<>(membersAndAdmin);
-        if (tmp2.remove(theId)) {
-          if (tmp2.isEmpty()) {
-            tmp2 = Collections.emptySet();
-          } else {
-            tmp2 = Collections.unmodifiableSet(tmp2);
-          }
-          membersAndAdmin = tmp2;
-        }
-        removeHostedLocators(theId);
-      } // synchronized
-    } // if
+      if (logger.isDebugEnabled()) {
+        logger.debug("DistributionManager: removing member <{}>; crashed {}; reason = {}", theId,
+            crashed, reason);
+      }
+      removeHostedLocators(theId);
+    }
 
     redundancyZones.remove(theId);
 
@@ -1884,41 +1803,19 @@ public class ClusterDistributionManager implements DistributionManager {
    *
    */
   private void handleManagerStartup(InternalDistributedMember theId) {
-    HashMap<InternalDistributedMember, InternalDistributedMember> tmp;
-    synchronized (membersLock) {
-      // Note test is under membersLock
-      if (members.containsKey(theId)) {
-        return; // already accounted for
-      }
-
-      // Note we don't modify in place. This allows reader to get snapshots
-      // without locking.
-      tmp = new HashMap<>(members);
-      tmp.put(theId, theId);
-      members = Collections.unmodifiableMap(tmp);
-
-      Set<InternalDistributedMember> stmp = new HashSet<>(membersAndAdmin);
-      stmp.add(theId);
-      membersAndAdmin = Collections.unmodifiableSet(stmp);
-    } // synchronized
-
+    // Note test is under membersLock
+    if (membershipManager.getView().contains(theId)) {
+      return; // already accounted for
+    }
     if (theId.getVmKind() != ClusterDistributionManager.LOCATOR_DM_TYPE) {
       stats.incNodes(1);
     }
-    logger.info("Admitting member <{}>. Now there are {} non-admin member(s).",
-        theId, tmp.size());
     addMemberEvent(new MemberJoinedEvent(theId));
   }
 
   @Override
   public boolean isCurrentMember(DistributedMember id) {
-    Set m;
-    synchronized (membersLock) {
-      // access to members synchronized under membersLock in order to
-      // ensure serialization
-      m = membersAndAdmin;
-    }
-    return m.contains(id);
+    return membershipManager.getView().contains(id);
   }
 
   /**
@@ -1926,27 +1823,11 @@ public class ClusterDistributionManager implements DistributionManager {
    *
    */
   private void handleConsoleStartup(InternalDistributedMember theId) {
-    // if we have an all listener then notify it NOW.
-    HashSet<InternalDistributedMember> tmp;
-    synchronized (membersLock) {
-      // Note test is under membersLock
-      if (membersAndAdmin.contains(theId))
-        return; // already accounted for
-
-      // Note we don't modify in place. This allows reader to get snapshots
-      // without locking.
-      tmp = new HashSet<>(membersAndAdmin);
-      tmp.add(theId);
-      membersAndAdmin = Collections.unmodifiableSet(tmp);
-    } // synchronized
-
     for (MembershipListener listener : allMembershipListeners) {
       listener.memberJoined(this, theId);
     }
     logger.info("DMMembership: Admitting new administration member < {} >.",
         theId);
-    // Note that we don't add the member to the list of admin consoles until
-    // we receive a message from them.
   }
 
   /**
@@ -1974,64 +1855,10 @@ public class ClusterDistributionManager implements DistributionManager {
    */
   public void handleConsoleShutdown(InternalDistributedMember theId, boolean crashed,
       String reason) {
-    boolean removedConsole = false;
-    boolean removedMember = false;
-    synchronized (membersLock) {
-      // to fix bug 39747 we can only remove this member from
-      // membersAndAdmin if it is not in members.
-      // This happens when we have an admin member colocated with a normal DS.
-      // In this case we need for the normal DS to shutdown or crash.
-      if (!members.containsKey(theId)) {
-        if (logger.isDebugEnabled())
-          logger.debug("DistributionManager: removing admin member <{}>; crashed = {}; reason = {}",
-              theId, crashed, reason);
-        Set<InternalDistributedMember> tmp = new HashSet<>(membersAndAdmin);
-        if (tmp.remove(theId)) {
-          // Note we don't modify in place. This allows reader to get snapshots
-          // without locking.
-          if (tmp.isEmpty()) {
-            tmp = Collections.emptySet();
-          } else {
-            tmp = Collections.unmodifiableSet(tmp);
-          }
-          membersAndAdmin = tmp;
-          removedMember = true;
-        } else {
-          // Don't get upset since this can happen twice due to
-          // an explicit remove followed by an implicit one caused
-          // by a JavaGroup view change
-        }
-      }
-      removeHostedLocators(theId);
-    }
-    synchronized (adminConsolesLock) {
-      if (adminConsoles.contains(theId)) {
-        removedConsole = true;
-        Set<InternalDistributedMember> tmp = new HashSet<>(adminConsoles);
-        tmp.remove(theId);
-        if (tmp.isEmpty()) {
-          tmp = Collections.emptySet();
-        } else {
-          tmp = Collections.unmodifiableSet(tmp);
-        }
-        adminConsoles = tmp;
-      }
-    }
-    if (removedMember) {
-      for (MembershipListener listener : allMembershipListeners) {
-        listener.memberDeparted(this, theId, crashed);
-      }
-    }
-    if (removedConsole) {
-      String msg;
-      if (crashed) {
-        msg = "Administration member at {} crashed: {}";
-      } else {
-        msg = "Administration member at {} closed: {}";
-      }
-      logger.info(msg, new Object[] {theId, reason});
+    removeHostedLocators(theId);
+    for (MembershipListener listener : allMembershipListeners) {
+      listener.memberDeparted(this, theId, crashed);
     }
-
     redundancyZones.remove(theId);
   }
 
@@ -2394,14 +2221,16 @@ public class ClusterDistributionManager implements DistributionManager {
 
   @Override
   public Set<InternalDistributedMember> getAdminMemberSet() {
-    return adminConsoles;
+    return membershipManager.getView().getMembers().stream()
+        .filter((id) -> id.getVmKind() == ADMIN_ONLY_DM_TYPE).collect(
+            Collectors.toSet());
   }
 
   /** Returns count of members filling the specified role */
   @Override
   public int getRoleCount(Role role) {
     int count = 0;
-    Set<InternalDistributedMember> mbrs = getDistributionManagerIds();
+    List<InternalDistributedMember> mbrs = getDistributionManagerIds();
     for (InternalDistributedMember mbr : mbrs) {
       Set<Role> roles = (mbr).getRoles();
       for (Role mbrRole : roles) {
@@ -2417,7 +2246,7 @@ public class ClusterDistributionManager implements DistributionManager {
   /** Returns true if at least one member is filling the specified role */
   @Override
   public boolean isRolePresent(Role role) {
-    Set<InternalDistributedMember> mbrs = getDistributionManagerIds();
+    List<InternalDistributedMember> mbrs = getDistributionManagerIds();
     for (InternalDistributedMember mbr : mbrs) {
       Set<Role> roles = mbr.getRoles();
       for (Role mbrRole : roles) {
@@ -2433,7 +2262,7 @@ public class ClusterDistributionManager implements DistributionManager {
   @Override
   public Set<Role> getAllRoles() {
     Set<Role> allRoles = new HashSet<>();
-    Set<InternalDistributedMember> mbrs = getDistributionManagerIds();
+    List<InternalDistributedMember> mbrs = getDistributionManagerIds();
     for (InternalDistributedMember mbr : mbrs) {
       allRoles.addAll(mbr.getRoles());
     }
@@ -2779,14 +2608,14 @@ public class ClusterDistributionManager implements DistributionManager {
    * @since GemFire 5.9
    */
   @Override
-  public Set<InternalDistributedMember> getMembersInThisZone() {
+  public List<InternalDistributedMember> getMembersInThisZone() {
     return getMembersInSameZone(getDistributionManagerId());
   }
 
   @Override
-  public Set<InternalDistributedMember> getMembersInSameZone(
+  public List<InternalDistributedMember> getMembersInSameZone(
       InternalDistributedMember targetMember) {
-    Set<InternalDistributedMember> buddyMembers = new HashSet<>();
+    List<InternalDistributedMember> buddyMembers = new LinkedList<>();
     if (!redundancyZones.isEmpty()) {
       synchronized (redundancyZones) {
         String targetZone = redundancyZones.get(targetMember);
@@ -2896,33 +2725,17 @@ public class ClusterDistributionManager implements DistributionManager {
   }
 
   @Override
-  public Set<InternalDistributedMember> getNormalDistributionManagerIds() {
-    // access to members synchronized under membersLock in order to
-    // ensure serialization
-    synchronized (membersLock) {
-      HashSet<InternalDistributedMember> result = new HashSet<>();
-      for (InternalDistributedMember m : members.keySet()) {
-        if (m.getVmKind() != ClusterDistributionManager.LOCATOR_DM_TYPE) {
-          result.add(m);
-        }
-      }
-      return result;
-    }
+  public List<InternalDistributedMember> getNormalDistributionManagerIds() {
+    return membershipManager.getView().getMembers().stream()
+        .filter((id) -> id.getVmKind() != LOCATOR_DM_TYPE).collect(
+            Collectors.toList());
   }
 
   /** test method to get the member IDs of all locators in the distributed system */
   public Set<InternalDistributedMember> getLocatorDistributionManagerIds() {
-    // access to members synchronized under membersLock in order to
-    // ensure serialization
-    synchronized (membersLock) {
-      HashSet<InternalDistributedMember> result = new HashSet<>();
-      for (InternalDistributedMember m : members.keySet()) {
-        if (m.getVmKind() == ClusterDistributionManager.LOCATOR_DM_TYPE) {
-          result.add(m);
-        }
-      }
-      return result;
-    }
+    return membershipManager.getView().getMembers().stream()
+        .filter((id) -> id.getVmKind() == LOCATOR_DM_TYPE).collect(
+            Collectors.toSet());
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
index 86d59bb..d69e832 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
@@ -87,13 +87,13 @@ public interface DistributionManager extends ReplySender {
    * Returns an unmodifiable set containing the identities of all of the known distribution
    * managers. As of 7.0 this includes locators since they have a cache.
    */
-  Set<InternalDistributedMember> getDistributionManagerIds();
+  List<InternalDistributedMember> getDistributionManagerIds();
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known "normal" distribution
    * managers. This does not include locators or admin members.
    */
-  Set<InternalDistributedMember> getNormalDistributionManagerIds();
+  List<InternalDistributedMember> getNormalDistributionManagerIds();
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known distribution managers
@@ -101,7 +101,7 @@ public interface DistributionManager extends ReplySender {
    *
    * @since GemFire 5.7
    */
-  Set<InternalDistributedMember> getDistributionManagerIdsIncludingAdmin();
+  List<InternalDistributedMember> getDistributionManagerIdsIncludingAdmin();
 
   /**
    * Returns a private-memory list containing getDistributionManagerIds() minus our id.
@@ -116,7 +116,7 @@ public interface DistributionManager extends ReplySender {
   /**
    * Add a membership listener and return other DistributionManagerIds as an atomic operation
    */
-  Set<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds(
+  List<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds(
       MembershipListener l);
 
   /**
@@ -125,7 +125,7 @@ public interface DistributionManager extends ReplySender {
    *
    * @since GemFire 5.7
    */
-  Set<InternalDistributedMember> addAllMembershipListenerAndGetAllIds(MembershipListener l);
+  List<InternalDistributedMember> addAllMembershipListenerAndGetAllIds(MembershipListener l);
 
   /**
    * Returns the identity of this <code>DistributionManager</code>
@@ -308,7 +308,7 @@ public interface DistributionManager extends ReplySender {
    * @return set of {@link InternalDistributedMember} including this VM
    * @since GemFire 5.9
    */
-  Set<InternalDistributedMember> getMembersInThisZone();
+  List<InternalDistributedMember> getMembersInThisZone();
 
   /**
    * Acquire a permit to request a GII from another member
@@ -324,7 +324,7 @@ public interface DistributionManager extends ReplySender {
 
   boolean enforceUniqueZone();
 
-  Set<InternalDistributedMember> getMembersInSameZone(InternalDistributedMember acceptedMember);
+  List<InternalDistributedMember> getMembersInSameZone(InternalDistributedMember acceptedMember);
 
   boolean areInSameZone(InternalDistributedMember member1, InternalDistributedMember member2);
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
index 66c3e2a..a1c6974 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
@@ -1805,7 +1805,7 @@ public class InternalDistributedSystem extends DistributedSystem
 
   @Override
   public Set<DistributedMember> findDistributedMembers(InetAddress address) {
-    Set<InternalDistributedMember> allMembers = dm.getDistributionManagerIdsIncludingAdmin();
+    List<InternalDistributedMember> allMembers = dm.getDistributionManagerIdsIncludingAdmin();
     Set<DistributedMember> results = new HashSet<>(2);
 
     // Search through the set of all members
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
index c25996b..5754729 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
@@ -89,7 +89,7 @@ public class LonerDistributionManager implements DistributionManager {
     this.system = system;
     this.logger = logger;
     this.localAddress = generateMemberId();
-    this.allIds = Collections.singleton(localAddress);
+    this.allIds = Collections.singletonList(localAddress);
     this.viewMembers = new ArrayList<>(allIds);
     DistributionStats.enableClockStats = this.system.getConfig().getEnableTimeStatistics();
 
@@ -118,7 +118,7 @@ public class LonerDistributionManager implements DistributionManager {
 
   private final InternalDistributedMember localAddress;
 
-  private final Set<InternalDistributedMember> allIds;// = Collections.singleton(id);
+  private final List<InternalDistributedMember> allIds;
   private final List<InternalDistributedMember> viewMembers;
   private ConcurrentMap<InternalDistributedMember, InternalDistributedMember> canonicalIds =
       new ConcurrentHashMap<>();
@@ -140,12 +140,12 @@ public class LonerDistributionManager implements DistributionManager {
   }
 
   @Override
-  public Set<InternalDistributedMember> getDistributionManagerIds() {
+  public List<InternalDistributedMember> getDistributionManagerIds() {
     return allIds;
   }
 
   @Override
-  public Set<InternalDistributedMember> getDistributionManagerIdsIncludingAdmin() {
+  public List<InternalDistributedMember> getDistributionManagerIdsIncludingAdmin() {
     return allIds;
   }
 
@@ -211,14 +211,15 @@ public class LonerDistributionManager implements DistributionManager {
 
 
   @Override
-  public Set<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds(
+  public List<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds(
       MembershipListener l) {
     // return getOtherDistributionManagerIds();
     return allIds;
   }
 
   @Override
-  public Set<InternalDistributedMember> addAllMembershipListenerAndGetAllIds(MembershipListener l) {
+  public List<InternalDistributedMember> addAllMembershipListenerAndGetAllIds(
+      MembershipListener l) {
     return allIds;
   }
 
@@ -1319,7 +1320,7 @@ public class LonerDistributionManager implements DistributionManager {
    * @since GemFire 5.9
    */
   @Override
-  public Set<InternalDistributedMember> getMembersInThisZone() {
+  public List<InternalDistributedMember> getMembersInThisZone() {
     return this.allIds;
   }
 
@@ -1353,9 +1354,9 @@ public class LonerDistributionManager implements DistributionManager {
   }
 
   @Override
-  public Set<InternalDistributedMember> getMembersInSameZone(
+  public List<InternalDistributedMember> getMembersInSameZone(
       InternalDistributedMember acceptedMember) {
-    return Collections.singleton(acceptedMember);
+    return Collections.singletonList(acceptedMember);
   }
 
   @Override
@@ -1391,7 +1392,7 @@ public class LonerDistributionManager implements DistributionManager {
   }
 
   @Override
-  public Set<InternalDistributedMember> getNormalDistributionManagerIds() {
+  public List<InternalDistributedMember> getNormalDistributionManagerIds() {
     return getDistributionManagerIds();
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
index 9b4963b..9151fa5 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
@@ -427,7 +427,7 @@ public class ReplyProcessor21 implements MembershipListener {
     if (!removeMember(sender, false) && warn) {
       // if the member hasn't left the system, something is wrong
       final DistributionManager dm = getDistributionManager(); // fix for bug 33253
-      Set ids = getDistributionManagerIds();
+      List ids = getDistributionManagerIds();
       if (ids == null || ids.contains(sender)) {
         List viewMembers = dm.getViewMembers();
         if (system.getConfig().getMcastPort() == 0 // could be using multicast & will get responses
@@ -543,7 +543,7 @@ public class ReplyProcessor21 implements MembershipListener {
    * @return a Set of the current members
    * @since GemFire 5.7
    */
-  protected Set addListenerAndGetMembers() {
+  protected List addListenerAndGetMembers() {
     return getDistributionManager().addMembershipListenerAndGetDistributionManagerIds(this);
   }
 
@@ -566,7 +566,7 @@ public class ReplyProcessor21 implements MembershipListener {
    * @return a Set of the current members
    * @since GemFire 5.7
    */
-  protected Set getDistributionManagerIds() {
+  protected List getDistributionManagerIds() {
     return getDistributionManager().getDistributionManagerIds();
   }
 
@@ -575,7 +575,7 @@ public class ReplyProcessor21 implements MembershipListener {
     DistributionManager mgr = getDistributionManager();
     statStart = mgr.getStats().startReplyWait();
     synchronized (this.members) {
-      Set activeMembers = addListenerAndGetMembers();
+      List activeMembers = addListenerAndGetMembers();
       processActiveMembers(activeMembers);
     }
   }
@@ -585,7 +585,7 @@ public class ReplyProcessor21 implements MembershipListener {
    *
    * @param activeMembers the DM's current membership set
    */
-  protected void processActiveMembers(Set activeMembers) {
+  protected void processActiveMembers(List activeMembers) {
     for (int i = 0; i < this.members.length; i++) {
       if (this.members[i] != null) {
         if (!activeMembers.contains(this.members[i])) {
@@ -1064,7 +1064,7 @@ public class ReplyProcessor21 implements MembershipListener {
     if (!this.processTimeout())
       return;
 
-    Set activeMembers = getDistributionManagerIds();
+    List activeMembers = getDistributionManagerIds();
 
     // an alert that will show up in the console
     long timeout = getAckWaitThreshold();
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialAckedMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialAckedMessage.java
index 2233425..c602830 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialAckedMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialAckedMessage.java
@@ -17,6 +17,7 @@ package org.apache.geode.distributed.internal;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -63,7 +64,8 @@ public class SerialAckedMessage extends SerialDistributionMessage implements Mes
    * @throws InterruptedException if the operation is interrupted (as by shutdown)
    * @throws ReplyException if an exception was sent back by another manager
    */
-  public void send(Set recipients, boolean multicast) throws InterruptedException, ReplyException {
+  public void send(Collection recipients, boolean multicast)
+      throws InterruptedException, ReplyException {
     final boolean isDebugEnabled = logger.isDebugEnabled();
 
     if (Thread.interrupted())
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
index 383ab6f..e74af61 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
@@ -24,7 +24,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 import java.util.concurrent.Semaphore;
 
 import org.apache.logging.log4j.Logger;
@@ -646,7 +645,7 @@ public class DirectChannel {
    */
   private void handleAckTimeout(long ackTimeout, long ackSATimeout, Connection c,
       DirectReplyProcessor processor) throws ConnectionException {
-    Set activeMembers = dm.getDistributionManagerIds();
+    List activeMembers = dm.getDistributionManagerIds();
 
     // Increment the stat
     dm.getStats().incReplyTimeouts();
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java
index 9851322..09ce11b 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java
@@ -873,7 +873,7 @@ public class DLockGrantor {
 
     try {
       synchronized (this.grantTokens) {
-        Set members = this.dlock.getDistributionManager().getDistributionManagerIds();
+        List members = this.dlock.getDistributionManager().getDistributionManagerIds();
 
         final boolean isDebugEnabled_DLS = logger.isTraceEnabled(LogMarker.DLS_VERBOSE);
         for (Iterator iter = tokens.iterator(); iter.hasNext();) {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRecoverGrantorProcessor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRecoverGrantorProcessor.java
index 487cc8c..6e20a9c 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRecoverGrantorProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRecoverGrantorProcessor.java
@@ -20,6 +20,7 @@ import java.io.DataOutput;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.logging.log4j.Logger;
@@ -69,7 +70,7 @@ public class DLockRecoverGrantorProcessor extends ReplyProcessor21 {
    * <p>
    * This method should block until transfer of lock grantor has completed.
    */
-  static boolean recoverLockGrantor(Set members, DLockService service, DLockGrantor newGrantor,
+  static boolean recoverLockGrantor(List members, DLockService service, DLockGrantor newGrantor,
       DistributionManager dm, InternalDistributedMember elder) {
     // proc will wait for replies from everyone including THIS member...
     DLockRecoverGrantorProcessor processor =
@@ -114,7 +115,7 @@ public class DLockRecoverGrantorProcessor extends ReplyProcessor21 {
   // -------------------------------------------------------------------------
 
   /** Creates a new instance of DLockRecoverGrantorProcessor */
-  private DLockRecoverGrantorProcessor(DistributionManager dm, Set members,
+  private DLockRecoverGrantorProcessor(DistributionManager dm, List members,
       DLockGrantor newGrantor) {
     super(dm, members);
     this.dm = dm;
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipView.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipView.java
index 096b62d..52f0122 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipView.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MembershipView.java
@@ -21,6 +21,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.geode.UnmodifiableException;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 
@@ -36,11 +37,12 @@ public class MembershipView {
   private Set<InternalDistributedMember> crashedMembers;
   private InternalDistributedMember creator;
   private Set<InternalDistributedMember> hashedMembers;
+  private volatile boolean unmodifiable;
 
 
   public MembershipView() {
-    viewId = 0;
-    members = new ArrayList<>(4);
+    viewId = -1;
+    members = new ArrayList<>(0);
     this.hashedMembers = new HashSet<>(members);
     shutdownMembers = Collections.emptySet();
     crashedMembers = new HashSet<>();
@@ -80,6 +82,10 @@ public class MembershipView {
     this.crashedMembers = crashes;
   }
 
+  public void makeUnmodifiable() {
+    unmodifiable = true;
+  }
+
   public int getViewId() {
     return this.viewId;
   }
@@ -116,16 +122,25 @@ public class MembershipView {
   }
 
   public void add(InternalDistributedMember mbr) {
+    if (unmodifiable) {
+      throw new UnmodifiableException("this membership view is not modifiable");
+    }
     this.hashedMembers.add(mbr);
     this.members.add(mbr);
   }
 
   public boolean remove(InternalDistributedMember mbr) {
+    if (unmodifiable) {
+      throw new UnmodifiableException("this membership view is not modifiable");
+    }
     this.hashedMembers.remove(mbr);
     return this.members.remove(mbr);
   }
 
   public void removeAll(Collection<InternalDistributedMember> ids) {
+    if (unmodifiable) {
+      throw new UnmodifiableException("this membership view is not modifiable");
+    }
     this.hashedMembers.removeAll(ids);
     ids.forEach(this::remove);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java
index 09d4847..ca9811a 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java
@@ -36,6 +36,7 @@ import java.util.concurrent.TimeoutException;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.function.Function;
 
 import org.apache.logging.log4j.Logger;
 
@@ -257,7 +258,7 @@ public class GMSMembershipManager implements MembershipManager {
    *
    * All accesses to this object are protected via {@link #latestViewLock}
    */
-  private MembershipView latestView = new MembershipView();
+  private volatile MembershipView latestView = new MembershipView();
 
   /**
    * This is the lock for protecting access to latestView
@@ -462,18 +463,18 @@ public class GMSMembershipManager implements MembershipManager {
       }
       disableMulticastForRollingUpgrade = !version.equals(Version.CURRENT);
 
-      if (newViewId < latestViewId) {
+      // Save previous view, for delta analysis
+      MembershipView priorView = latestView;
+
+      if (newViewId < priorView.getViewId()) {
         // ignore this view since it is old news
         return;
       }
 
-      // Save previous view, for delta analysis
-      MembershipView priorView = latestView;
-
       // update the view to reflect our changes, so that
       // callbacks will see the new (updated) view.
-      latestViewId = newViewId;
-      latestView = new MembershipView(newView, newView.getViewId());
+      long newlatestViewId = newViewId;
+      MembershipView newlatestView = new MembershipView(newView, newView.getViewId());
 
       // look for additions
       for (int i = 0; i < newView.getMembers().size(); i++) { // additions
@@ -598,15 +599,12 @@ public class GMSMembershipManager implements MembershipManager {
           removeWithViewLock(m, true,
               "not seen in membership view in " + this.surpriseMemberTimeout + "ms");
         } else {
-          if (!latestView.contains(entry.getKey())) {
-            latestView.add(entry.getKey());
+          if (!newlatestView.contains(entry.getKey())) {
+            newlatestView.add(entry.getKey());
           }
         }
       }
       // expire suspected members
-      /*
-       * the timeout interval for suspected members
-       */
       final long suspectMemberTimeout = 180000;
       oldestAllowed = System.currentTimeMillis() - suspectMemberTimeout;
       for (Iterator it = suspectedMembers.entrySet().iterator(); it.hasNext();) {
@@ -616,6 +614,10 @@ public class GMSMembershipManager implements MembershipManager {
           it.remove();
         }
       }
+
+      // the view is complete - let's install it
+      newlatestView.makeUnmodifiable();
+      latestView = newlatestView;
       try {
         listener.viewInstalled(latestView);
       } catch (DistributedSystemDisconnectedException se) {
@@ -668,6 +670,7 @@ public class GMSMembershipManager implements MembershipManager {
 
         MembershipView initialView = createGeodeView(services.getJoinLeave().getView());
         latestView = new MembershipView(initialView, initialView.getViewId());
+        latestView.makeUnmodifiable();
         listener.viewInstalled(latestView);
 
       } catch (RuntimeException ex) {
@@ -688,9 +691,11 @@ public class GMSMembershipManager implements MembershipManager {
   }
 
   private MembershipView createGeodeView(GMSMembershipView view) {
-    return createGeodeView(view.getCreator(), view.getViewId(), view.getMembers(),
+    MembershipView result = createGeodeView(view.getCreator(), view.getViewId(), view.getMembers(),
         view.getShutdownMembers(),
         view.getCrashedMembers());
+    result.makeUnmodifiable();
+    return result;
   }
 
   private MembershipView createGeodeView(GMSMember gmsCreator, int viewId,
@@ -903,6 +908,7 @@ public class GMSMembershipManager implements MembershipManager {
         // view.
         MembershipView newMembers = new MembershipView(latestView, latestView.getViewId());
         newMembers.add(member);
+        newMembers.makeUnmodifiable();
         latestView = newMembers;
       }
     } finally {
@@ -1285,16 +1291,8 @@ public class GMSMembershipManager implements MembershipManager {
   @Override
   public MembershipView getView() {
     // Grab the latest view under a mutex...
-    MembershipView v;
-
-    latestViewReadLock.lock();
-    v = latestView;
-    latestViewReadLock.unlock();
-
+    MembershipView v = latestView;
     MembershipView result = new MembershipView(v, v.getViewId());
-
-    v.getMembers().stream().filter(this::isShunned).forEachOrdered(result::remove);
-
     return result;
   }
 
@@ -1803,6 +1801,7 @@ public class GMSMembershipManager implements MembershipManager {
       if (latestView.contains(member)) {
         MembershipView newView = new MembershipView(latestView, latestView.getViewId());
         newView.remove(member);
+        newView.makeUnmodifiable();
         latestView = newView;
       }
     } finally {
@@ -1877,6 +1876,11 @@ public class GMSMembershipManager implements MembershipManager {
     }
   }
 
+  @Override
+  public <T> T withViewLock(Function function) {
+    return (T) function.apply(this);
+  }
+
   private boolean isShunnedOrNew(final InternalDistributedMember m) {
     latestViewReadLock.lock();
     try {
@@ -2504,8 +2508,8 @@ public class GMSMembershipManager implements MembershipManager {
     /* Service interface */
     @Override
     public void installView(GMSMembershipView v) {
-      if (latestViewId < 0 && !isConnected()) {
-        latestViewId = v.getViewId();
+      MembershipView currentView = latestView;
+      if (currentView.getViewId() < 0 && !isConnected()) {
         latestView = createGeodeView(v);
         logger.debug("MembershipManager: initial view is {}", latestView);
       } else {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/api/Membership.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/api/Membership.java
index 7c3de02..0f02758 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/api/Membership.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/api/Membership.java
@@ -17,6 +17,7 @@ package org.apache.geode.distributed.internal.membership.gms.api;
 import java.io.NotSerializableException;
 import java.util.Map;
 import java.util.Set;
+import java.util.function.Function;
 
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DistributionMessage;
@@ -95,4 +96,6 @@ public interface Membership {
    * Returns true if the member is being shunned
    */
   boolean isShunned(DistributedMember m);
+
+  <T> T withViewLock(Function function);
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java b/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java
index 66034b6..b57c292 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java
@@ -495,7 +495,7 @@ public class SystemAdmin {
     }
     InternalDistributedSystem ds =
         (InternalDistributedSystem) InternalDistributedSystem.connectForAdmin(props);
-    Set existingMembers = ds.getDistributionManager().getDistributionManagerIds();
+    List existingMembers = ds.getDistributionManager().getDistributionManagerIds();
     if (existingMembers.isEmpty()) {
       throw new RuntimeException("There are no members in the distributed system");
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java
index 401a97f..e95f327 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java
@@ -872,8 +872,8 @@ class RemoteGfManagerAgent implements GfManagerAgent {
     synchronized (this.myMembershipListenerLock) {
       this.myMembershipListener = new MyMembershipListener();
       dm.addMembershipListener(this.myMembershipListener);
-      Set initialMembers = dm.getDistributionManagerIds();
-      this.myMembershipListener.addMembers(initialMembers);
+      List initialMembers = dm.getDistributionManagerIds();
+      this.myMembershipListener.addMembers(new HashSet(initialMembers));
 
       if (logger.isDebugEnabled()) {
         StringBuffer sb = new StringBuffer("[RemoteGfManagerAgent] ");
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java
index 943f423..6cb3839 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java
@@ -68,7 +68,7 @@ public class InitialImageFlowControl implements MembershipListener {
     int id = keeper.put(control);
     control.id = id;
 
-    Set availableIds = dm.addMembershipListenerAndGetDistributionManagerIds(control);
+    List availableIds = dm.addMembershipListenerAndGetDistributionManagerIds(control);
     if (!availableIds.contains(target)) {
       control.abort();
     }
@@ -125,7 +125,7 @@ public class InitialImageFlowControl implements MembershipListener {
     if (!aborted.get() && !permits.tryAcquire(timeout - timeSoFar - 1, TimeUnit.MILLISECONDS)) {
       checkCancellation();
 
-      Set activeMembers = dm.getDistributionManagerIds();
+      List activeMembers = dm.getDistributionManagerIds();
       logger.warn(
           "{} seconds have elapsed while waiting for replies: {} on {} whose current membership list is: [{}]",
           getAckWaitThreshold(), this, dm.getId(), activeMembers);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
index 5a0086f..76c063c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
@@ -630,7 +630,7 @@ public class PRHARedundancyProvider {
               // enforceUniqueZone property has no effect for a loner
               if (!(partitionedRegion
                   .getDistributionManager() instanceof LonerDistributionManager)) {
-                Set<InternalDistributedMember> exm = getBuddyMembersInZone(candidate, allStores);
+                List<InternalDistributedMember> exm = getBuddyMembersInZone(candidate, allStores);
                 exm.remove(candidate);
                 exm.removeAll(acceptedMembers);
                 excludedMembers.addAll(exm);
@@ -902,10 +902,10 @@ public class PRHARedundancyProvider {
    * @return set of members on the same host, not including accepted member
    * @since GemFire 5.9
    */
-  private Set<InternalDistributedMember> getBuddyMembersInZone(
+  private List<InternalDistributedMember> getBuddyMembersInZone(
       InternalDistributedMember acceptedMember, Collection<InternalDistributedMember> allStores) {
     DistributionManager dm = partitionedRegion.getDistributionManager();
-    Set<InternalDistributedMember> buddies = dm.getMembersInSameZone(acceptedMember);
+    List<InternalDistributedMember> buddies = dm.getMembersInSameZone(acceptedMember);
     buddies.retainAll(allStores);
     return buddies;
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionBucketMgmtHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionBucketMgmtHelper.java
index 9c9e582..dceb46a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionBucketMgmtHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionBucketMgmtHelper.java
@@ -16,6 +16,7 @@
 package org.apache.geode.internal.cache;
 
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -39,7 +40,7 @@ class PartitionedRegionBucketMgmtHelper {
     if (b.getDistributionManager().enforceUniqueZone()) {
       Set<InternalDistributedMember> hostingMembers = b.getBucketOwners();
       Set<InternalDistributedMember> buddyMembers =
-          b.getDistributionManager().getMembersInThisZone();
+          new HashSet(b.getDistributionManager().getMembersInThisZone());
       boolean disjoint = Collections.disjoint(hostingMembers, buddyMembers);
       boolean sourceIsOneThisHost = moveSource != null && buddyMembers.contains(moveSource);
       return disjoint || sourceIsOneThisHost;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
index 8bfc5ee..4caa9ea 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
@@ -846,7 +846,7 @@ public class PartitionedRegionHelper {
     if (prConfig == null)
       return;
 
-    Set members = partitionedRegion.getDistributionManager().getDistributionManagerIds();
+    List members = partitionedRegion.getDistributionManager().getDistributionManagerIds();
     logger.warn(
         "DATALOSS (  {}  ) :: Size of nodeList After verifyBucketNodes for bucket ID,  {}  is 0",
         callingMethod, bucketId);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
index fba73c6..6c92035 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -776,7 +777,7 @@ public class StateFlushOperation {
     }
 
     @Override
-    protected void processActiveMembers(Set activeMembers) {
+    protected void processActiveMembers(List activeMembers) {
       super.processActiveMembers(activeMembers);
       if (!activeMembers.contains(this.targetMember)) {
         targetMemberHasLeft = true;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXFarSideCMTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXFarSideCMTracker.java
index 0fb2404..efd8ec8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXFarSideCMTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXFarSideCMTracker.java
@@ -228,7 +228,7 @@ public class TXFarSideCMTracker {
           Set<InternalDistributedMember> failures, List<InternalDistributedMember> remaining) {}
     };
     try {
-      Set memberSet = dm.addMembershipListenerAndGetDistributionManagerIds(memEar);
+      List memberSet = dm.addMembershipListenerAndGetDistributionManagerIds(memEar);
 
       // Still need to wait
       synchronized (lock) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateAttributesProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateAttributesProcessor.java
index d7451ef..1b49b5b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateAttributesProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateAttributesProcessor.java
@@ -192,7 +192,7 @@ public class UpdateAttributesProcessor {
      * @since GemFire 5.7
      */
     @Override
-    protected Set addListenerAndGetMembers() {
+    protected List addListenerAndGetMembers() {
       DistributionAdvisor da = UpdateAttributesProcessor.this.advisee.getDistributionAdvisor();
       if (da.useAdminMembersForDefault()) {
         return getDistributionManager().addAllMembershipListenerAndGetAllIds(this);
@@ -223,7 +223,7 @@ public class UpdateAttributesProcessor {
      * @since GemFire 5.7
      */
     @Override
-    protected Set getDistributionManagerIds() {
+    protected List getDistributionManagerIds() {
       DistributionAdvisor da = UpdateAttributesProcessor.this.advisee.getDistributionAdvisor();
       if (da.useAdminMembersForDefault()) {
         return getDistributionManager().getDistributionManagerIdsIncludingAdmin();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupService.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupService.java
index dbc9890..dd8ee3c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupService.java
@@ -120,7 +120,7 @@ public class BackupService {
   void validateRequestingSender(InternalDistributedMember sender) {
     // We need to watch for pure admin members that depart. this allMembershipListener set
     // looks like it should receive those events.
-    Set allIds =
+    List allIds =
         cache.getDistributionManager().addAllMembershipListenerAndGetAllIds(membershipListener);
     if (!allIds.contains(sender)) {
       cleanup();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
index 573c40c..80fbfbd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
@@ -44,8 +44,9 @@ public class MemberFunctionExecutor extends AbstractExecution {
   private ServerToClientFunctionResultSender sender;
 
   MemberFunctionExecutor(DistributedSystem distributedSystem) {
-    this(distributedSystem, ((InternalDistributedSystem) distributedSystem).getDistributionManager()
-        .getNormalDistributionManagerIds());
+    this(distributedSystem,
+        new HashSet(((InternalDistributedSystem) distributedSystem).getDistributionManager()
+            .getNormalDistributionManagerIds()));
   }
 
   MemberFunctionExecutor(DistributedSystem distributedSystem, DistributedMember distributedMember) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/ExplicitMoveDirector.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/ExplicitMoveDirector.java
index e7be1e5..069ae98 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/ExplicitMoveDirector.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/ExplicitMoveDirector.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.internal.cache.partitioned.rebalance;
 
-import java.util.Set;
+import java.util.List;
 
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystem;
@@ -89,7 +89,7 @@ public class ExplicitMoveDirector extends RebalanceDirectorAdapter {
     if (reason.willAccept()) {
       if (!model.moveBucket(new Move(sourceMember, targetMember, bucket))) {
         // Double check to see if the source or destination have left the DS
-        Set allMembers = ds.getDistributionManager().getDistributionManagerIdsIncludingAdmin();
+        List allMembers = ds.getDistributionManager().getDistributionManagerIdsIncludingAdmin();
         if (!allMembers.contains(sourceMember)) {
           throw new IllegalStateException(
               String.format(
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java
index ed0c110..9c16916 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java
@@ -168,7 +168,7 @@ public class PersistentMemberManager {
     // Add a membership listener to make sure we cancel the pending
     // revoke if the sender goes away.
     // DO this outside the synch block to avoid lock ordering issues.
-    Set members = dm.addMembershipListenerAndGetDistributionManagerIds(membershipListener);
+    List members = dm.addMembershipListenerAndGetDistributionManagerIds(membershipListener);
     if (!members.contains(sender) && sender.equals(dm.getId())) {
       cancelRevoke(pattern);
       return false;
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupServiceTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupServiceTest.java
index 9c4979c..3d3da94 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupServiceTest.java
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.when;
 
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.HashSet;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -54,7 +53,7 @@ public class BackupServiceTest {
     when(cache.getInternalDistributedSystem()).thenReturn(distributedSystem);
     when(distributedMember.toString()).thenReturn("member");
     when(distributionManager.addAllMembershipListenerAndGetAllIds(any()))
-        .thenReturn(new HashSet<>(Arrays.asList(sender)));
+        .thenReturn(Arrays.asList(sender));
 
     backupService = new BackupService(cache);
   }


[geode] 01/02: GEODE-7196 Simplify ClusterDistributionManage

Posted by bs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8e5130a16c05ee25a9be7ebb50fcc845938bc848
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Thu Sep 12 11:05:31 2019 -0700

    GEODE-7196 Simplify ClusterDistributionManage
    
    Initial commit - move executors out of ClusterDistributionManager /
    LonerDistributionManager.  The executors are still owned by the
    distribution manager but no longer clutter up the class.
---
 .../geode/ClusterCommunicationsDUnitTest.java      |   3 +-
 .../distributed/DistributedSystemDUnitTest.java    |  23 +-
 .../NestedFunctionExecutionDistributedTest.java    |   2 +-
 .../internal/ClusterDistributionManager.java       | 953 +--------------------
 .../internal/ClusterOperationExecutors.java        | 921 ++++++++++++++++++++
 .../distributed/internal/DistributionManager.java  |  31 +-
 .../distributed/internal/DistributionMessage.java  |   8 +-
 .../internal/FunctionExecutionPooledExecutor.java  |  31 +-
 .../internal/HighPriorityAckedMessage.java         |   3 +-
 .../internal/HighPriorityDistributionMessage.java  |   2 +-
 .../distributed/internal/InternalLocator.java      |   2 +-
 .../internal/LonerDistributionManager.java         |  37 +-
 .../internal/LonerOperationExecutors.java          |  64 ++
 .../distributed/internal/OperationExecutors.java   |  72 ++
 .../internal/PooledDistributionMessage.java        |   2 +-
 .../internal/SerialDistributionMessage.java        |   2 +-
 .../geode/distributed/internal/StartupMessage.java |   2 +-
 .../internal/StartupResponseMessage.java           |   2 +-
 .../internal/WaitForViewInstallation.java          |   2 +-
 .../distributed/internal/locks/DLockGrantor.java   |   2 +-
 .../internal/locks/DLockQueryProcessor.java        |   2 +-
 .../internal/locks/DLockReleaseProcessor.java      |   2 +-
 .../internal/locks/DLockRequestProcessor.java      |   2 +-
 .../membership/adapter/GMSMembershipManager.java   |   5 +-
 .../membership/adapter/GMSMessageAdapter.java      |   4 +-
 .../membership/adapter/LocalViewMessage.java       |   3 +-
 .../remote/ShutdownAllGatewayHubsRequest.java      |   3 +-
 .../geode/internal/cache/AbstractRegionMap.java    |   2 +-
 .../apache/geode/internal/cache/BucketAdvisor.java |   4 +-
 .../internal/cache/DestroyRegionOperation.java     |  61 +-
 .../internal/cache/DistributedClearOperation.java  |   3 +-
 .../geode/internal/cache/DistributedRegion.java    |   2 +-
 .../DistributedRegionFunctionStreamingMessage.java |   3 +-
 .../cache/DistributedTombstoneOperation.java       |   3 +-
 .../FunctionStreamingOrderedReplyMessage.java      |   4 +-
 .../internal/cache/InitialImageFlowControl.java    |   3 +-
 .../internal/cache/InitialImageOperation.java      |  19 +-
 .../internal/cache/JtaAfterCompletionMessage.java  |   5 +-
 .../cache/MemberFunctionStreamingMessage.java      |   3 +-
 .../geode/internal/cache/PartitionedRegion.java    |   6 +-
 .../internal/cache/PartitionedRegionDataStore.java |   4 +-
 .../internal/cache/PartitionedRegionHelper.java    |  19 +-
 .../cache/SearchLoadAndWriteProcessor.java         |   2 +-
 .../geode/internal/cache/StateFlushOperation.java  |   2 +-
 .../internal/cache/TXRemoteCommitMessage.java      |   3 +-
 .../org/apache/geode/internal/cache/TXState.java   |   2 +-
 .../geode/internal/cache/TombstoneService.java     |   2 +-
 .../geode/internal/cache/UpdateOperation.java      |   2 +-
 .../internal/cache/execute/AbstractExecution.java  |   4 +-
 .../cache/locks/TXLessorDepartureHandler.java      |   2 +-
 .../cache/locks/TXOriginatorRecoveryProcessor.java |   2 +-
 .../locks/TXRecoverGrantorMessageProcessor.java    |   2 +-
 .../AllBucketProfilesUpdateMessage.java            |   3 +-
 .../partitioned/BecomePrimaryBucketMessage.java    |   3 +-
 .../cache/partitioned/BucketBackupMessage.java     |   3 +-
 .../partitioned/BucketProfileUpdateMessage.java    |   3 +-
 .../cache/partitioned/BucketSizeMessage.java       |   3 +-
 .../cache/partitioned/CreateBucketMessage.java     |   3 +-
 .../DestroyRegionOnDataStoreMessage.java           |   3 +-
 .../partitioned/EndBucketCreationMessage.java      |   3 +-
 .../internal/cache/partitioned/GetMessage.java     |   9 +-
 .../cache/partitioned/IdentityRequestMessage.java  |   3 +-
 .../cache/partitioned/IdentityUpdateMessage.java   |   3 +-
 .../cache/partitioned/InterestEventMessage.java    |   3 +-
 .../partitioned/ManageBackupBucketMessage.java     |   3 +-
 .../cache/partitioned/ManageBucketMessage.java     |   3 +-
 .../cache/partitioned/PRSanityCheckMessage.java    |   3 +-
 .../cache/partitioned/PartitionMessage.java        |   5 +-
 .../PartitionedRegionFunctionStreamingMessage.java |   3 +-
 .../partitioned/PartitionedRegionRebalanceOp.java  |   2 +-
 .../cache/partitioned/PrimaryRequestMessage.java   |   3 +-
 .../internal/cache/partitioned/PutMessage.java     |   2 +-
 .../cache/persistence/MembershipViewRequest.java   |   5 +-
 .../internal/cache/snapshot/FlowController.java    |   5 +-
 .../cache/snapshot/RegionSnapshotServiceImpl.java  |   6 +-
 .../cache/tier/sockets/CacheClientNotifier.java    |   2 +-
 .../cache/tier/sockets/CacheClientProxy.java       |   4 +-
 .../tier/sockets/command/ExecuteFunction66.java    |   2 +-
 .../internal/cache/tx/RemoteOperationMessage.java  |   3 +-
 .../cache/versions/RegionVersionVector.java        |   4 +-
 ...tilParallelGatewaySenderFlushedCoordinator.java |   3 +-
 .../org/apache/geode/internal/tcp/Connection.java  |   5 +-
 .../internal/StartupMessageJUnitTest.java          |   4 +-
 .../sockets/command/ExecuteFunction66Test.java     |   5 +-
 .../java/org/apache/geode/test/fake/Fakes.java     |   2 +
 .../lucene/internal/LuceneBucketListener.java      |   4 +-
 .../internal/LuceneIndexForPartitionedRegion.java  |   3 +-
 .../cache/lucene/internal/LuceneRawIndex.java      |   2 +-
 .../internal/LuceneServiceImplJUnitTest.java       |   9 +-
 89 files changed, 1329 insertions(+), 1154 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/ClusterCommunicationsDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/ClusterCommunicationsDUnitTest.java
index fe7c494..cc80088 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/ClusterCommunicationsDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/ClusterCommunicationsDUnitTest.java
@@ -72,6 +72,7 @@ import org.apache.geode.distributed.internal.DirectReplyProcessor;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.SerialAckedMessage;
@@ -430,7 +431,7 @@ public class ClusterCommunicationsDUnitTest implements Serializable {
 
     @Override
     public int getProcessorType() {
-      return ClusterDistributionManager.SERIAL_EXECUTOR;
+      return OperationExecutors.SERIAL_EXECUTOR;
     }
 
     @Override
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java
index 1ffac0f..f31298e 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java
@@ -29,8 +29,8 @@ import static org.apache.geode.distributed.ConfigurationProperties.REDUNDANCY_ZO
 import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
 import static org.apache.geode.distributed.ConfigurationProperties.TCP_PORT;
 import static org.apache.geode.distributed.internal.ClusterDistributionManager.NORMAL_DM_TYPE;
-import static org.apache.geode.distributed.internal.ClusterDistributionManager.SERIAL_EXECUTOR;
 import static org.apache.geode.distributed.internal.DistributionConfig.DEFAULT_ACK_WAIT_THRESHOLD;
+import static org.apache.geode.distributed.internal.OperationExecutors.SERIAL_EXECUTOR;
 import static org.apache.geode.internal.AvailablePort.MULTICAST;
 import static org.apache.geode.internal.AvailablePort.SOCKET;
 import static org.apache.geode.internal.AvailablePort.getRandomAvailablePort;
@@ -137,18 +137,19 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase {
         (ClusterDistributionManager) system.getDistributionManager();
     final FakeMessage message = new FakeMessage(null);
 
-    distributionManager.getExecutor(SERIAL_EXECUTOR, member).execute(new SizeableRunnable(100) {
+    distributionManager.getExecutors().getExecutor(SERIAL_EXECUTOR, member)
+        .execute(new SizeableRunnable(100) {
 
-      @Override
-      public void run() { // always throws NullPointerException
-        message.doAction(distributionManager, false);
-      }
+          @Override
+          public void run() { // always throws NullPointerException
+            message.doAction(distributionManager, false);
+          }
 
-      @Override
-      public String toString() {
-        return "Processing fake message";
-      }
-    });
+          @Override
+          public String toString() {
+            return "Processing fake message";
+          }
+        });
 
     Assert.assertTrue("expected the serial queue to be flushed",
         distributionManager.getMembershipManager().waitForDeparture(member));
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/NestedFunctionExecutionDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/NestedFunctionExecutionDistributedTest.java
index b398743..8826b96 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/NestedFunctionExecutionDistributedTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/NestedFunctionExecutionDistributedTest.java
@@ -16,8 +16,8 @@ package org.apache.geode.internal.cache.execute;
 
 import static org.apache.geode.cache.RegionShortcut.REPLICATE;
 import static org.apache.geode.cache.client.ClientRegionShortcut.PROXY;
-import static org.apache.geode.distributed.internal.ClusterDistributionManager.MAX_FE_THREADS;
 import static org.apache.geode.distributed.internal.DistributionConfig.GEMFIRE_PREFIX;
+import static org.apache.geode.distributed.internal.OperationExecutors.MAX_FE_THREADS;
 import static org.apache.geode.test.dunit.VM.getHostName;
 import static org.apache.geode.test.dunit.VM.getVM;
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
index 5cea9f7..a288af5 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
@@ -18,7 +18,6 @@ package org.apache.geode.distributed.internal;
 import java.io.NotSerializableException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -29,18 +28,12 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.Semaphore;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.Logger;
 
@@ -68,7 +61,6 @@ import org.apache.geode.distributed.internal.membership.MembershipView;
 import org.apache.geode.distributed.internal.membership.adapter.ServiceConfig;
 import org.apache.geode.distributed.internal.membership.adapter.auth.GMSAuthenticator;
 import org.apache.geode.distributed.internal.membership.gms.api.MembershipBuilder;
-import org.apache.geode.distributed.internal.membership.gms.messages.ViewAckMessage;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.NanoTimer;
@@ -80,17 +72,13 @@ import org.apache.geode.internal.alerting.AlertingService;
 import org.apache.geode.internal.cache.InitialImageOperation;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
 import org.apache.geode.internal.logging.LoggingThread;
 import org.apache.geode.internal.logging.LoggingUncaughtExceptionHandler;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.monitoring.ThreadsMonitoring;
-import org.apache.geode.internal.monitoring.ThreadsMonitoringImpl;
-import org.apache.geode.internal.monitoring.ThreadsMonitoringImplDummy;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.sequencelog.MembershipLogger;
 import org.apache.geode.internal.serialization.Version;
-import org.apache.geode.internal.tcp.Connection;
 import org.apache.geode.internal.tcp.ConnectionTable;
 import org.apache.geode.internal.tcp.ReenteredConnectException;
 
@@ -119,16 +107,6 @@ public class ClusterDistributionManager implements DistributionManager {
       Boolean.getBoolean("DistributionManager.DEBUG_NO_ACKNOWLEDGEMENTS");
 
   /**
-   * maximum time, in milliseconds, to wait for all threads to exit
-   */
-  private static final int MAX_STOP_TIME = 20000;
-
-  /**
-   * Time to sleep, in milliseconds, while polling to see if threads have finished
-   */
-  private static final int STOP_PAUSE_TIME = 1000;
-
-  /**
    * Maximum number of interrupt attempts to stop a thread
    */
   private static final int MAX_STOP_ATTEMPTS = 10;
@@ -137,65 +115,6 @@ public class ClusterDistributionManager implements DistributionManager {
 
   private static final boolean SYNC_EVENTS = Boolean.getBoolean("DistributionManager.syncEvents");
 
-  /**
-   * Flag indicating whether to use single Serial-Executor thread or Multiple Serial-executor
-   * thread,
-   */
-  private static final boolean MULTI_SERIAL_EXECUTORS =
-      !Boolean.getBoolean("DistributionManager.singleSerialExecutor");
-
-  private static final int MAX_WAITING_THREADS =
-      Integer.getInteger("DistributionManager.MAX_WAITING_THREADS", Integer.MAX_VALUE);
-
-  private static final int MAX_PR_META_DATA_CLEANUP_THREADS =
-      Integer.getInteger("DistributionManager.MAX_PR_META_DATA_CLEANUP_THREADS", 1);
-
-  public static final int MAX_THREADS =
-      Integer.getInteger("DistributionManager.MAX_THREADS", 100);
-
-  private static final int MAX_PR_THREADS = Integer.getInteger("DistributionManager.MAX_PR_THREADS",
-      Math.max(Runtime.getRuntime().availableProcessors() * 4, 16));
-
-  public static final int MAX_FE_THREADS = Integer.getInteger("DistributionManager.MAX_FE_THREADS",
-      Math.max(Runtime.getRuntime().availableProcessors() * 4, 16));
-
-
-
-  private static final int INCOMING_QUEUE_LIMIT =
-      Integer.getInteger("DistributionManager.INCOMING_QUEUE_LIMIT", 80000);
-
-  /** Throttling based on the Queue byte size */
-  private static final double THROTTLE_PERCENT = (double) (Integer
-      .getInteger("DistributionManager.SERIAL_QUEUE_THROTTLE_PERCENT", 75)) / 100;
-
-  private static final int SERIAL_QUEUE_BYTE_LIMIT = Integer
-      .getInteger("DistributionManager.SERIAL_QUEUE_BYTE_LIMIT", (40 * (1024 * 1024)));
-
-  private static final int SERIAL_QUEUE_THROTTLE =
-      Integer.getInteger("DistributionManager.SERIAL_QUEUE_THROTTLE",
-          (int) (SERIAL_QUEUE_BYTE_LIMIT * THROTTLE_PERCENT));
-
-  private static final int TOTAL_SERIAL_QUEUE_BYTE_LIMIT =
-      Integer.getInteger("DistributionManager.TOTAL_SERIAL_QUEUE_BYTE_LIMIT", (80 * (1024 * 1024)));
-
-  private static final int TOTAL_SERIAL_QUEUE_THROTTLE =
-      Integer.getInteger("DistributionManager.TOTAL_SERIAL_QUEUE_THROTTLE",
-          (int) (SERIAL_QUEUE_BYTE_LIMIT * THROTTLE_PERCENT));
-
-  /** Throttling based on the Queue item size */
-  private static final int SERIAL_QUEUE_SIZE_LIMIT =
-      Integer.getInteger("DistributionManager.SERIAL_QUEUE_SIZE_LIMIT", 20000);
-
-  private static final int SERIAL_QUEUE_SIZE_THROTTLE =
-      Integer.getInteger("DistributionManager.SERIAL_QUEUE_SIZE_THROTTLE",
-          (int) (SERIAL_QUEUE_SIZE_LIMIT * THROTTLE_PERCENT));
-
-  /** Max number of serial Queue executors, in case of multi-serial-queue executor */
-  private static final int MAX_SERIAL_QUEUE_THREAD =
-      Integer.getInteger("DistributionManager.MAX_SERIAL_QUEUE_THREAD", 20);
-
-  static final String FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX =
-      "Function Execution Processor";
 
   /** The DM type for regular distribution managers */
   public static final int NORMAL_DM_TYPE = 10;
@@ -211,46 +130,6 @@ public class ClusterDistributionManager implements DistributionManager {
 
 
 
-  /**
-   * @see org.apache.geode.distributed.internal.PooledDistributionMessage
-   */
-  public static final int STANDARD_EXECUTOR = 73;
-
-  /**
-   * @see org.apache.geode.distributed.internal.SerialDistributionMessage
-   */
-  public static final int SERIAL_EXECUTOR = 74;
-
-  /**
-   * @see org.apache.geode.distributed.internal.HighPriorityDistributionMessage
-   */
-  public static final int HIGH_PRIORITY_EXECUTOR = 75;
-
-  // 76 not in use
-
-  /**
-   * @see org.apache.geode.internal.cache.InitialImageOperation
-   */
-  public static final int WAITING_POOL_EXECUTOR = 77;
-
-  /**
-   * @see org.apache.geode.internal.cache.InitialImageOperation
-   */
-  public static final int PARTITIONED_REGION_EXECUTOR = 78;
-
-
-  /**
-   * Executor for view related messages
-   *
-   * @see ViewAckMessage
-   */
-  public static final int VIEW_EXECUTOR = 79;
-
-
-  public static final int REGION_FUNCTION_EXECUTION_EXECUTOR = 80;
-
-
-
   /** Is this node running an AdminDistributedSystem? */
   @MakeNotStatic
   private static volatile boolean isDedicatedAdminVM = false;
@@ -258,20 +137,6 @@ public class ClusterDistributionManager implements DistributionManager {
   @MakeNotStatic
   private static final ThreadLocal<Boolean> isStartupThread = new ThreadLocal<>();
 
-  /**
-   * Identifier for function execution threads and any of their children
-   */
-  @MakeNotStatic()
-  private static final InheritableThreadLocal<Boolean> isFunctionExecutionThread =
-      new InheritableThreadLocal<Boolean>() {
-        @Override
-        protected Boolean initialValue() {
-          return Boolean.FALSE;
-        }
-      };
-
-
-
   ///////////////////// Instance Fields //////////////////////
 
   private final Stopper stopper = new Stopper(this);
@@ -290,6 +155,7 @@ public class ClusterDistributionManager implements DistributionManager {
    */
   private final ConcurrentMap<MembershipListener, Boolean> membershipListeners;
   private final ClusterElderManager clusterElderManager = new ClusterElderManager(this);
+  private ClusterOperationExecutors executors;
 
   /**
    * The <code>MembershipListener</code>s that are registered on this manager for ALL members.
@@ -379,61 +245,6 @@ public class ClusterDistributionManager implements DistributionManager {
    */
   private volatile Set<InternalDistributedMember> adminConsoles = Collections.emptySet();
 
-  /** Message processing thread pool */
-  private ExecutorService threadPool;
-
-  /**
-   * High Priority processing thread pool, used for initializing messages such as UpdateAttributes
-   * and CreateRegion messages
-   */
-  private ExecutorService highPriorityPool;
-
-  /**
-   * Waiting Pool, used for messages that may have to wait on something. Use this separate pool with
-   * an unbounded queue so that waiting runnables don't get in the way of other processing threads.
-   * Used for threads that will most likely have to wait for a region to be finished initializing
-   * before it can proceed
-   */
-  private ExecutorService waitingPool;
-
-  private ExecutorService prMetaDataCleanupThreadPool;
-
-  /**
-   * Thread used to decouple {@link org.apache.geode.internal.cache.partitioned.PartitionMessage}s
-   * from {@link org.apache.geode.internal.cache.DistributedCacheOperation}s </b>
-   *
-   * @see #SERIAL_EXECUTOR
-   */
-  private ExecutorService partitionedRegionThread;
-  private ExecutorService partitionedRegionPool;
-
-  /** Function Execution executors */
-  private ExecutorService functionExecutionThread;
-  private ExecutorService functionExecutionPool;
-
-  /** Message processing executor for serial, ordered, messages. */
-  private ExecutorService serialThread;
-
-  /**
-   * Message processing executor for view messages
-   *
-   * @see ViewAckMessage
-   */
-  private ExecutorService viewThread;
-
-  /**
-   * If using a throttling queue for the serialThread, we cache the queue here so we can see if
-   * delivery would block
-   */
-  private ThrottlingMemLinkedQueueWithDMStats<Runnable> serialQueue;
-
-  /**
-   * Thread Monitor mechanism to monitor system threads
-   *
-   * @see org.apache.geode.internal.monitoring.ThreadsMonitoring
-   */
-  private final ThreadsMonitoring threadMonitor;
-
   /** a map keyed on InternalDistributedMember, to direct channels to other systems */
   // protected final Map channelMap = CFactory.createCM();
 
@@ -462,8 +273,6 @@ public class ClusterDistributionManager implements DistributionManager {
    */
   private volatile RemoteGfManagerAgent agent;
 
-  private SerialQueuedExecutorPool serialQueuedExecutorPool;
-
   /**
    * TODO why does the distribution manager arbitrate GII operations? That should be a Cache
    * function
@@ -499,13 +308,6 @@ public class ClusterDistributionManager implements DistributionManager {
   ////////////////////// Static Methods //////////////////////
 
   /**
-   * Is the current thread used for executing Functions?
-   */
-  public static Boolean isFunctionExecutionThread() {
-    return isFunctionExecutionThread.get();
-  }
-
-  /**
    * Creates a new distribution manager and discovers the other members of the distributed system.
    * Note that it does not check to see whether or not this VM already has a distribution manager.
    *
@@ -623,6 +425,15 @@ public class ClusterDistributionManager implements DistributionManager {
     }
   }
 
+  public OperationExecutors getExecutors() {
+    return executors;
+  }
+
+  @Override
+  public ThreadsMonitoring getThreadMonitoring() {
+    return executors.getThreadMonitoring();
+  }
+
   /////////////////////// Constructors ///////////////////////
 
   /**
@@ -648,125 +459,8 @@ public class ClusterDistributionManager implements DistributionManager {
     DistributionStats.enableClockStats = system.getConfig().getEnableTimeStatistics();
 
     exceptionInThreads = false;
-
-    {
-      Properties nonDefault = new Properties();
-      DistributionConfigImpl distributionConfigImpl = new DistributionConfigImpl(nonDefault);
-
-      if (distributionConfigImpl.getThreadMonitorEnabled()) {
-        threadMonitor = new ThreadsMonitoringImpl(system);
-        logger.info("[ThreadsMonitor] a New Monitor object and process were created.\n");
-      } else {
-        threadMonitor = new ThreadsMonitoringImplDummy();
-        logger.info("[ThreadsMonitor] Monitoring is disabled and will not be run.\n");
-      }
-    }
-
-    boolean finishedConstructor = false;
     try {
-
-      if (MULTI_SERIAL_EXECUTORS) {
-        if (logger.isInfoEnabled(LogMarker.DM_MARKER)) {
-          logger.info(LogMarker.DM_MARKER,
-              "Serial Queue info :" + " THROTTLE_PERCENT: " + THROTTLE_PERCENT
-                  + " SERIAL_QUEUE_BYTE_LIMIT :" + SERIAL_QUEUE_BYTE_LIMIT
-                  + " SERIAL_QUEUE_THROTTLE :" + SERIAL_QUEUE_THROTTLE
-                  + " TOTAL_SERIAL_QUEUE_BYTE_LIMIT :" + TOTAL_SERIAL_QUEUE_BYTE_LIMIT
-                  + " TOTAL_SERIAL_QUEUE_THROTTLE :" + TOTAL_SERIAL_QUEUE_THROTTLE
-                  + " SERIAL_QUEUE_SIZE_LIMIT :" + SERIAL_QUEUE_SIZE_LIMIT
-                  + " SERIAL_QUEUE_SIZE_THROTTLE :" + SERIAL_QUEUE_SIZE_THROTTLE);
-        }
-        // when TCP/IP is disabled we can't throttle the serial queue or we run the risk of
-        // distributed deadlock when we block the UDP reader thread
-        boolean throttlingDisabled = system.getConfig().getDisableTcp();
-        serialQueuedExecutorPool =
-            new SerialQueuedExecutorPool(stats, throttlingDisabled, threadMonitor);
-      }
-
-      {
-        BlockingQueue<Runnable> poolQueue;
-        if (SERIAL_QUEUE_BYTE_LIMIT == 0) {
-          poolQueue = new OverflowQueueWithDMStats<>(stats.getSerialQueueHelper());
-        } else {
-          serialQueue =
-              new ThrottlingMemLinkedQueueWithDMStats<>(TOTAL_SERIAL_QUEUE_BYTE_LIMIT,
-                  TOTAL_SERIAL_QUEUE_THROTTLE, SERIAL_QUEUE_SIZE_LIMIT, SERIAL_QUEUE_SIZE_THROTTLE,
-                  stats.getSerialQueueHelper());
-          poolQueue = serialQueue;
-        }
-        serialThread = LoggingExecutors.newSerialThreadPool("Serial Message Processor",
-            thread -> stats.incSerialThreadStarts(),
-            this::doSerialThread, stats.getSerialProcessorHelper(),
-            threadMonitor, poolQueue);
-
-      }
-
-      viewThread =
-          LoggingExecutors.newSerialThreadPoolWithUnlimitedFeed("View Message Processor",
-              thread -> stats.incViewThreadStarts(), this::doViewThread,
-              stats.getViewProcessorHelper(), threadMonitor);
-
-      threadPool =
-          LoggingExecutors.newThreadPoolWithFeedStatistics("Pooled Message Processor ",
-              thread -> stats.incProcessingThreadStarts(), this::doProcessingThread,
-              MAX_THREADS, stats.getNormalPoolHelper(), threadMonitor,
-              INCOMING_QUEUE_LIMIT, stats.getOverflowQueueHelper());
-
-      highPriorityPool = LoggingExecutors.newThreadPoolWithFeedStatistics(
-          "Pooled High Priority Message Processor ",
-          thread -> stats.incHighPriorityThreadStarts(), this::doHighPriorityThread,
-          MAX_THREADS, stats.getHighPriorityPoolHelper(), threadMonitor,
-          INCOMING_QUEUE_LIMIT, stats.getHighPriorityQueueHelper());
-
-      {
-        BlockingQueue<Runnable> poolQueue;
-        if (MAX_WAITING_THREADS == Integer.MAX_VALUE) {
-          // no need for a queue since we have infinite threads
-          poolQueue = new SynchronousQueue<>();
-        } else {
-          poolQueue = new OverflowQueueWithDMStats<>(stats.getWaitingQueueHelper());
-        }
-        waitingPool = LoggingExecutors.newThreadPool("Pooled Waiting Message Processor ",
-            thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
-            MAX_WAITING_THREADS, stats.getWaitingPoolHelper(), threadMonitor, poolQueue);
-      }
-
-      // should this pool using the waiting pool stats?
-      prMetaDataCleanupThreadPool =
-          LoggingExecutors.newThreadPoolWithFeedStatistics("PrMetaData cleanup Message Processor ",
-              thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
-              MAX_PR_META_DATA_CLEANUP_THREADS, stats.getWaitingPoolHelper(), threadMonitor,
-              0, stats.getWaitingQueueHelper());
-
-      if (MAX_PR_THREADS > 1) {
-        partitionedRegionPool =
-            LoggingExecutors.newThreadPoolWithFeedStatistics("PartitionedRegion Message Processor",
-                thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
-                MAX_PR_THREADS, stats.getPartitionedRegionPoolHelper(), threadMonitor,
-                INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
-      } else {
-        partitionedRegionThread = LoggingExecutors.newSerialThreadPoolWithFeedStatistics(
-            "PartitionedRegion Message Processor",
-            thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
-            stats.getPartitionedRegionPoolHelper(), threadMonitor,
-            INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
-      }
-      if (MAX_FE_THREADS > 1) {
-        functionExecutionPool =
-            LoggingExecutors.newFunctionThreadPoolWithFeedStatistics(
-                FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
-                thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
-                MAX_FE_THREADS, stats.getFunctionExecutionPoolHelper(), threadMonitor,
-                INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
-      } else {
-        functionExecutionThread =
-            LoggingExecutors.newSerialThreadPoolWithFeedStatistics(
-                FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
-                thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
-                stats.getFunctionExecutionPoolHelper(), threadMonitor,
-                INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
-      }
-
+      executors = new ClusterOperationExecutors(stats, system);
       if (!SYNC_EVENTS) {
         memberEventThread =
             new LoggingThread("DM-MemberEventInvoker", new MemberEventInvoker());
@@ -804,99 +498,13 @@ public class ClusterDistributionManager implements DistributionManager {
       description = "Distribution manager on " + localAddress + " started at "
           + (new Date(System.currentTimeMillis())).toString();
 
-      finishedConstructor = true;
     } finally {
-      if (!finishedConstructor) {
+      if (executors != null) {
         askThreadsToStop(); // fix for bug 42039
       }
     }
   }
 
-  private void doFunctionExecutionThread(Runnable command) {
-    stats.incFunctionExecutionThreads(1);
-    isFunctionExecutionThread.set(Boolean.TRUE);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incFunctionExecutionThreads(-1);
-    }
-  }
-
-  private void doProcessingThread(Runnable command) {
-    stats.incNumProcessingThreads(1);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incNumProcessingThreads(-1);
-    }
-  }
-
-  private void doHighPriorityThread(Runnable command) {
-    stats.incHighPriorityThreads(1);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incHighPriorityThreads(-1);
-    }
-  }
-
-  private void doWaitingThread(Runnable command) {
-    stats.incWaitingThreads(1);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incWaitingThreads(-1);
-    }
-  }
-
-  private void doPartitionRegionThread(Runnable command) {
-    stats.incPartitionedRegionThreads(1);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incPartitionedRegionThreads(-1);
-    }
-  }
-
-  private void doViewThread(Runnable command) {
-    stats.incNumViewThreads(1);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incNumViewThreads(-1);
-    }
-  }
-
-  private void doSerialThread(Runnable command) {
-    stats.incNumSerialThreads(1);
-    try {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      runUntilShutdown(command);
-    } finally {
-      ConnectionTable.releaseThreadsSockets();
-      stats.incNumSerialThreads(-1);
-    }
-  }
-
   /**
    * Creates a new distribution manager
    *
@@ -962,28 +570,6 @@ public class ClusterDistributionManager implements DistributionManager {
 
   //////////////////// Instance Methods /////////////////////
 
-  private void runUntilShutdown(Runnable r) {
-    try {
-      r.run();
-    } catch (CancelException e) {
-      if (logger.isTraceEnabled()) {
-        logger.trace("Caught shutdown exception", e);
-      }
-    } catch (VirtualMachineError err) {
-      SystemFailure.initiateFailure(err);
-      // If this ever returns, rethrow the error. We're poisoned
-      // now, so don't let this thread continue.
-      throw err;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      if (shouldInhibitMembershipWarnings()) {
-        logger.debug("Caught unusual exception during shutdown: {}", t.getMessage(), t);
-      } else {
-        logger.warn("Task failed with exception", t);
-      }
-    }
-  }
-
   /**
    * Returns true if the two members are on the same equivalent host based on overlapping IP
    * addresses collected for all NICs during exchange of startup messages.
@@ -1128,7 +714,7 @@ public class ClusterDistributionManager implements DistributionManager {
           ex);
     }
     try {
-      getWaitingThreadPool().execute(() -> {
+      executors.getWaitingThreadPool().execute(() -> {
         // call in background since it might need to send a reply
         // and we are not ready to send messages until startup is finished
         setIsStartupThread();
@@ -1583,7 +1169,7 @@ public class ClusterDistributionManager implements DistributionManager {
         t.start();
         boolean interrupted = Thread.interrupted();
         try {
-          t.join(MAX_STOP_TIME / 4);
+          t.join(ClusterOperationExecutors.MAX_STOP_TIME / 4);
         } catch (final InterruptedException e) {
           interrupted = true;
           t.interrupt();
@@ -1613,55 +1199,7 @@ public class ClusterDistributionManager implements DistributionManager {
   }
 
   private void askThreadsToStop() {
-    // Stop executors after they have finished
-    ExecutorService es;
-    threadMonitor.close();
-    es = serialThread;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = viewThread;
-    if (es != null) {
-      // Hmmm...OK, I'll let any view events currently in the queue be
-      // processed. Not sure it's very important whether they get
-      // handled...
-      es.shutdown();
-    }
-    if (serialQueuedExecutorPool != null) {
-      serialQueuedExecutorPool.shutdown();
-    }
-    es = functionExecutionThread;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = functionExecutionPool;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = partitionedRegionThread;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = partitionedRegionPool;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = highPriorityPool;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = waitingPool;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = prMetaDataCleanupThreadPool;
-    if (es != null) {
-      es.shutdown();
-    }
-    es = threadPool;
-    if (es != null) {
-      es.shutdown();
-    }
+    executors.askThreadsToStop();
 
     Thread th = memberEventThread;
     if (th != null)
@@ -1670,31 +1208,14 @@ public class ClusterDistributionManager implements DistributionManager {
 
   private void waitForThreadsToStop(long timeInMillis) throws InterruptedException {
     long start = System.currentTimeMillis();
-    long remaining = timeInMillis;
-
-    ExecutorService[] allExecutors = new ExecutorService[] {serialThread, viewThread,
-        functionExecutionThread, functionExecutionPool, partitionedRegionThread,
-        partitionedRegionPool, highPriorityPool, waitingPool,
-        prMetaDataCleanupThreadPool, threadPool};
-    for (ExecutorService es : allExecutors) {
-      if (es != null) {
-        es.awaitTermination(remaining, TimeUnit.MILLISECONDS);
-      }
-      remaining = timeInMillis - (System.currentTimeMillis() - start);
-      if (remaining <= 0) {
-        return;
-      }
-    }
-
-    serialQueuedExecutorPool.awaitTermination(remaining, TimeUnit.MILLISECONDS);
-    remaining = timeInMillis - (System.currentTimeMillis() - start);
+    executors.waitForThreadsToStop(timeInMillis);
+    long remaining = timeInMillis - (System.currentTimeMillis() - start);
     if (remaining <= 0) {
       return;
     }
     Thread th = memberEventThread;
     if (th != null) {
-      th.interrupt(); // bug #43452 - this thread sometimes eats interrupts, so we interrupt it
-                      // again here
+      th.interrupt();
       th.join(remaining);
     }
 
@@ -1718,7 +1239,7 @@ public class ClusterDistributionManager implements DistributionManager {
       // t.stop();
       try {
         for (int i = 0; i < MAX_STOP_ATTEMPTS && t.isAlive(); i++) {
-          t.join(STOP_PAUSE_TIME);
+          t.join(ClusterOperationExecutors.STOP_PAUSE_TIME);
           t.interrupt();
         }
       } catch (InterruptedException ex) {
@@ -1734,123 +1255,11 @@ public class ClusterDistributionManager implements DistributionManager {
   }
 
   /**
-   * Cheap tool to examine an executor to see if it is still working
-   *
-   * @return true if executor is still active
-   */
-  private boolean executorAlive(ExecutorService tpe, String name) {
-    if (tpe == null) {
-      return false;
-    } else {
-      int ac = ((ThreadPoolExecutor) tpe).getActiveCount();
-      // boolean result = tpe.getActiveCount() > 0;
-      if (ac > 0) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Still waiting for {} threads in '{}' pool to exit", ac, name);
-        }
-        return true;
-      } else {
-        return false;
-      }
-    }
-  }
-
-  /**
    * Wait for the ancillary queues to exit. Kills them if they are still around.
    *
    */
   private void forceThreadsToStop() {
-    long endTime = System.currentTimeMillis() + MAX_STOP_TIME;
-    StringBuilder culprits;
-    for (;;) {
-      boolean stillAlive = false;
-      culprits = new StringBuilder();
-      if (executorAlive(serialThread, "serial thread")) {
-        stillAlive = true;
-        culprits.append(" serial thread;");
-      }
-      if (executorAlive(viewThread, "view thread")) {
-        stillAlive = true;
-        culprits.append(" view thread;");
-      }
-      if (executorAlive(partitionedRegionThread, "partitioned region thread")) {
-        stillAlive = true;
-        culprits.append(" partitioned region thread;");
-      }
-      if (executorAlive(partitionedRegionPool, "partitioned region pool")) {
-        stillAlive = true;
-        culprits.append(" partitioned region pool;");
-      }
-      if (executorAlive(highPriorityPool, "high priority pool")) {
-        stillAlive = true;
-        culprits.append(" high priority pool;");
-      }
-      if (executorAlive(waitingPool, "waiting pool")) {
-        stillAlive = true;
-        culprits.append(" waiting pool;");
-      }
-      if (executorAlive(prMetaDataCleanupThreadPool, "prMetaDataCleanupThreadPool")) {
-        stillAlive = true;
-        culprits.append(" special waiting pool;");
-      }
-      if (executorAlive(threadPool, "thread pool")) {
-        stillAlive = true;
-        culprits.append(" thread pool;");
-      }
-
-      if (!stillAlive)
-        return;
-
-      long now = System.currentTimeMillis();
-      if (now >= endTime)
-        break;
-
-      try {
-        Thread.sleep(STOP_PAUSE_TIME);
-      } catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-        // Desperation, the shutdown thread is being killed. Don't
-        // consult a CancelCriterion.
-        logger.warn("Interrupted during shutdown", e);
-        break;
-      }
-    } // for
-
-    logger.warn("Daemon threads are slow to stop; culprits include: {}",
-        culprits);
-
-    // Kill with no mercy
-    if (serialThread != null) {
-      serialThread.shutdownNow();
-    }
-    if (viewThread != null) {
-      viewThread.shutdownNow();
-    }
-    if (functionExecutionThread != null) {
-      functionExecutionThread.shutdownNow();
-    }
-    if (functionExecutionPool != null) {
-      functionExecutionPool.shutdownNow();
-    }
-    if (partitionedRegionThread != null) {
-      partitionedRegionThread.shutdownNow();
-    }
-    if (partitionedRegionPool != null) {
-      partitionedRegionPool.shutdownNow();
-    }
-    if (highPriorityPool != null) {
-      highPriorityPool.shutdownNow();
-    }
-    if (waitingPool != null) {
-      waitingPool.shutdownNow();
-    }
-    if (prMetaDataCleanupThreadPool != null) {
-      prMetaDataCleanupThreadPool.shutdownNow();
-    }
-    if (threadPool != null) {
-      threadPool.shutdownNow();
-    }
-
+    executors.forceThreadsToStop();
     Thread th = memberEventThread;
     if (th != null) {
       clobberThread(th);
@@ -2667,10 +2076,7 @@ public class ClusterDistributionManager implements DistributionManager {
       }
       logger.info(msg, new Object[] {theId, prettifyReason(p_reason)});
 
-      // Remove this manager from the serialQueueExecutor.
-      if (serialQueuedExecutorPool != null) {
-        serialQueuedExecutorPool.handleMemberDeparture(theId);
-      }
+      executors.handleManagerDeparture(theId);
     }
   }
 
@@ -2742,31 +2148,6 @@ public class ClusterDistributionManager implements DistributionManager {
   }
 
   /**
-   * Returns the executor for the given type of processor.
-   */
-  public Executor getExecutor(int processorType, InternalDistributedMember sender) {
-    switch (processorType) {
-      case STANDARD_EXECUTOR:
-        return getThreadPool();
-      case SERIAL_EXECUTOR:
-        return getSerialExecutor(sender);
-      case VIEW_EXECUTOR:
-        return viewThread;
-      case HIGH_PRIORITY_EXECUTOR:
-        return getHighPriorityThreadPool();
-      case WAITING_POOL_EXECUTOR:
-        return getWaitingThreadPool();
-      case PARTITIONED_REGION_EXECUTOR:
-        return getPartitionedRegionExcecutor();
-      case REGION_FUNCTION_EXECUTION_EXECUTOR:
-        return getFunctionExecutor();
-      default:
-        throw new InternalGemFireError(String.format("unknown processor type %s",
-            processorType));
-    }
-  }
-
-  /**
    * Actually does the work of sending a message out over the distribution channel.
    *
    * @param message the message to send
@@ -2899,66 +2280,6 @@ public class ClusterDistributionManager implements DistributionManager {
     return clusterElderManager.waitForElder(desiredElder);
   }
 
-  @Override
-  public ExecutorService getThreadPool() {
-    return threadPool;
-  }
-
-  @Override
-  public ExecutorService getHighPriorityThreadPool() {
-    return highPriorityPool;
-  }
-
-  @Override
-  public ExecutorService getWaitingThreadPool() {
-    return waitingPool;
-  }
-
-  @Override
-  public ExecutorService getPrMetaDataCleanupThreadPool() {
-    return prMetaDataCleanupThreadPool;
-  }
-
-  private Executor getPartitionedRegionExcecutor() {
-    if (partitionedRegionThread != null) {
-      return partitionedRegionThread;
-    } else {
-      return partitionedRegionPool;
-    }
-  }
-
-
-  @Override
-  public Executor getFunctionExecutor() {
-    if (functionExecutionThread != null) {
-      return functionExecutionThread;
-    } else {
-      return functionExecutionPool;
-    }
-  }
-
-  private Executor getSerialExecutor(InternalDistributedMember sender) {
-    if (MULTI_SERIAL_EXECUTORS) {
-      return serialQueuedExecutorPool.getThrottledSerialExecutor(sender);
-    } else {
-      return serialThread;
-    }
-  }
-
-  /** returns the serialThread's queue if throttling is being used, null if not */
-  public OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
-    if (MULTI_SERIAL_EXECUTORS) {
-      return serialQueuedExecutorPool.getSerialQueue(sender);
-    } else {
-      return serialQueue;
-    }
-  }
-
-  @Override
-  public ThreadsMonitoring getThreadMonitoring() {
-    return threadMonitor;
-  }
-
   /**
    * Sets the administration agent associated with this distribution manager.
    */
@@ -3138,238 +2459,6 @@ public class ClusterDistributionManager implements DistributionManager {
   ////////////////////// Inner Classes //////////////////////
 
 
-  /**
-   * This class is used for DM's multi serial executor. The serial messages are managed/executed by
-   * multiple serial thread. This class takes care of executing messages related to a sender using
-   * the same thread.
-   */
-  private static class SerialQueuedExecutorPool {
-    /** To store the serial threads */
-    final ConcurrentMap<Integer, ExecutorService> serialQueuedExecutorMap =
-        new ConcurrentHashMap<>(MAX_SERIAL_QUEUE_THREAD);
-
-    /** To store the queue associated with thread */
-    final Map<Integer, OverflowQueueWithDMStats<Runnable>> serialQueuedMap =
-        new HashMap<>(MAX_SERIAL_QUEUE_THREAD);
-
-    /** Holds mapping between sender to the serial thread-id */
-    final Map<InternalDistributedMember, Integer> senderToSerialQueueIdMap = new HashMap<>();
-
-    /**
-     * Holds info about unused thread, a thread is marked unused when the member associated with it
-     * has left distribution system.
-     */
-    final ArrayList<Integer> threadMarkedForUse = new ArrayList<>();
-
-    final DistributionStats stats;
-
-    final boolean throttlingDisabled;
-
-    final ThreadsMonitoring threadMonitoring;
-
-    SerialQueuedExecutorPool(DistributionStats stats,
-        boolean throttlingDisabled, ThreadsMonitoring tMonitoring) {
-      this.stats = stats;
-      this.throttlingDisabled = throttlingDisabled;
-      threadMonitoring = tMonitoring;
-    }
-
-    /*
-     * Returns an id of the thread in serialQueuedExecutorMap, thats mapped to the given seder.
-     *
-     *
-     * @param createNew boolean flag to indicate whether to create a new id, if id doesnot exists.
-     */
-    private Integer getQueueId(InternalDistributedMember sender, boolean createNew) {
-      // Create a new Id.
-      Integer queueId;
-
-      synchronized (senderToSerialQueueIdMap) {
-        // Check if there is a executor associated with this sender.
-        queueId = senderToSerialQueueIdMap.get(sender);
-
-        if (!createNew || queueId != null) {
-          return queueId;
-        }
-
-        // Create new.
-        // Check if any threads are availabe that is marked for Use.
-        if (!threadMarkedForUse.isEmpty()) {
-          queueId = threadMarkedForUse.remove(0);
-        }
-        // If Map is full, use the threads in round-robin fashion.
-        if (queueId == null) {
-          queueId = (serialQueuedExecutorMap.size() + 1) % MAX_SERIAL_QUEUE_THREAD;
-        }
-        senderToSerialQueueIdMap.put(sender, queueId);
-      }
-      return queueId;
-    }
-
-    /*
-     * Returns the queue associated with this sender. Used in FlowControl for throttling (based on
-     * queue size).
-     */
-    OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
-      Integer queueId = getQueueId(sender, false);
-      if (queueId == null) {
-        return null;
-      }
-      return serialQueuedMap.get(queueId);
-    }
-
-    /*
-     * Returns the serial queue executor, before returning the thread this applies throttling, based
-     * on the total serial queue size (total - sum of all the serial queue size). The throttling is
-     * applied during put event, this doesnt block the extract operation on the queue.
-     *
-     */
-    ExecutorService getThrottledSerialExecutor(
-        InternalDistributedMember sender) {
-      ExecutorService executor = getSerialExecutor(sender);
-
-      // Get the total serial queue size.
-      long totalSerialQueueMemSize = stats.getInternalSerialQueueBytes();
-
-      // for tcp socket reader threads, this code throttles the thread
-      // to keep the sender-side from overwhelming the receiver.
-      // UDP readers are throttled in the FC protocol, which queries
-      // the queue to see if it should throttle
-      if (stats.getInternalSerialQueueBytes() > TOTAL_SERIAL_QUEUE_THROTTLE
-          && !DistributionMessage.isPreciousThread()) {
-        do {
-          boolean interrupted = Thread.interrupted();
-          try {
-            float throttlePercent = (float) (totalSerialQueueMemSize - TOTAL_SERIAL_QUEUE_THROTTLE)
-                / (float) (TOTAL_SERIAL_QUEUE_BYTE_LIMIT - TOTAL_SERIAL_QUEUE_THROTTLE);
-            int sleep = (int) (100.0 * throttlePercent);
-            sleep = Math.max(sleep, 1);
-            Thread.sleep(sleep);
-          } catch (InterruptedException ex) {
-            interrupted = true;
-            // FIXME-InterruptedException
-            // Perhaps we should return null here?
-          } finally {
-            if (interrupted) {
-              Thread.currentThread().interrupt();
-            }
-          }
-          stats.getSerialQueueHelper().incThrottleCount();
-        } while (stats.getInternalSerialQueueBytes() >= TOTAL_SERIAL_QUEUE_BYTE_LIMIT);
-      }
-      return executor;
-    }
-
-    /*
-     * Returns the serial queue executor for the given sender.
-     */
-    ExecutorService getSerialExecutor(InternalDistributedMember sender) {
-      ExecutorService executor;
-      Integer queueId = getQueueId(sender, true);
-      if ((executor =
-          serialQueuedExecutorMap.get(queueId)) != null) {
-        return executor;
-      }
-      // If executor doesn't exists for this sender, create one.
-      executor = createSerialExecutor(queueId);
-
-      serialQueuedExecutorMap.put(queueId, executor);
-
-      if (logger.isDebugEnabled()) {
-        logger.debug(
-            "Created Serial Queued Executor With queueId {}. Total number of live Serial Threads :{}",
-            queueId, serialQueuedExecutorMap.size());
-      }
-      stats.incSerialPooledThread();
-      return executor;
-    }
-
-    /*
-     * Creates a serial queue executor.
-     */
-    private ExecutorService createSerialExecutor(final Integer id) {
-
-      OverflowQueueWithDMStats<Runnable> poolQueue;
-
-      if (SERIAL_QUEUE_BYTE_LIMIT == 0 || throttlingDisabled) {
-        poolQueue = new OverflowQueueWithDMStats<>(stats.getSerialQueueHelper());
-      } else {
-        poolQueue = new ThrottlingMemLinkedQueueWithDMStats<>(SERIAL_QUEUE_BYTE_LIMIT,
-            SERIAL_QUEUE_THROTTLE, SERIAL_QUEUE_SIZE_LIMIT, SERIAL_QUEUE_SIZE_THROTTLE,
-            stats.getSerialQueueHelper());
-      }
-
-      serialQueuedMap.put(id, poolQueue);
-
-      return LoggingExecutors.newSerialThreadPool("Pooled Serial Message Processor" + id + "-",
-          thread -> stats.incSerialPooledThreadStarts(), this::doSerialPooledThread,
-          stats.getSerialPooledProcessorHelper(), threadMonitoring, poolQueue);
-    }
-
-    private void doSerialPooledThread(Runnable command) {
-      ConnectionTable.threadWantsSharedResources();
-      Connection.makeReaderThread();
-      try {
-        command.run();
-      } finally {
-        ConnectionTable.releaseThreadsSockets();
-      }
-    }
-
-    /*
-     * Does cleanup relating to this member. And marks the serial executor associated with this
-     * member for re-use.
-     */
-    private void handleMemberDeparture(InternalDistributedMember member) {
-      Integer queueId = getQueueId(member, false);
-      if (queueId == null) {
-        return;
-      }
-
-      boolean isUsed = false;
-
-      synchronized (senderToSerialQueueIdMap) {
-        senderToSerialQueueIdMap.remove(member);
-
-        // Check if any other members are using the same executor.
-        for (Integer value : senderToSerialQueueIdMap.values()) {
-          if (value.equals(queueId)) {
-            isUsed = true;
-            break;
-          }
-        }
-
-        // If not used mark this as unused.
-        if (!isUsed) {
-          if (logger.isInfoEnabled(LogMarker.DM_MARKER))
-            logger.info(LogMarker.DM_MARKER,
-                "Marking the SerialQueuedExecutor with id : {} used by the member {} to be unused.",
-                new Object[] {queueId, member});
-
-          threadMarkedForUse.add(queueId);
-        }
-      }
-    }
-
-    private void awaitTermination(long time, TimeUnit unit) throws InterruptedException {
-      long remainingNanos = unit.toNanos(time);
-      long start = System.nanoTime();
-      for (ExecutorService executor : serialQueuedExecutorMap.values()) {
-        executor.awaitTermination(remainingNanos, TimeUnit.NANOSECONDS);
-        remainingNanos = (System.nanoTime() - start);
-        if (remainingNanos <= 0) {
-          return;
-        }
-      }
-    }
-
-    private void shutdown() {
-      for (ExecutorService executor : serialQueuedExecutorMap
-          .values()) {
-        executor.shutdown();
-      }
-    }
-  }
 
   /**
    * This is the listener implementation for responding from events from the Membership Manager.
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
new file mode 100644
index 0000000..99d10f2
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
@@ -0,0 +1,921 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.distributed.internal.membership.gms.messages.ViewAckMessage;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.LoggingExecutors;
+import org.apache.geode.internal.logging.log4j.LogMarker;
+import org.apache.geode.internal.monitoring.ThreadsMonitoring;
+import org.apache.geode.internal.monitoring.ThreadsMonitoringImpl;
+import org.apache.geode.internal.monitoring.ThreadsMonitoringImplDummy;
+import org.apache.geode.internal.tcp.Connection;
+import org.apache.geode.internal.tcp.ConnectionTable;
+
+public class ClusterOperationExecutors implements OperationExecutors {
+  private static final Logger logger = LogService.getLogger();
+
+  /**
+   * maximum time, in milliseconds, to wait for all threads to exit
+   */
+  static final int MAX_STOP_TIME = 20000;
+
+  /**
+   * Time to sleep, in milliseconds, while polling to see if threads have finished
+   */
+  static final int STOP_PAUSE_TIME = 1000;
+
+  /**
+   * Flag indicating whether to use single Serial-Executor thread or Multiple Serial-executor
+   * thread,
+   */
+  private static final boolean MULTI_SERIAL_EXECUTORS =
+      !Boolean.getBoolean("DistributionManager.singleSerialExecutor");
+
+  private static final int MAX_WAITING_THREADS =
+      Integer.getInteger("DistributionManager.MAX_WAITING_THREADS", Integer.MAX_VALUE);
+
+  private static final int MAX_PR_META_DATA_CLEANUP_THREADS =
+      Integer.getInteger("DistributionManager.MAX_PR_META_DATA_CLEANUP_THREADS", 1);
+
+  private static final int MAX_PR_THREADS = Integer.getInteger("DistributionManager.MAX_PR_THREADS",
+      Math.max(Runtime.getRuntime().availableProcessors() * 4, 16));
+
+
+  private static final int INCOMING_QUEUE_LIMIT =
+      Integer.getInteger("DistributionManager.INCOMING_QUEUE_LIMIT", 80000);
+
+  /** Throttling based on the Queue byte size */
+  private static final double THROTTLE_PERCENT = (double) (Integer
+      .getInteger("DistributionManager.SERIAL_QUEUE_THROTTLE_PERCENT", 75)) / 100;
+
+  private static final int SERIAL_QUEUE_BYTE_LIMIT = Integer
+      .getInteger("DistributionManager.SERIAL_QUEUE_BYTE_LIMIT", (40 * (1024 * 1024)));
+
+  private static final int SERIAL_QUEUE_THROTTLE =
+      Integer.getInteger("DistributionManager.SERIAL_QUEUE_THROTTLE",
+          (int) (SERIAL_QUEUE_BYTE_LIMIT * THROTTLE_PERCENT));
+
+  private static final int TOTAL_SERIAL_QUEUE_BYTE_LIMIT =
+      Integer.getInteger("DistributionManager.TOTAL_SERIAL_QUEUE_BYTE_LIMIT", (80 * (1024 * 1024)));
+
+  private static final int TOTAL_SERIAL_QUEUE_THROTTLE =
+      Integer.getInteger("DistributionManager.TOTAL_SERIAL_QUEUE_THROTTLE",
+          (int) (SERIAL_QUEUE_BYTE_LIMIT * THROTTLE_PERCENT));
+
+  /** Throttling based on the Queue item size */
+  private static final int SERIAL_QUEUE_SIZE_LIMIT =
+      Integer.getInteger("DistributionManager.SERIAL_QUEUE_SIZE_LIMIT", 20000);
+
+  private static final int SERIAL_QUEUE_SIZE_THROTTLE =
+      Integer.getInteger("DistributionManager.SERIAL_QUEUE_SIZE_THROTTLE",
+          (int) (SERIAL_QUEUE_SIZE_LIMIT * THROTTLE_PERCENT));
+
+  /** Max number of serial Queue executors, in case of multi-serial-queue executor */
+  private static final int MAX_SERIAL_QUEUE_THREAD =
+      Integer.getInteger("DistributionManager.MAX_SERIAL_QUEUE_THREAD", 20);
+
+  // 76 not in use
+
+
+  /**
+   * Executor for view related messages
+   *
+   * @see ViewAckMessage
+   */
+  public static final int VIEW_EXECUTOR = 79;
+
+
+  private InternalDistributedSystem system;
+
+  private DistributionStats stats;
+
+
+  /** Message processing thread pool */
+  private ExecutorService threadPool;
+
+  /**
+   * High Priority processing thread pool, used for initializing messages such as UpdateAttributes
+   * and CreateRegion messages
+   */
+  private ExecutorService highPriorityPool;
+
+  /**
+   * Waiting Pool, used for messages that may have to wait on something. Use this separate pool with
+   * an unbounded queue so that waiting runnables don't get in the way of other processing threads.
+   * Used for threads that will most likely have to wait for a region to be finished initializing
+   * before it can proceed
+   */
+  private ExecutorService waitingPool;
+
+  private ExecutorService prMetaDataCleanupThreadPool;
+
+  /**
+   * Thread used to decouple {@link org.apache.geode.internal.cache.partitioned.PartitionMessage}s
+   * from {@link org.apache.geode.internal.cache.DistributedCacheOperation}s </b>
+   *
+   * @see #SERIAL_EXECUTOR
+   */
+  private ExecutorService partitionedRegionThread;
+  private ExecutorService partitionedRegionPool;
+
+  /** Function Execution executors */
+  private ExecutorService functionExecutionThread;
+  private ExecutorService functionExecutionPool;
+
+  /** Message processing executor for serial, ordered, messages. */
+  private ExecutorService serialThread;
+
+  /**
+   * Message processing executor for view messages
+   *
+   * @see ViewAckMessage
+   */
+  private ExecutorService viewThread;
+
+  /**
+   * If using a throttling queue for the serialThread, we cache the queue here so we can see if
+   * delivery would block
+   */
+  private ThrottlingMemLinkedQueueWithDMStats<Runnable> serialQueue;
+
+  /**
+   * Thread Monitor mechanism to monitor system threads
+   *
+   * @see org.apache.geode.internal.monitoring.ThreadsMonitoring
+   */
+  private ThreadsMonitoring threadMonitor;
+
+  private SerialQueuedExecutorPool serialQueuedExecutorPool;
+
+
+  ClusterOperationExecutors(DistributionStats stats,
+      InternalDistributedSystem system) {
+
+    this.stats = stats;
+    this.system = system;
+
+    DistributionConfig config = system.getConfig();
+
+    threadMonitor = config.getThreadMonitorEnabled() ? new ThreadsMonitoringImpl(system)
+        : new ThreadsMonitoringImplDummy();
+
+
+    if (MULTI_SERIAL_EXECUTORS) {
+      if (logger.isInfoEnabled(LogMarker.DM_MARKER)) {
+        logger.info(LogMarker.DM_MARKER,
+            "Serial Queue info :" + " THROTTLE_PERCENT: " + THROTTLE_PERCENT
+                + " SERIAL_QUEUE_BYTE_LIMIT :" + SERIAL_QUEUE_BYTE_LIMIT
+                + " SERIAL_QUEUE_THROTTLE :" + SERIAL_QUEUE_THROTTLE
+                + " TOTAL_SERIAL_QUEUE_BYTE_LIMIT :" + TOTAL_SERIAL_QUEUE_BYTE_LIMIT
+                + " TOTAL_SERIAL_QUEUE_THROTTLE :" + TOTAL_SERIAL_QUEUE_THROTTLE
+                + " SERIAL_QUEUE_SIZE_LIMIT :" + SERIAL_QUEUE_SIZE_LIMIT
+                + " SERIAL_QUEUE_SIZE_THROTTLE :" + SERIAL_QUEUE_SIZE_THROTTLE);
+      }
+      // when TCP/IP is disabled we can't throttle the serial queue or we run the risk of
+      // distributed deadlock when we block the UDP reader thread
+      boolean throttlingDisabled = system.getConfig().getDisableTcp();
+      serialQueuedExecutorPool =
+          new SerialQueuedExecutorPool(stats, throttlingDisabled, threadMonitor);
+    }
+
+    {
+      BlockingQueue<Runnable> poolQueue;
+      if (SERIAL_QUEUE_BYTE_LIMIT == 0) {
+        poolQueue = new OverflowQueueWithDMStats<>(stats.getSerialQueueHelper());
+      } else {
+        serialQueue =
+            new ThrottlingMemLinkedQueueWithDMStats<>(TOTAL_SERIAL_QUEUE_BYTE_LIMIT,
+                TOTAL_SERIAL_QUEUE_THROTTLE, SERIAL_QUEUE_SIZE_LIMIT, SERIAL_QUEUE_SIZE_THROTTLE,
+                stats.getSerialQueueHelper());
+        poolQueue = serialQueue;
+      }
+      serialThread = LoggingExecutors.newSerialThreadPool("Serial Message Processor",
+          thread -> stats.incSerialThreadStarts(),
+          this::doSerialThread, stats.getSerialProcessorHelper(),
+          threadMonitor, poolQueue);
+
+    }
+
+    viewThread =
+        LoggingExecutors.newSerialThreadPoolWithUnlimitedFeed("View Message Processor",
+            thread -> stats.incViewThreadStarts(), this::doViewThread,
+            stats.getViewProcessorHelper(), threadMonitor);
+
+    threadPool =
+        LoggingExecutors.newThreadPoolWithFeedStatistics("Pooled Message Processor ",
+            thread -> stats.incProcessingThreadStarts(), this::doProcessingThread,
+            MAX_THREADS, stats.getNormalPoolHelper(), threadMonitor,
+            INCOMING_QUEUE_LIMIT, stats.getOverflowQueueHelper());
+
+    highPriorityPool = LoggingExecutors.newThreadPoolWithFeedStatistics(
+        "Pooled High Priority Message Processor ",
+        thread -> stats.incHighPriorityThreadStarts(), this::doHighPriorityThread,
+        MAX_THREADS, stats.getHighPriorityPoolHelper(), threadMonitor,
+        INCOMING_QUEUE_LIMIT, stats.getHighPriorityQueueHelper());
+
+    {
+      BlockingQueue<Runnable> poolQueue;
+      if (MAX_WAITING_THREADS == Integer.MAX_VALUE) {
+        // no need for a queue since we have infinite threads
+        poolQueue = new SynchronousQueue<>();
+      } else {
+        poolQueue = new OverflowQueueWithDMStats<>(stats.getWaitingQueueHelper());
+      }
+      waitingPool = LoggingExecutors.newThreadPool("Pooled Waiting Message Processor ",
+          thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
+          MAX_WAITING_THREADS, stats.getWaitingPoolHelper(), threadMonitor, poolQueue);
+    }
+
+    // should this pool using the waiting pool stats?
+    prMetaDataCleanupThreadPool =
+        LoggingExecutors.newThreadPoolWithFeedStatistics("PrMetaData cleanup Message Processor ",
+            thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
+            MAX_PR_META_DATA_CLEANUP_THREADS, stats.getWaitingPoolHelper(), threadMonitor,
+            0, stats.getWaitingQueueHelper());
+
+    if (MAX_PR_THREADS > 1) {
+      partitionedRegionPool =
+          LoggingExecutors.newThreadPoolWithFeedStatistics("PartitionedRegion Message Processor",
+              thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
+              MAX_PR_THREADS, stats.getPartitionedRegionPoolHelper(), threadMonitor,
+              INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
+    } else {
+      partitionedRegionThread = LoggingExecutors.newSerialThreadPoolWithFeedStatistics(
+          "PartitionedRegion Message Processor",
+          thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
+          stats.getPartitionedRegionPoolHelper(), threadMonitor,
+          INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
+    }
+    if (MAX_FE_THREADS > 1) {
+      functionExecutionPool =
+          LoggingExecutors.newFunctionThreadPoolWithFeedStatistics(
+              FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
+              thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
+              MAX_FE_THREADS, stats.getFunctionExecutionPoolHelper(), threadMonitor,
+              INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
+    } else {
+      functionExecutionThread =
+          LoggingExecutors.newSerialThreadPoolWithFeedStatistics(
+              FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
+              thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
+              stats.getFunctionExecutionPoolHelper(), threadMonitor,
+              INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
+    }
+  }
+
+  /**
+   * Returns the executor for the given type of processor.
+   */
+  @Override
+  public Executor getExecutor(int processorType, InternalDistributedMember sender) {
+    switch (processorType) {
+      case STANDARD_EXECUTOR:
+        return getThreadPool();
+      case SERIAL_EXECUTOR:
+        return getSerialExecutor(sender);
+      case VIEW_EXECUTOR:
+        return viewThread;
+      case HIGH_PRIORITY_EXECUTOR:
+        return getHighPriorityThreadPool();
+      case WAITING_POOL_EXECUTOR:
+        return getWaitingThreadPool();
+      case PARTITIONED_REGION_EXECUTOR:
+        return getPartitionedRegionExcecutor();
+      case REGION_FUNCTION_EXECUTION_EXECUTOR:
+        return getFunctionExecutor();
+      default:
+        throw new InternalGemFireError(String.format("unknown processor type %s",
+            processorType));
+    }
+  }
+
+  @Override
+  public ExecutorService getThreadPool() {
+    return threadPool;
+  }
+
+  @Override
+  public ExecutorService getHighPriorityThreadPool() {
+    return highPriorityPool;
+  }
+
+  @Override
+  public ExecutorService getWaitingThreadPool() {
+    return waitingPool;
+  }
+
+  @Override
+  public ExecutorService getPrMetaDataCleanupThreadPool() {
+    return prMetaDataCleanupThreadPool;
+  }
+
+  private Executor getPartitionedRegionExcecutor() {
+    if (partitionedRegionThread != null) {
+      return partitionedRegionThread;
+    } else {
+      return partitionedRegionPool;
+    }
+  }
+
+
+  @Override
+  public Executor getFunctionExecutor() {
+    if (functionExecutionThread != null) {
+      return functionExecutionThread;
+    } else {
+      return functionExecutionPool;
+    }
+  }
+
+  private Executor getSerialExecutor(InternalDistributedMember sender) {
+    if (MULTI_SERIAL_EXECUTORS) {
+      return serialQueuedExecutorPool.getThrottledSerialExecutor(sender);
+    } else {
+      return serialThread;
+    }
+  }
+
+  /** returns the serialThread's queue if throttling is being used, null if not */
+  @Override
+  public OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
+    if (MULTI_SERIAL_EXECUTORS) {
+      return serialQueuedExecutorPool.getSerialQueue(sender);
+    } else {
+      return serialQueue;
+    }
+  }
+
+  public ThreadsMonitoring getThreadMonitoring() {
+    return threadMonitor;
+  }
+
+
+
+  private void doFunctionExecutionThread(Runnable command) {
+    stats.incFunctionExecutionThreads(1);
+    FunctionExecutionPooledExecutor.setIsFunctionExecutionThread(Boolean.TRUE);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incFunctionExecutionThreads(-1);
+      FunctionExecutionPooledExecutor.setIsFunctionExecutionThread(Boolean.FALSE);
+    }
+  }
+
+  private void doProcessingThread(Runnable command) {
+    stats.incNumProcessingThreads(1);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incNumProcessingThreads(-1);
+    }
+  }
+
+  private void doHighPriorityThread(Runnable command) {
+    stats.incHighPriorityThreads(1);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incHighPriorityThreads(-1);
+    }
+  }
+
+  private void doWaitingThread(Runnable command) {
+    stats.incWaitingThreads(1);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incWaitingThreads(-1);
+    }
+  }
+
+  private void doPartitionRegionThread(Runnable command) {
+    stats.incPartitionedRegionThreads(1);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incPartitionedRegionThreads(-1);
+    }
+  }
+
+  private void doViewThread(Runnable command) {
+    stats.incNumViewThreads(1);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incNumViewThreads(-1);
+    }
+  }
+
+  private void doSerialThread(Runnable command) {
+    stats.incNumSerialThreads(1);
+    try {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      runUntilShutdown(command);
+    } finally {
+      ConnectionTable.releaseThreadsSockets();
+      stats.incNumSerialThreads(-1);
+    }
+  }
+
+  private void runUntilShutdown(Runnable r) {
+    try {
+      r.run();
+    } catch (CancelException e) {
+      if (logger.isTraceEnabled()) {
+        logger.trace("Caught shutdown exception", e);
+      }
+    } catch (VirtualMachineError err) {
+      SystemFailure.initiateFailure(err);
+      // If this ever returns, rethrow the error. We're poisoned
+      // now, so don't let this thread continue.
+      throw err;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      if (!system.isDisconnecting()) {
+        logger.debug("Caught unusual exception during shutdown: {}", t.getMessage(), t);
+      } else {
+        logger.warn("Task failed with exception", t);
+      }
+    }
+  }
+
+  void askThreadsToStop() {
+    // Stop executors after they have finished
+    ExecutorService es;
+    threadMonitor.close();
+    es = serialThread;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = viewThread;
+    if (es != null) {
+      // Hmmm...OK, I'll let any view events currently in the queue be
+      // processed. Not sure it's very important whether they get
+      // handled...
+      es.shutdown();
+    }
+    if (serialQueuedExecutorPool != null) {
+      serialQueuedExecutorPool.shutdown();
+    }
+    es = functionExecutionThread;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = functionExecutionPool;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = partitionedRegionThread;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = partitionedRegionPool;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = highPriorityPool;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = waitingPool;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = prMetaDataCleanupThreadPool;
+    if (es != null) {
+      es.shutdown();
+    }
+    es = threadPool;
+    if (es != null) {
+      es.shutdown();
+    }
+  }
+
+  void waitForThreadsToStop(long timeInMillis) throws InterruptedException {
+    long start = System.currentTimeMillis();
+    long remaining = timeInMillis;
+
+    ExecutorService[] allExecutors = new ExecutorService[] {serialThread, viewThread,
+        functionExecutionThread, functionExecutionPool, partitionedRegionThread,
+        partitionedRegionPool, highPriorityPool, waitingPool,
+        prMetaDataCleanupThreadPool, threadPool};
+    for (ExecutorService es : allExecutors) {
+      if (es != null) {
+        es.awaitTermination(remaining, TimeUnit.MILLISECONDS);
+      }
+      remaining = timeInMillis - (System.currentTimeMillis() - start);
+      if (remaining <= 0) {
+        return;
+      }
+    }
+
+    serialQueuedExecutorPool.awaitTermination(remaining, TimeUnit.MILLISECONDS);
+  }
+
+  private boolean executorAlive(ExecutorService tpe, String name) {
+    if (tpe == null) {
+      return false;
+    } else {
+      int ac = ((ThreadPoolExecutor) tpe).getActiveCount();
+      // boolean result = tpe.getActiveCount() > 0;
+      if (ac > 0) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Still waiting for {} threads in '{}' pool to exit", ac, name);
+        }
+        return true;
+      } else {
+        return false;
+      }
+    }
+  }
+
+
+  /**
+   * Wait for the ancillary queues to exit. Kills them if they are still around.
+   *
+   */
+  void forceThreadsToStop() {
+    long endTime = System.currentTimeMillis() + MAX_STOP_TIME;
+    StringBuilder culprits;
+    for (;;) {
+      boolean stillAlive = false;
+      culprits = new StringBuilder();
+      if (executorAlive(serialThread, "serial thread")) {
+        stillAlive = true;
+        culprits.append(" serial thread;");
+      }
+      if (executorAlive(viewThread, "view thread")) {
+        stillAlive = true;
+        culprits.append(" view thread;");
+      }
+      if (executorAlive(partitionedRegionThread, "partitioned region thread")) {
+        stillAlive = true;
+        culprits.append(" partitioned region thread;");
+      }
+      if (executorAlive(partitionedRegionPool, "partitioned region pool")) {
+        stillAlive = true;
+        culprits.append(" partitioned region pool;");
+      }
+      if (executorAlive(highPriorityPool, "high priority pool")) {
+        stillAlive = true;
+        culprits.append(" high priority pool;");
+      }
+      if (executorAlive(waitingPool, "waiting pool")) {
+        stillAlive = true;
+        culprits.append(" waiting pool;");
+      }
+      if (executorAlive(prMetaDataCleanupThreadPool, "prMetaDataCleanupThreadPool")) {
+        stillAlive = true;
+        culprits.append(" special waiting pool;");
+      }
+      if (executorAlive(threadPool, "thread pool")) {
+        stillAlive = true;
+        culprits.append(" thread pool;");
+      }
+
+      if (!stillAlive)
+        return;
+
+      long now = System.currentTimeMillis();
+      if (now >= endTime)
+        break;
+
+      try {
+        Thread.sleep(STOP_PAUSE_TIME);
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+        // Desperation, the shutdown thread is being killed. Don't
+        // consult a CancelCriterion.
+        logger.warn("Interrupted during shutdown", e);
+        break;
+      }
+    } // for
+
+    logger.warn("Daemon threads are slow to stop; culprits include: {}",
+        culprits);
+
+    // Kill with no mercy
+    if (serialThread != null) {
+      serialThread.shutdownNow();
+    }
+    if (viewThread != null) {
+      viewThread.shutdownNow();
+    }
+    if (functionExecutionThread != null) {
+      functionExecutionThread.shutdownNow();
+    }
+    if (functionExecutionPool != null) {
+      functionExecutionPool.shutdownNow();
+    }
+    if (partitionedRegionThread != null) {
+      partitionedRegionThread.shutdownNow();
+    }
+    if (partitionedRegionPool != null) {
+      partitionedRegionPool.shutdownNow();
+    }
+    if (highPriorityPool != null) {
+      highPriorityPool.shutdownNow();
+    }
+    if (waitingPool != null) {
+      waitingPool.shutdownNow();
+    }
+    if (prMetaDataCleanupThreadPool != null) {
+      prMetaDataCleanupThreadPool.shutdownNow();
+    }
+    if (threadPool != null) {
+      threadPool.shutdownNow();
+    }
+  }
+
+  public void handleManagerDeparture(InternalDistributedMember theId) {
+    // Remove this manager from the serialQueueExecutor.
+    if (serialQueuedExecutorPool != null) {
+      serialQueuedExecutorPool.handleMemberDeparture(theId);
+    }
+  }
+
+  /**
+   * This class is used for DM's multi serial executor. The serial messages are managed/executed by
+   * multiple serial thread. This class takes care of executing messages related to a sender using
+   * the same thread.
+   */
+  private static class SerialQueuedExecutorPool {
+    /** To store the serial threads */
+    final ConcurrentMap<Integer, ExecutorService> serialQueuedExecutorMap =
+        new ConcurrentHashMap<>(MAX_SERIAL_QUEUE_THREAD);
+
+    /** To store the queue associated with thread */
+    final Map<Integer, OverflowQueueWithDMStats<Runnable>> serialQueuedMap =
+        new HashMap<>(MAX_SERIAL_QUEUE_THREAD);
+
+    /** Holds mapping between sender to the serial thread-id */
+    final Map<InternalDistributedMember, Integer> senderToSerialQueueIdMap = new HashMap<>();
+
+    /**
+     * Holds info about unused thread, a thread is marked unused when the member associated with it
+     * has left distribution system.
+     */
+    final ArrayList<Integer> threadMarkedForUse = new ArrayList<>();
+
+    final DistributionStats stats;
+
+    final boolean throttlingDisabled;
+
+    final ThreadsMonitoring threadMonitoring;
+
+    SerialQueuedExecutorPool(DistributionStats stats,
+        boolean throttlingDisabled, ThreadsMonitoring tMonitoring) {
+      this.stats = stats;
+      this.throttlingDisabled = throttlingDisabled;
+      threadMonitoring = tMonitoring;
+    }
+
+    /*
+     * Returns an id of the thread in serialQueuedExecutorMap, thats mapped to the given seder.
+     *
+     *
+     * @param createNew boolean flag to indicate whether to create a new id, if id doesnot exists.
+     */
+    private Integer getQueueId(InternalDistributedMember sender, boolean createNew) {
+      // Create a new Id.
+      Integer queueId;
+
+      synchronized (senderToSerialQueueIdMap) {
+        // Check if there is a executor associated with this sender.
+        queueId = senderToSerialQueueIdMap.get(sender);
+
+        if (!createNew || queueId != null) {
+          return queueId;
+        }
+
+        // Create new.
+        // Check if any threads are availabe that is marked for Use.
+        if (!threadMarkedForUse.isEmpty()) {
+          queueId = threadMarkedForUse.remove(0);
+        }
+        // If Map is full, use the threads in round-robin fashion.
+        if (queueId == null) {
+          queueId = (serialQueuedExecutorMap.size() + 1) % MAX_SERIAL_QUEUE_THREAD;
+        }
+        senderToSerialQueueIdMap.put(sender, queueId);
+      }
+      return queueId;
+    }
+
+    /*
+     * Returns the queue associated with this sender. Used in FlowControl for throttling (based on
+     * queue size).
+     */
+    OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
+      Integer queueId = getQueueId(sender, false);
+      if (queueId == null) {
+        return null;
+      }
+      return serialQueuedMap.get(queueId);
+    }
+
+    /*
+     * Returns the serial queue executor, before returning the thread this applies throttling, based
+     * on the total serial queue size (total - sum of all the serial queue size). The throttling is
+     * applied during put event, this doesnt block the extract operation on the queue.
+     *
+     */
+    ExecutorService getThrottledSerialExecutor(
+        InternalDistributedMember sender) {
+      ExecutorService executor = getSerialExecutor(sender);
+
+      // Get the total serial queue size.
+      long totalSerialQueueMemSize = stats.getInternalSerialQueueBytes();
+
+      // for tcp socket reader threads, this code throttles the thread
+      // to keep the sender-side from overwhelming the receiver.
+      // UDP readers are throttled in the FC protocol, which queries
+      // the queue to see if it should throttle
+      if (stats.getInternalSerialQueueBytes() > TOTAL_SERIAL_QUEUE_THROTTLE
+          && !DistributionMessage.isPreciousThread()) {
+        do {
+          boolean interrupted = Thread.interrupted();
+          try {
+            float throttlePercent = (float) (totalSerialQueueMemSize - TOTAL_SERIAL_QUEUE_THROTTLE)
+                / (float) (TOTAL_SERIAL_QUEUE_BYTE_LIMIT - TOTAL_SERIAL_QUEUE_THROTTLE);
+            int sleep = (int) (100.0 * throttlePercent);
+            sleep = Math.max(sleep, 1);
+            Thread.sleep(sleep);
+          } catch (InterruptedException ex) {
+            interrupted = true;
+            // FIXME-InterruptedException
+            // Perhaps we should return null here?
+          } finally {
+            if (interrupted) {
+              Thread.currentThread().interrupt();
+            }
+          }
+          stats.getSerialQueueHelper().incThrottleCount();
+        } while (stats.getInternalSerialQueueBytes() >= TOTAL_SERIAL_QUEUE_BYTE_LIMIT);
+      }
+      return executor;
+    }
+
+    /*
+     * Returns the serial queue executor for the given sender.
+     */
+    ExecutorService getSerialExecutor(InternalDistributedMember sender) {
+      ExecutorService executor;
+      Integer queueId = getQueueId(sender, true);
+      if ((executor =
+          serialQueuedExecutorMap.get(queueId)) != null) {
+        return executor;
+      }
+      // If executor doesn't exists for this sender, create one.
+      executor = createSerialExecutor(queueId);
+
+      serialQueuedExecutorMap.put(queueId, executor);
+
+      if (logger.isDebugEnabled()) {
+        logger.debug(
+            "Created Serial Queued Executor With queueId {}. Total number of live Serial Threads :{}",
+            queueId, serialQueuedExecutorMap.size());
+      }
+      stats.incSerialPooledThread();
+      return executor;
+    }
+
+    /*
+     * Creates a serial queue executor.
+     */
+    private ExecutorService createSerialExecutor(final Integer id) {
+
+      OverflowQueueWithDMStats<Runnable> poolQueue;
+
+      if (SERIAL_QUEUE_BYTE_LIMIT == 0 || throttlingDisabled) {
+        poolQueue = new OverflowQueueWithDMStats<>(stats.getSerialQueueHelper());
+      } else {
+        poolQueue = new ThrottlingMemLinkedQueueWithDMStats<>(SERIAL_QUEUE_BYTE_LIMIT,
+            SERIAL_QUEUE_THROTTLE, SERIAL_QUEUE_SIZE_LIMIT, SERIAL_QUEUE_SIZE_THROTTLE,
+            stats.getSerialQueueHelper());
+      }
+
+      serialQueuedMap.put(id, poolQueue);
+
+      return LoggingExecutors.newSerialThreadPool("Pooled Serial Message Processor" + id + "-",
+          thread -> stats.incSerialPooledThreadStarts(), this::doSerialPooledThread,
+          stats.getSerialPooledProcessorHelper(), threadMonitoring, poolQueue);
+    }
+
+    private void doSerialPooledThread(Runnable command) {
+      ConnectionTable.threadWantsSharedResources();
+      Connection.makeReaderThread();
+      try {
+        command.run();
+      } finally {
+        ConnectionTable.releaseThreadsSockets();
+      }
+    }
+
+    /*
+     * Does cleanup relating to this member. And marks the serial executor associated with this
+     * member for re-use.
+     */
+    private void handleMemberDeparture(InternalDistributedMember member) {
+      Integer queueId = getQueueId(member, false);
+      if (queueId == null) {
+        return;
+      }
+
+      boolean isUsed = false;
+
+      synchronized (senderToSerialQueueIdMap) {
+        senderToSerialQueueIdMap.remove(member);
+
+        // Check if any other members are using the same executor.
+        for (Integer value : senderToSerialQueueIdMap.values()) {
+          if (value.equals(queueId)) {
+            isUsed = true;
+            break;
+          }
+        }
+
+        // If not used mark this as unused.
+        if (!isUsed) {
+          if (logger.isInfoEnabled(LogMarker.DM_MARKER))
+            logger.info(LogMarker.DM_MARKER,
+                "Marking the SerialQueuedExecutor with id : {} used by the member {} to be unused.",
+                new Object[] {queueId, member});
+
+          threadMarkedForUse.add(queueId);
+        }
+      }
+    }
+
+    private void awaitTermination(long time, TimeUnit unit) throws InterruptedException {
+      long remainingNanos = unit.toNanos(time);
+      long start = System.nanoTime();
+      for (ExecutorService executor : serialQueuedExecutorMap.values()) {
+        executor.awaitTermination(remainingNanos, TimeUnit.NANOSECONDS);
+        remainingNanos = (System.nanoTime() - start);
+        if (remainingNanos <= 0) {
+          return;
+        }
+      }
+    }
+
+    private void shutdown() {
+      for (ExecutorService executor : serialQueuedExecutorMap
+          .values()) {
+        executor.shutdown();
+      }
+    }
+  }
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
index 3c631d6..86d59bb 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
@@ -19,8 +19,6 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
 
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.admin.GemFireHealthConfig;
@@ -230,30 +228,10 @@ public interface DistributionManager extends ReplySender {
    */
   void handleManagerDeparture(InternalDistributedMember theId, boolean crashed, String reason);
 
-  /**
-   * getThreadPool gets this distribution manager's message-processing thread pool
-   */
-  ExecutorService getThreadPool();
-
-  /**
-   * Return the high-priority message-processing executor
-   */
-  ExecutorService getHighPriorityThreadPool();
-
-  /**
-   * Return the waiting message-processing executor
-   */
-  ExecutorService getWaitingThreadPool();
+  OperationExecutors getExecutors();
 
-  /**
-   * Return the special waiting message-processing executor
-   */
-  ExecutorService getPrMetaDataCleanupThreadPool();
-
-  /**
-   * Return the executor used for function processing
-   */
-  Executor getFunctionExecutor();
+  /** returns the Threads Monitoring instance */
+  ThreadsMonitoring getThreadMonitoring();
 
   void close();
 
@@ -471,9 +449,6 @@ public interface DistributionManager extends ReplySender {
    */
   DistributedMember getMemberWithName(String name);
 
-  /** returns the Threads Monitoring instance */
-  public ThreadsMonitoring getThreadMonitoring();
-
   /**
    * Returns the {@link AlertingService}.
    */
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
index ef6837e..fcf1e25 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
@@ -190,12 +190,12 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
   public boolean orderedDelivery() {
     final int processorType = getProcessorType();
     switch (processorType) {
-      case ClusterDistributionManager.SERIAL_EXECUTOR:
+      case OperationExecutors.SERIAL_EXECUTOR:
         // no need to use orderedDelivery for PR ops particularly when thread
         // does not own resources
         // case DistributionManager.PARTITIONED_REGION_EXECUTOR:
         return true;
-      case ClusterDistributionManager.REGION_FUNCTION_EXECUTION_EXECUTOR:
+      case OperationExecutors.REGION_FUNCTION_EXECUTION_EXECUTOR:
         // allow nested distributed functions to be executed from within the
         // execution of a function
         return false;
@@ -326,7 +326,7 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
    * Return the Executor in which to process this message.
    */
   protected Executor getExecutor(ClusterDistributionManager dm) {
-    return dm.getExecutor(getProcessorType(), sender);
+    return dm.getExecutors().getExecutor(getProcessorType(), sender);
   }
 
   public abstract int getProcessorType();
@@ -408,7 +408,7 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
    */
   protected void schedule(final ClusterDistributionManager dm) {
     boolean inlineProcess = INLINE_PROCESS
-        && getProcessorType() == ClusterDistributionManager.SERIAL_EXECUTOR && !isPreciousThread();
+        && getProcessorType() == OperationExecutors.SERIAL_EXECUTOR && !isPreciousThread();
 
     boolean forceInline = this.acker != null || getInlineProcess() || Connection.isDominoThread();
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/FunctionExecutionPooledExecutor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/FunctionExecutionPooledExecutor.java
index a6c8c52..d394e00 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/FunctionExecutionPooledExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/FunctionExecutionPooledExecutor.java
@@ -15,7 +15,7 @@
 
 package org.apache.geode.distributed.internal;
 
-import static org.apache.geode.distributed.internal.ClusterDistributionManager.FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX;
+import static org.apache.geode.distributed.internal.OperationExecutors.FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX;
 
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
@@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
+import org.apache.geode.annotations.internal.MakeNotStatic;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.monitoring.ThreadsMonitoring;
 
@@ -54,6 +55,28 @@ public class FunctionExecutionPooledExecutor extends ThreadPoolExecutor {
       Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "RETRY_INTERVAL", 5000).intValue();
 
   /**
+   * Identifier for function execution threads and any of their children
+   */
+  @MakeNotStatic()
+  private static final InheritableThreadLocal<Boolean> isFunctionExecutionThread =
+      new InheritableThreadLocal<Boolean>() {
+        @Override
+        protected Boolean initialValue() {
+          return Boolean.FALSE;
+        }
+      };
+
+
+  /**
+   * Is the current thread used for executing Functions?
+   */
+  public static boolean isFunctionExecutionThread() {
+    return isFunctionExecutionThread.get().booleanValue();
+  }
+
+
+
+  /**
    * Create a new pool
    **/
   public FunctionExecutionPooledExecutor(BlockingQueue<Runnable> q, int maxPoolSize,
@@ -120,7 +143,7 @@ public class FunctionExecutionPooledExecutor extends ThreadPoolExecutor {
         }
 
         private boolean isFunctionExecutionThread() {
-          return ClusterDistributionManager.isFunctionExecutionThread();
+          return isFunctionExecutionThread.get();
         }
 
         /**
@@ -211,6 +234,10 @@ public class FunctionExecutionPooledExecutor extends ThreadPoolExecutor {
     }
   }
 
+  public static void setIsFunctionExecutionThread(Boolean isExecutionThread) {
+    isFunctionExecutionThread.set(isExecutionThread);
+  }
+
   @Override
   public void shutdown() {
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityAckedMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityAckedMessage.java
index 4d9aece..0360c91 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityAckedMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityAckedMessage.java
@@ -162,7 +162,8 @@ public class HighPriorityAckedMessage extends HighPriorityDistributionMessage
         Assert.assertTrue(this.id != null);
         // wait 10 seconds for the high priority queue to drain
         long endTime = System.currentTimeMillis() + 10000;
-        ThreadPoolExecutor pool = (ThreadPoolExecutor) dm.getHighPriorityThreadPool();
+        ThreadPoolExecutor pool =
+            (ThreadPoolExecutor) dm.getExecutors().getHighPriorityThreadPool();
         while (pool.getActiveCount() > 1 && System.currentTimeMillis() < endTime) {
           boolean interrupted = Thread.interrupted();
           try {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityDistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityDistributionMessage.java
index 4c6de8e..6123a4b 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityDistributionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/HighPriorityDistributionMessage.java
@@ -19,7 +19,7 @@ public abstract class HighPriorityDistributionMessage extends DistributionMessag
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+    return OperationExecutors.HIGH_PRIORITY_EXECUTOR;
   }
 
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index 592b060..c98af90 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -1285,7 +1285,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
 
   public SharedConfigurationStatusResponse getSharedConfigurationStatus() {
     ExecutorService waitingPoolExecutor =
-        internalCache.getDistributionManager().getWaitingThreadPool();
+        internalCache.getDistributionManager().getExecutors().getWaitingThreadPool();
     Future<SharedConfigurationStatusResponse> statusFuture =
         waitingPoolExecutor.submit(new FetchSharedConfigStatus());
     SharedConfigurationStatusResponse response;
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
index e0d1aa4..c25996b 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
@@ -24,13 +24,11 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -95,10 +93,9 @@ public class LonerDistributionManager implements DistributionManager {
     this.viewMembers = new ArrayList<>(allIds);
     DistributionStats.enableClockStats = this.system.getConfig().getEnableTimeStatistics();
 
-    Properties nonDefault = new Properties();
-    DistributionConfigImpl distributionConfigImpl = new DistributionConfigImpl(nonDefault);
+    DistributionConfig config = system.getConfig();
 
-    if (distributionConfigImpl.getThreadMonitorEnabled()) {
+    if (config.getThreadMonitorEnabled()) {
       this.threadMonitor = new ThreadsMonitoringImpl(system);
       logger.info("[ThreadsMonitor] New Monitor object and process were created.\n");
     } else {
@@ -109,10 +106,6 @@ public class LonerDistributionManager implements DistributionManager {
 
   ////////////////////// Instance Methods //////////////////////
 
-  protected void startThreads() {
-    // no threads needed
-  }
-
   protected void shutdown() {
     threadMonitor.close();
     executor.shutdown();
@@ -134,6 +127,8 @@ public class LonerDistributionManager implements DistributionManager {
   private final ExecutorService executor =
       LoggingExecutors.newCachedThreadPool("LonerDistributionManagerThread", false);
 
+  private final OperationExecutors executors = new LonerOperationExecutors(executor);
+
   @Override
   public long cacheTimeMillis() {
     return this.system.getClock().cacheTimeMillis();
@@ -305,28 +300,8 @@ public class LonerDistributionManager implements DistributionManager {
   }
 
   @Override
-  public ExecutorService getThreadPool() {
-    return executor;
-  }
-
-  @Override
-  public ExecutorService getHighPriorityThreadPool() {
-    return executor;
-  }
-
-  @Override
-  public ExecutorService getWaitingThreadPool() {
-    return executor;
-  }
-
-  @Override
-  public ExecutorService getPrMetaDataCleanupThreadPool() {
-    return executor;
-  }
-
-  @Override
-  public Executor getFunctionExecutor() {
-    return executor;
+  public OperationExecutors getExecutors() {
+    return executors;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerOperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerOperationExecutors.java
new file mode 100644
index 0000000..a26c2e0
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerOperationExecutors.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+
+public class LonerOperationExecutors implements OperationExecutors {
+  private final ExecutorService executor;
+
+  public LonerOperationExecutors(ExecutorService executor) {
+    this.executor = executor;
+  }
+
+  @Override
+  public Executor getExecutor(int processorType, InternalDistributedMember sender) {
+    return executor;
+  }
+
+  @Override
+  public ExecutorService getThreadPool() {
+    return executor;
+  }
+
+  @Override
+  public ExecutorService getHighPriorityThreadPool() {
+    return executor;
+  }
+
+  @Override
+  public ExecutorService getWaitingThreadPool() {
+    return executor;
+  }
+
+  @Override
+  public ExecutorService getPrMetaDataCleanupThreadPool() {
+    return executor;
+  }
+
+  @Override
+  public Executor getFunctionExecutor() {
+    return executor;
+  }
+
+  @Override
+  public OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender) {
+    throw new UnsupportedOperationException(
+        "non-clustered caches do not support a serial executor queue");
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java
new file mode 100644
index 0000000..c4bc0c8
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+
+/**
+ * OperationExecutors holds the thread pools used to execute cache operations. There
+ * are a number of different thread pools available. Each DistributionMessage has
+ * a processor-type that determines which pool will be used to execute the message.
+ */
+public interface OperationExecutors {
+  int MAX_THREADS =
+      Integer.getInteger("DistributionManager.MAX_THREADS", 100);
+
+  int MAX_FE_THREADS = Integer.getInteger("DistributionManager.MAX_FE_THREADS",
+      Math.max(Runtime.getRuntime().availableProcessors() * 4, 16));
+  /**
+   * @see PooledDistributionMessage
+   */
+  int STANDARD_EXECUTOR = 73;
+  /**
+   * @see SerialDistributionMessage
+   */
+  int SERIAL_EXECUTOR = 74;
+  /**
+   * @see HighPriorityDistributionMessage
+   */
+  int HIGH_PRIORITY_EXECUTOR = 75;
+  /**
+   * @see org.apache.geode.internal.cache.InitialImageOperation
+   */
+  int WAITING_POOL_EXECUTOR = 77;
+  /**
+   * @see org.apache.geode.internal.cache.InitialImageOperation
+   */
+  int PARTITIONED_REGION_EXECUTOR = 78;
+
+  int REGION_FUNCTION_EXECUTION_EXECUTOR = 80;
+
+  String FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX =
+      "Function Execution Processor";
+
+  Executor getExecutor(int processorType, InternalDistributedMember sender);
+
+  ExecutorService getThreadPool();
+
+  ExecutorService getHighPriorityThreadPool();
+
+  ExecutorService getWaitingThreadPool();
+
+  ExecutorService getPrMetaDataCleanupThreadPool();
+
+  Executor getFunctionExecutor();
+
+  OverflowQueueWithDMStats<Runnable> getSerialQueue(InternalDistributedMember sender);
+}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/PooledDistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/PooledDistributionMessage.java
index beafa32..ff4e8ff 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/PooledDistributionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/PooledDistributionMessage.java
@@ -24,7 +24,7 @@ public abstract class PooledDistributionMessage extends DistributionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.STANDARD_EXECUTOR;
+    return OperationExecutors.STANDARD_EXECUTOR;
   }
 
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialDistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialDistributionMessage.java
index f745ea5..452f471 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialDistributionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/SerialDistributionMessage.java
@@ -24,7 +24,7 @@ public abstract class SerialDistributionMessage extends DistributionMessage {
   // not "final" because it's overridden in ViewMessage
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.SERIAL_EXECUTOR;
+    return OperationExecutors.SERIAL_EXECUTOR;
   }
 
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java
index e2c4218..e749b45 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java
@@ -308,7 +308,7 @@ public class StartupMessage extends DistributionMessage implements AdminMessageT
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupResponseMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupResponseMessage.java
index 50e22ce..2ab827a 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupResponseMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupResponseMessage.java
@@ -124,7 +124,7 @@ public class StartupResponseMessage extends DistributionMessage
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/WaitForViewInstallation.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/WaitForViewInstallation.java
index e324ccd..ce5159a 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/WaitForViewInstallation.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/WaitForViewInstallation.java
@@ -53,7 +53,7 @@ public class WaitForViewInstallation extends HighPriorityDistributionMessage
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java
index 6157e59..9851322 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java
@@ -3590,7 +3590,7 @@ public class DLockGrantor {
           logger.trace(LogMarker.DLS_VERBOSE,
               "[DLockGrantor.memberDeparted] waiting thread pool will process id={}", id);
         }
-        distMgr.getWaitingThreadPool().execute(new Runnable() {
+        distMgr.getExecutors().getWaitingThreadPool().execute(new Runnable() {
           @Override
           public void run() {
             try {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockQueryProcessor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockQueryProcessor.java
index 11df3a1..b5880fc 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockQueryProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockQueryProcessor.java
@@ -214,7 +214,7 @@ public class DLockQueryProcessor extends ReplyProcessor21 {
      */
     private void executeBasicProcess(final DistributionManager dm) {
       final DLockQueryMessage msg = this;
-      dm.getWaitingThreadPool().execute(new Runnable() {
+      dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
         @Override
         public void run() {
           if (logger.isTraceEnabled(LogMarker.DLS_VERBOSE)) {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockReleaseProcessor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockReleaseProcessor.java
index 9159f9e..8327030 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockReleaseProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockReleaseProcessor.java
@@ -225,7 +225,7 @@ public class DLockReleaseProcessor extends ReplyProcessor21 {
      */
     private void executeBasicProcess(final DistributionManager dm) {
       final DLockReleaseMessage msg = this;
-      dm.getWaitingThreadPool().execute(new Runnable() {
+      dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
         @Override
         public void run() {
           if (logger.isTraceEnabled(LogMarker.DLS_VERBOSE)) {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRequestProcessor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRequestProcessor.java
index 282d6d9..f486430 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRequestProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockRequestProcessor.java
@@ -576,7 +576,7 @@ public class DLockRequestProcessor extends ReplyProcessor21 {
      */
     private void executeBasicProcess(final DistributionManager dm) {
       final DLockRequestMessage msg = this;
-      dm.getWaitingThreadPool().execute(new Runnable() {
+      dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
         @Override
         public void run() {
           if (logger.isTraceEnabled(LogMarker.DLS_VERBOSE)) {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java
index d4185fe..09d4847 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMembershipManager.java
@@ -58,6 +58,7 @@ import org.apache.geode.distributed.internal.DistributionException;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.OverflowQueueWithDMStats;
 import org.apache.geode.distributed.internal.ShutdownMessage;
 import org.apache.geode.distributed.internal.SizeableRunnable;
@@ -2154,7 +2155,7 @@ public class GMSMembershipManager implements MembershipManager {
     // run a message through the member's serial execution queue to ensure that all of its
     // current messages have been processed
     boolean result = false;
-    OverflowQueueWithDMStats<Runnable> serialQueue = dm.getSerialQueue(idm);
+    OverflowQueueWithDMStats<Runnable> serialQueue = dm.getExecutors().getSerialQueue(idm);
     if (serialQueue != null) {
       final boolean done[] = new boolean[1];
       final FlushingMessage msg = new FlushingMessage(done);
@@ -2362,7 +2363,7 @@ public class GMSMembershipManager implements MembershipManager {
 
     @Override
     public int getProcessorType() {
-      return ClusterDistributionManager.SERIAL_EXECUTOR;
+      return OperationExecutors.SERIAL_EXECUTOR;
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMessageAdapter.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMessageAdapter.java
index 75e78e4..fdfcf6c 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMessageAdapter.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/GMSMessageAdapter.java
@@ -19,9 +19,9 @@ import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
-import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.membership.gms.GMSMember;
 import org.apache.geode.distributed.internal.membership.gms.interfaces.GMSMessage;
@@ -54,7 +54,7 @@ public class GMSMessageAdapter implements GMSMessage {
   @Override
   public boolean isHighPriority() {
     return geodeMessage instanceof HighPriorityDistributionMessage ||
-        geodeMessage.getProcessorType() == ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+        geodeMessage.getProcessorType() == OperationExecutors.HIGH_PRIORITY_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/LocalViewMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/LocalViewMessage.java
index 0f06798..cd19035 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/LocalViewMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/LocalViewMessage.java
@@ -19,6 +19,7 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
+import org.apache.geode.distributed.internal.ClusterOperationExecutors;
 import org.apache.geode.distributed.internal.SerialDistributionMessage;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.membership.MembershipView;
@@ -50,7 +51,7 @@ public class LocalViewMessage extends SerialDistributionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.VIEW_EXECUTOR;
+    return ClusterOperationExecutors.VIEW_EXECUTOR;
   }
 
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllGatewayHubsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllGatewayHubsRequest.java
index dbe1666..d7e8d21 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllGatewayHubsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllGatewayHubsRequest.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.internal.serialization.DeserializationContext;
 import org.apache.geode.internal.serialization.SerializationContext;
@@ -47,7 +48,7 @@ public class ShutdownAllGatewayHubsRequest extends DistributionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.STANDARD_EXECUTOR;
+    return OperationExecutors.STANDARD_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index fb7372d..3cff35f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -355,7 +355,7 @@ public abstract class AbstractRegionMap extends BaseRegionMap
     if (cache != null) {
       DistributionManager manager = cache.getDistributionManager();
       if (manager != null) {
-        executor = manager.getWaitingThreadPool();
+        executor = manager.getExecutors().getWaitingThreadPool();
       }
     }
     getCustomEntryConcurrentHashMap().clearWithExecutor(executor);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
index 601b226..ae4b841 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
@@ -523,7 +523,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
             getBucket().getFullPath());
       }
       primaryElector = getBucket().getDistributionManager().getId();
-      getBucket().getDistributionManager().getWaitingThreadPool().execute(
+      getBucket().getDistributionManager().getExecutors().getWaitingThreadPool().execute(
           () -> getBucket().getPartitionedRegion().getRedundancyProvider()
               .finishIncompleteBucketCreation(getBucket().getId()));
     }
@@ -2679,7 +2679,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
           // ensure there is a thread consuming the queue
           boolean handedOff = false;
           try {
-            getDistributionManager().getWaitingThreadPool().execute(consumeQueue());
+            getDistributionManager().getExecutors().getWaitingThreadPool().execute(consumeQueue());
             handedOff = true;
           } finally {
             if (!handedOff) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
index 6dfd002..f7d2d15 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
@@ -283,7 +283,7 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
         // DLock needed by the PR destroy.. by moving the destroy to the waiting
         // pool, the entry
         // update is allowed to complete.
-        dm.getWaitingThreadPool().execute(destroyOp(dm, lclRgn, sendReply));
+        dm.getExecutors().getWaitingThreadPool().execute(destroyOp(dm, lclRgn, sendReply));
       } catch (RejectedExecutionException ignore) {
         // rejected while trying to execute destroy thread
         // must be shutting down, just quit
@@ -368,35 +368,36 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
           this.lockRoot = null; // spawned thread will release lock, not
                                 // basicProcess
 
-          rgn.getDistributionManager().getWaitingThreadPool().execute(new Runnable() {
-            @Override
-            public void run() {
-              try {
-                rgn.reinitializeFromImageTarget(getSender());
-              } catch (TimeoutException e) {
-                // dlock timed out, log message
-                logger.warn(String.format(
-                    "Got timeout when trying to recreate region during re-initialization: %s",
-                    rgn.getFullPath()),
-                    e);
-              } catch (IOException e) {
-                // only if loading snapshot, not here
-                InternalGemFireError assErr = new InternalGemFireError(
-                    "unexpected exception");
-                assErr.initCause(e);
-                throw assErr;
-              } catch (ClassNotFoundException e) {
-                // only if loading snapshot, not here
-                InternalGemFireError assErr = new InternalGemFireError(
-                    "unexpected exception");
-                assErr.initCause(e);
-                throw assErr;
-              } finally {
-                if (loc_lockRoot != null)
-                  loc_lockRoot.releaseDestroyLock();
-              }
-            }
-          });
+          rgn.getDistributionManager().getExecutors().getWaitingThreadPool()
+              .execute(new Runnable() {
+                @Override
+                public void run() {
+                  try {
+                    rgn.reinitializeFromImageTarget(getSender());
+                  } catch (TimeoutException e) {
+                    // dlock timed out, log message
+                    logger.warn(String.format(
+                        "Got timeout when trying to recreate region during re-initialization: %s",
+                        rgn.getFullPath()),
+                        e);
+                  } catch (IOException e) {
+                    // only if loading snapshot, not here
+                    InternalGemFireError assErr = new InternalGemFireError(
+                        "unexpected exception");
+                    assErr.initCause(e);
+                    throw assErr;
+                  } catch (ClassNotFoundException e) {
+                    // only if loading snapshot, not here
+                    InternalGemFireError assErr = new InternalGemFireError(
+                        "unexpected exception");
+                    assErr.initCause(e);
+                    throw assErr;
+                  } finally {
+                    if (loc_lockRoot != null)
+                      loc_lockRoot.releaseDestroyLock();
+                  }
+                }
+              });
         } else {
           if (logger.isDebugEnabled()) {
             logger.debug("Processing DestroyRegionOperation, calling basicDestroyRegion: {}",
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedClearOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedClearOperation.java
index 027371d..4396581 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedClearOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedClearOperation.java
@@ -25,6 +25,7 @@ import org.apache.geode.annotations.internal.MakeNotStatic;
 import org.apache.geode.cache.CacheEvent;
 import org.apache.geode.cache.EntryNotFoundException;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.cache.versions.RegionVersionVector;
@@ -182,7 +183,7 @@ public class DistributedClearOperation extends DistributedCacheOperation {
        * okay to run this in a non-ordered executor since the operation contains its own ordering
        * information.
        */
-      return ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+      return OperationExecutors.HIGH_PRIORITY_EXECUTOR;
     }
 
     @Override
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 91a81f1..7d61b6b 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
@@ -784,7 +784,7 @@ public class DistributedRegion extends LocalRegion implements InternalDistribute
   private void asyncResumeReliability(final InternalDistributedMember id,
       final Set newlyAcquiredRoles) throws RejectedExecutionException {
     final ResumptionAction ra = getMembershipAttributes().getResumptionAction();
-    getDistributionManager().getWaitingThreadPool().execute(() -> {
+    getDistributionManager().getExecutors().getWaitingThreadPool().execute(() -> {
       try {
         if (ra.isReinitialize()) {
           if (logger.isDebugEnabled()) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
index 4afc9fc..d0ba12c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
@@ -37,6 +37,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -415,7 +416,7 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.REGION_FUNCTION_EXECUTION_EXECUTOR;
+    return OperationExecutors.REGION_FUNCTION_EXECUTION_EXECUTOR;
   }
 
   /*
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedTombstoneOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedTombstoneOperation.java
index 9c5611f..acaea24 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedTombstoneOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedTombstoneOperation.java
@@ -28,6 +28,7 @@ import org.apache.geode.cache.CacheEvent;
 import org.apache.geode.cache.EntryNotFoundException;
 import org.apache.geode.cache.Operation;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo;
@@ -138,7 +139,7 @@ public class DistributedTombstoneOperation extends DistributedCacheOperation {
     @Override
     public int getProcessorType() {
       // Set to STANDARD to keep it from being processed in-line
-      return ClusterDistributionManager.STANDARD_EXECUTOR;
+      return OperationExecutors.STANDARD_EXECUTOR;
     }
 
     @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FunctionStreamingOrderedReplyMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FunctionStreamingOrderedReplyMessage.java
index 030b007..01382a0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FunctionStreamingOrderedReplyMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FunctionStreamingOrderedReplyMessage.java
@@ -17,8 +17,8 @@ package org.apache.geode.internal.cache;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.logging.LogService;
@@ -52,6 +52,6 @@ public class FunctionStreamingOrderedReplyMessage extends FunctionStreamingReply
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.SERIAL_EXECUTOR;
+    return OperationExecutors.SERIAL_EXECUTOR;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java
index ffdf31b..943f423 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageFlowControl.java
@@ -30,6 +30,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.MembershipListener;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ProcessorKeeper21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.logging.LogService;
@@ -217,7 +218,7 @@ public class InitialImageFlowControl implements MembershipListener {
 
     @Override
     public int getProcessorType() {
-      return ClusterDistributionManager.STANDARD_EXECUTOR;
+      return OperationExecutors.STANDARD_EXECUTOR;
     }
 
     @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
index efd03b7..796bfc5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
@@ -62,6 +62,7 @@ import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -398,8 +399,8 @@ public class InitialImageOperation {
             r.addAll(advice.empties);
             r.addAll(advice.uninitialized);
             int processorType =
-                targetReinitialized ? ClusterDistributionManager.WAITING_POOL_EXECUTOR
-                    : ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+                targetReinitialized ? OperationExecutors.WAITING_POOL_EXECUTOR
+                    : OperationExecutors.HIGH_PRIORITY_EXECUTOR;
             try {
               boolean success = sf.flush(r, recipient, processorType, true);
               if (!success) {
@@ -423,8 +424,8 @@ public class InitialImageOperation {
         r.addAll(advice.others);
         r.addAll(advice.empties);
         r.addAll(advice.uninitialized);
-        int processorType = targetReinitialized ? ClusterDistributionManager.WAITING_POOL_EXECUTOR
-            : ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+        int processorType = targetReinitialized ? OperationExecutors.WAITING_POOL_EXECUTOR
+            : OperationExecutors.HIGH_PRIORITY_EXECUTOR;
         try {
           boolean success = sf.flush(r, recipient, processorType, false);
           if (!success) {
@@ -1591,8 +1592,8 @@ public class InitialImageOperation {
 
     @Override
     public int getProcessorType() {
-      return this.targetReinitialized ? ClusterDistributionManager.WAITING_POOL_EXECUTOR
-          : ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+      return this.targetReinitialized ? OperationExecutors.WAITING_POOL_EXECUTOR
+          : OperationExecutors.HIGH_PRIORITY_EXECUTOR;
     }
 
     public boolean goWithFullGII(DistributedRegion rgn, RegionVersionVector requesterRVV) {
@@ -2283,7 +2284,7 @@ public class InitialImageOperation {
 
     @Override
     public int getProcessorType() {
-      return ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+      return OperationExecutors.HIGH_PRIORITY_EXECUTOR;
     }
 
     @Override
@@ -2559,8 +2560,8 @@ public class InitialImageOperation {
 
     @Override
     public int getProcessorType() {
-      return this.targetReinitialized ? ClusterDistributionManager.WAITING_POOL_EXECUTOR
-          : ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+      return this.targetReinitialized ? OperationExecutors.WAITING_POOL_EXECUTOR
+          : OperationExecutors.HIGH_PRIORITY_EXECUTOR;
     }
 
     @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
index 5dcc51d..5286087 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/JtaAfterCompletionMessage.java
@@ -26,6 +26,7 @@ import org.apache.geode.cache.Cache;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitResponse;
@@ -66,9 +67,9 @@ public class JtaAfterCompletionMessage extends TXMessage {
     msg.setRecipients(recipients);
     // bug #43087 - hang sending JTA synchronizations from delegate server
     if (system.threadOwnsResources()) {
-      msg.processorType = ClusterDistributionManager.SERIAL_EXECUTOR;
+      msg.processorType = OperationExecutors.SERIAL_EXECUTOR;
     } else {
-      msg.processorType = ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+      msg.processorType = OperationExecutors.HIGH_PRIORITY_EXECUTOR;
     }
     system.getDistributionManager().putOutgoing(msg);
     return response;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
index 1b15f5c..0d758a5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
@@ -39,6 +39,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -360,7 +361,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.REGION_FUNCTION_EXECUTION_EXECUTOR;
+    return OperationExecutors.REGION_FUNCTION_EXECUTION_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 075e3d0..3d953ba 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -144,9 +144,11 @@ import org.apache.geode.distributed.internal.DistributionAdvisor;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.FunctionExecutionPooledExecutor;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.InternalDistributedSystem.DisconnectListener;
 import org.apache.geode.distributed.internal.MembershipListener;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ProfileListener;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -1048,7 +1050,7 @@ public class PartitionedRegion extends LocalRegion
       StateFlushOperation sfo = new StateFlushOperation(getDistributionManager());
       try {
         sfo.flush(this.distAdvisor.adviseAllPRNodes(), getDistributionManager().getId(),
-            ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR, false);
+            OperationExecutors.HIGH_PRIORITY_EXECUTOR, false);
       } catch (InterruptedException ie) {
         Thread.currentThread().interrupt();
         getCancelCriterion().checkCancelInProgress(ie);
@@ -2971,7 +2973,7 @@ public class PartitionedRegion extends LocalRegion
             // given that most manipulation of values is remote (requiring serialization to send).
             // But... function execution always implies local manipulation of
             // values so keeping locally updated values in Object form should be more efficient.
-            if (!ClusterDistributionManager.isFunctionExecutionThread()) {
+            if (!FunctionExecutionPooledExecutor.isFunctionExecutionThread()) {
               // TODO: this condition may not help since BucketRegion.virtualPut calls
               // forceSerialized
               br.forceSerialized(event);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
index 7aec9ff..f4a1975 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
@@ -69,9 +69,9 @@ import org.apache.geode.cache.query.internal.QCompiler;
 import org.apache.geode.cache.query.internal.index.IndexCreationData;
 import org.apache.geode.cache.query.internal.index.PartitionedIndex;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.BucketRegion.RawValue;
@@ -1616,7 +1616,7 @@ public class PartitionedRegionDataStore implements HasCachePerfStats {
       InternalDistributedMember primary = bucketAdvisor.getPrimary();
       if (!myId.equals(primary)) {
         StateFlushOperation flush = new StateFlushOperation(bucketRegion);
-        int executor = ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+        int executor = OperationExecutors.WAITING_POOL_EXECUTOR;
         try {
           flush.flush(Collections.singleton(primary), myId, executor, false);
         } catch (InterruptedException e) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
index c27b21c..8bfc5ee 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
@@ -381,15 +381,16 @@ public class PartitionedRegionHelper {
           // Fix for #45365, we don't schedule an asynchronous task until
           // we have determined the node to remove (Which includes the
           // serial number).
-          cache.getDistributionManager().getPrMetaDataCleanupThreadPool().execute(new Runnable() {
-            @Override
-            public void run() {
-              cleanPartitionedRegionMetaDataForNode(cache, node1, prConf, prName);
-              if (postCleanupTask != null) {
-                postCleanupTask.run();
-              }
-            }
-          });
+          cache.getDistributionManager().getExecutors().getPrMetaDataCleanupThreadPool()
+              .execute(new Runnable() {
+                @Override
+                public void run() {
+                  cleanPartitionedRegionMetaDataForNode(cache, node1, prConf, prName);
+                  if (postCleanupTask != null) {
+                    postCleanupTask.run();
+                  }
+                }
+              });
           runPostCleanUp = false;
           return;
         }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
index 444ac5e..30bf671 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
@@ -1028,7 +1028,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
           // send a message to this responder asking for the value
           // do this on the waiting pool in case the send blocks
           try {
-            dm.getWaitingThreadPool().execute(new Runnable() {
+            dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
               @Override
               public void run() {
                 sendValueRequest(sender);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
index 3d7284a..fba73c6 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
@@ -560,7 +560,7 @@ public class StateFlushOperation {
       // though this message must be transmitted on an ordered connection to
       // ensure that datagram channnels are flushed, we need to execute
       // in the waiting pool to avoid blocking those connections
-      dm.getWaitingThreadPool().execute(new Runnable() {
+      dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
         @Override
         public void run() {
           if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP_VERBOSE)) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
index 3084760..4cb0000 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXRemoteCommitMessage.java
@@ -30,6 +30,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.ReplySender;
@@ -57,7 +58,7 @@ public class TXRemoteCommitMessage extends TXMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   public static RemoteCommitResponse send(Cache cache, int txUniqId,
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
index 9ec621b..fdd61a3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
@@ -1044,7 +1044,7 @@ public class TXState implements TXStateInterface {
   }
 
   private Executor getExecutor() {
-    return getCache().getDistributionManager().getWaitingThreadPool();
+    return getCache().getDistributionManager().getExecutors().getWaitingThreadPool();
   }
 
   private CancelCriterion getCancelCriterion() {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
index 593b985..f59674e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
@@ -161,7 +161,7 @@ public class TombstoneService {
   private TombstoneService(InternalCache cache) {
     this.replicatedTombstoneSweeper =
         new ReplicateTombstoneSweeper(cache, cache.getCachePerfStats(), cache.getCancelCriterion(),
-            cache.getDistributionManager().getWaitingThreadPool());
+            cache.getDistributionManager().getExecutors().getWaitingThreadPool());
     this.nonReplicatedTombstoneSweeper = new NonReplicateTombstoneSweeper(cache,
         cache.getCachePerfStats(), cache.getCancelCriterion());
     this.replicatedTombstoneSweeper.start();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateOperation.java
index 61f0bb1..409cb75 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/UpdateOperation.java
@@ -254,7 +254,7 @@ public class UpdateOperation extends AbstractUpdateOperation {
           if (processor.isExpectingDirectReply()) {
             sendMessage.run();
           } else {
-            dm.getWaitingThreadPool().execute(sendMessage);
+            dm.getExecutors().getWaitingThreadPool().execute(sendMessage);
           }
           return false;
         }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/AbstractExecution.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/AbstractExecution.java
index d98ec8a..4657e68 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/AbstractExecution.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/AbstractExecution.java
@@ -266,7 +266,7 @@ public abstract class AbstractExecution implements InternalExecution {
       } else {
 
         final ClusterDistributionManager newDM = (ClusterDistributionManager) dm;
-        newDM.getFunctionExecutor().execute(() -> {
+        newDM.getExecutors().getFunctionExecutor().execute(() -> {
           executeFunctionLocally(fn, cx, sender, newDM);
           if (!sender.isLastResultReceived() && fn.hasResult()) {
             ((InternalResultSender) sender).setException(new FunctionException(
@@ -292,7 +292,7 @@ public abstract class AbstractExecution implements InternalExecution {
       final ResultSender sender, DistributionManager dm, final boolean isTx) {
     if (dm instanceof ClusterDistributionManager && !isTx) {
       final ClusterDistributionManager newDM = (ClusterDistributionManager) dm;
-      newDM.getFunctionExecutor().execute(() -> {
+      newDM.getExecutors().getFunctionExecutor().execute(() -> {
         executeFunctionLocally(fn, cx, sender, newDM);
         if (!((InternalResultSender) sender).isLastResultReceived() && fn.hasResult()) {
           ((InternalResultSender) sender).setException(new FunctionException(
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLessorDepartureHandler.java b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLessorDepartureHandler.java
index 30dad58..ba9694d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLessorDepartureHandler.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLessorDepartureHandler.java
@@ -102,7 +102,7 @@ public class TXLessorDepartureHandler implements DLockLessorDepartureHandler {
     };
 
     try {
-      dm.getWaitingThreadPool().execute(recoverTx);
+      dm.getExecutors().getWaitingThreadPool().execute(recoverTx);
     } catch (RejectedExecutionException e) {
       // this shouldn't happen unless we're shutting down or someone has set a size constraint
       // on the waiting-pool using a system property
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXOriginatorRecoveryProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXOriginatorRecoveryProcessor.java
index b2f246b..d8dc61e 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXOriginatorRecoveryProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXOriginatorRecoveryProcessor.java
@@ -139,7 +139,7 @@ public class TXOriginatorRecoveryProcessor extends ReplyProcessor21 {
       final TXOriginatorRecoveryMessage msg = this;
 
       try {
-        dm.getWaitingThreadPool().execute(new Runnable() {
+        dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
           @Override
           public void run() {
             processTXOriginatorRecoveryMessage(dm, msg);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXRecoverGrantorMessageProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXRecoverGrantorMessageProcessor.java
index 1d860d5..399e4f4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXRecoverGrantorMessageProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXRecoverGrantorMessageProcessor.java
@@ -43,7 +43,7 @@ public class TXRecoverGrantorMessageProcessor
       final DLockRecoverGrantorProcessor.DLockRecoverGrantorMessage msg) {
 
     try {
-      dm.getWaitingThreadPool().execute(new Runnable() {
+      dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
         @Override
         public void run() {
           processDLockRecoverGrantorMessage(dm, msg);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/AllBucketProfilesUpdateMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/AllBucketProfilesUpdateMessage.java
index b2f63d6..05cea91 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/AllBucketProfilesUpdateMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/AllBucketProfilesUpdateMessage.java
@@ -30,6 +30,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.internal.cache.BucketAdvisor;
@@ -57,7 +58,7 @@ public class AllBucketProfilesUpdateMessage extends DistributionMessage
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   private AllBucketProfilesUpdateMessage(Set recipients, int partitionedRegionId, int processorId,
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
index 664f556..1cb52a89 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
@@ -26,6 +26,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -107,7 +108,7 @@ public class BecomePrimaryBucketMessage extends PartitionMessage {
   public int getProcessorType() {
     // use the waiting pool because operateOnPartitionedRegion will
     // send out a DeposePrimaryBucketMessage and wait for the reply
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
index 2960325..e0957fb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
@@ -23,6 +23,7 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionDataStore;
@@ -105,7 +106,7 @@ public class BucketBackupMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketProfileUpdateMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketProfileUpdateMessage.java
index 036620d..723efa0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketProfileUpdateMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketProfileUpdateMessage.java
@@ -29,6 +29,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.internal.cache.BucketAdvisor;
@@ -57,7 +58,7 @@ public class BucketProfileUpdateMessage extends DistributionMessage implements M
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   private BucketProfileUpdateMessage(Set recipients, int partitionedRegionId, int processorId,
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
index 8b86893..05492c0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
@@ -29,6 +29,7 @@ import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -68,7 +69,7 @@ public class BucketSizeMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.STANDARD_EXECUTOR;
+    return OperationExecutors.STANDARD_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
index 134e4c6..8de4ac3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
@@ -29,6 +29,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -84,7 +85,7 @@ public class CreateBucketMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyRegionOnDataStoreMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyRegionOnDataStoreMessage.java
index 98b256b..8afb663 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyRegionOnDataStoreMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyRegionOnDataStoreMessage.java
@@ -22,6 +22,7 @@ import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.PartitionedRegion;
@@ -89,7 +90,7 @@ public class DestroyRegionOnDataStoreMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
index 9c245c8..8c40847 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.Assert;
@@ -82,7 +83,7 @@ public class EndBucketCreationMessage extends PartitionMessage {
   public int getProcessorType() {
     // use the waiting pool because operateOnPartitionedRegion will
     // try to get a dlock
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
index d707688..14d5111 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
@@ -33,6 +33,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -126,7 +127,7 @@ public class GetMessage extends PartitionMessageWithDirectReply {
         // processed in the p2p msg reader.
         if (pr.getAttributes().getDataPolicy().withPersistence()
             || !pr.getAttributes().getEvictionAttributes().getAlgorithm().isNone()) {
-          return ClusterDistributionManager.PARTITIONED_REGION_EXECUTOR;
+          return OperationExecutors.PARTITIONED_REGION_EXECUTOR;
         }
       } catch (PRLocallyDestroyedException ignore) {
       } catch (RuntimeException ignore) {
@@ -138,13 +139,13 @@ public class GetMessage extends PartitionMessageWithDirectReply {
       }
     }
     if (forceUseOfPRExecutor) {
-      return ClusterDistributionManager.PARTITIONED_REGION_EXECUTOR;
+      return OperationExecutors.PARTITIONED_REGION_EXECUTOR;
     } else if (ORDER_PR_GETS) {
-      return ClusterDistributionManager.PARTITIONED_REGION_EXECUTOR;
+      return OperationExecutors.PARTITIONED_REGION_EXECUTOR;
     } else {
       // Make this executor serial so that it will be processed in the p2p msg reader
       // which gives it better performance.
-      return ClusterDistributionManager.SERIAL_EXECUTOR;
+      return OperationExecutors.SERIAL_EXECUTOR;
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityRequestMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityRequestMessage.java
index 6e7b1b2..d925ac1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityRequestMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityRequestMessage.java
@@ -31,6 +31,7 @@ import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -116,7 +117,7 @@ public class IdentityRequestMessage extends DistributionMessage implements Messa
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+    return OperationExecutors.HIGH_PRIORITY_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityUpdateMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityUpdateMessage.java
index bbb453d..6b51846 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityUpdateMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/IdentityUpdateMessage.java
@@ -26,6 +26,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -56,7 +57,7 @@ public class IdentityUpdateMessage extends DistributionMessage implements Messag
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+    return OperationExecutors.HIGH_PRIORITY_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
index 001458a..0c0130e 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
@@ -30,6 +30,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -66,7 +67,7 @@ public class InterestEventMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.STANDARD_EXECUTOR;
+    return OperationExecutors.STANDARD_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
index b344a65..fd658e7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
@@ -28,6 +28,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -92,7 +93,7 @@ public class ManageBackupBucketMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
index f5f3f38..430b72c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
@@ -29,6 +29,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -83,7 +84,7 @@ public class ManageBucketMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
index 3945e76..3b475a9 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
@@ -26,6 +26,7 @@ import org.apache.geode.cache.query.QueryException;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.internal.SystemTimer;
 import org.apache.geode.internal.cache.DistributedRegion;
@@ -145,7 +146,7 @@ public class PRSanityCheckMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+    return OperationExecutors.HIGH_PRIORITY_EXECUTOR;
   }
 
   /**
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 3a8953e..3ac27a9 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
@@ -43,6 +43,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -211,9 +212,9 @@ public abstract class PartitionMessage extends DistributionMessage
   @Override
   public int getProcessorType() {
     if (this.notificationOnly) {
-      return ClusterDistributionManager.SERIAL_EXECUTOR;
+      return OperationExecutors.SERIAL_EXECUTOR;
     } else {
-      return ClusterDistributionManager.PARTITIONED_REGION_EXECUTOR;
+      return OperationExecutors.PARTITIONED_REGION_EXECUTOR;
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
index 6a5853f..9566db3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
@@ -26,6 +26,7 @@ import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.execute.FunctionException;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -69,7 +70,7 @@ public class PartitionedRegionFunctionStreamingMessage extends PartitionMessage
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.REGION_FUNCTION_EXECUTION_EXECUTOR;
+    return OperationExecutors.REGION_FUNCTION_EXECUTION_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
index 807468f..0c175f1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
@@ -193,7 +193,7 @@ public class PartitionedRegionRebalanceOp {
       Map<PartitionedRegion, InternalPRInfo> detailsMap = fetchDetails(cache);
       BucketOperatorWrapper serialOperator = getBucketOperator(detailsMap);
       ParallelBucketOperator parallelOperator = new ParallelBucketOperator(MAX_PARALLEL_OPERATIONS,
-          cache.getDistributionManager().getWaitingThreadPool(), serialOperator);
+          cache.getDistributionManager().getExecutors().getWaitingThreadPool(), serialOperator);
       model = buildModel(parallelOperator, detailsMap, resourceManager);
       for (PartitionRebalanceDetailsImpl details : serialOperator.getDetailSet()) {
         details.setPartitionMemberDetailsBefore(
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PrimaryRequestMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PrimaryRequestMessage.java
index b1f1a48..73a9ca3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PrimaryRequestMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PrimaryRequestMessage.java
@@ -27,6 +27,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -136,7 +137,7 @@ public class PrimaryRequestMessage extends PartitionMessage {
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.WAITING_POOL_EXECUTOR;
+    return OperationExecutors.WAITING_POOL_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
index 52354e5..025a58c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
@@ -1095,7 +1095,7 @@ public class PutMessage extends PartitionMessageWithDirectReply implements NewVa
           if (isExpectingDirectReply()) {
             sendFullObject.run();
           } else {
-            getDistributionManager().getWaitingThreadPool().execute(sendFullObject);
+            getDistributionManager().getExecutors().getWaitingThreadPool().execute(sendFullObject);
           }
           return;
         }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java
index 7e16b8e..ba32f0d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java
@@ -35,6 +35,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -92,8 +93,8 @@ public class MembershipViewRequest extends DistributionMessage implements Messag
 
   @Override
   public int getProcessorType() {
-    return this.targetReinitializing ? ClusterDistributionManager.WAITING_POOL_EXECUTOR
-        : ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR;
+    return this.targetReinitializing ? OperationExecutors.WAITING_POOL_EXECUTOR
+        : OperationExecutors.HIGH_PRIORITY_EXECUTOR;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/FlowController.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/FlowController.java
index 7c0cb911..a08b7e3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/FlowController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/FlowController.java
@@ -31,6 +31,7 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ProcessorKeeper21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.InternalDataSerializer;
@@ -268,7 +269,7 @@ public class FlowController {
 
     @Override
     public int getProcessorType() {
-      return ClusterDistributionManager.STANDARD_EXECUTOR;
+      return OperationExecutors.STANDARD_EXECUTOR;
     }
 
     @Override
@@ -326,7 +327,7 @@ public class FlowController {
 
     @Override
     public int getProcessorType() {
-      return ClusterDistributionManager.STANDARD_EXECUTOR;
+      return OperationExecutors.STANDARD_EXECUTOR;
     }
 
     @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
index 3f8bff7..2695c11 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
@@ -283,8 +283,10 @@ public class RegionSnapshotServiceImpl<K, V> implements RegionSnapshotService<K,
             }
 
             final Map<K, V> copy = new HashMap<>(buffer);
-            Future<?> f = local.getCache().getDistributionManager().getWaitingThreadPool().submit(
-                (Runnable) () -> local.basicImportPutAll(copy, !options.shouldInvokeCallbacks()));
+            Future<?> f = local.getCache().getDistributionManager().getExecutors()
+                .getWaitingThreadPool().submit(
+                    (Runnable) () -> local.basicImportPutAll(copy,
+                        !options.shouldInvokeCallbacks()));
 
             puts.addLast(f);
             buffer.clear();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
index 037abfb..6ec4499 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
@@ -946,7 +946,7 @@ public class CacheClientNotifier {
       InternalDistributedSystem ids =
           (InternalDistributedSystem) getCache().getDistributedSystem();
       final DistributionManager dm = ids.getDistributionManager();
-      dm.getWaitingThreadPool().execute(() -> {
+      dm.getExecutors().getWaitingThreadPool().execute(() -> {
 
         CacheDistributionAdvisor advisor =
             proxy.getHARegionQueue().getRegion().getCacheDistributionAdvisor();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index 91bdaf2..945f614 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -65,9 +65,9 @@ import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.cache.query.internal.cq.InternalCqQuery;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.internal.SystemTimer;
 import org.apache.geode.internal.SystemTimer.SystemTimerTask;
 import org.apache.geode.internal.cache.CacheDistributionAdvisee;
@@ -1318,7 +1318,7 @@ public class CacheClientProxy implements ClientSession {
         recips.addAll(advice.getEmpties());
         recips.addAll(advice.getPreloaded());
         recips.addAll(advice.getOthers());
-        sfo.flush(recips, target, ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR, true);
+        sfo.flush(recips, target, OperationExecutors.HIGH_PRIORITY_EXECUTOR, true);
       } catch (InterruptedException ie) {
         Thread.currentThread().interrupt();
         return;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
index 9bc3375..9c61caa 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
@@ -366,7 +366,7 @@ public class ExecuteFunction66 extends BaseCommand {
         execService.execute(functionExecution);
       } else {
         ClusterDistributionManager newDM = (ClusterDistributionManager) dm;
-        newDM.getFunctionExecutor().execute(functionExecution);
+        newDM.getExecutors().getFunctionExecutor().execute(functionExecution);
       }
     }
     stats.endFunctionExecution(startExecution, fn.hasResult());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteOperationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteOperationMessage.java
index 176c766..b3f5c02 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteOperationMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteOperationMessage.java
@@ -35,6 +35,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -122,7 +123,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
 
   @Override
   public int getProcessorType() {
-    return ClusterDistributionManager.SERIAL_EXECUTOR;
+    return OperationExecutors.SERIAL_EXECUTOR;
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java b/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java
index dd5c372..ce496ad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/versions/RegionVersionVector.java
@@ -339,7 +339,7 @@ public abstract class RegionVersionVector<T extends VersionSource<?>>
           System.identityHashCode(this));
     }
     // this could block for a while if a limit has been set on the waiting-thread-pool
-    dm.getWaitingThreadPool().execute(new Runnable() {
+    dm.getExecutors().getWaitingThreadPool().execute(new Runnable() {
       @Override
       @edu.umd.cs.findbugs.annotations.SuppressWarnings(
           value = {"UL_UNRELEASED_LOCK", "IMSE_DONT_CATCH_IMSE"})
@@ -1452,7 +1452,7 @@ public abstract class RegionVersionVector<T extends VersionSource<?>>
     // since unlockForClear uses synchronization we need to try to execute it in another
     // thread so that membership events aren't blocked
     if (distributionManager != null) {
-      distributionManager.getWaitingThreadPool().execute(new Runnable() {
+      distributionManager.getExecutors().getWaitingThreadPool().execute(new Runnable() {
         @Override
         public void run() {
           unlockForClear(id);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
index 293ef0f..c2a3dbd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
@@ -59,7 +59,8 @@ public class WaitUntilParallelGatewaySenderFlushedCoordinator
       sender.getCancelCriterion().checkCancelInProgress(null);
     }
 
-    ExecutorService service = this.sender.getDistributionManager().getWaitingThreadPool();
+    ExecutorService service =
+        this.sender.getDistributionManager().getExecutors().getWaitingThreadPool();
     List<Future<Boolean>> callableFutures = new ArrayList<>();
     int callableCount = 0;
     long nanosRemaining = unit.toNanos(timeout);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index f112dbc..3401d89 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -60,6 +60,7 @@ import org.apache.geode.distributed.internal.DistributionConfigImpl;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionStats;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
@@ -864,7 +865,7 @@ public class Connection implements Runnable {
     // }
     // connectHandshake.writeUTF("["+name+"] "+Thread.currentThread().getName());
     // }
-    connectHandshake.setMessageHeader(NORMAL_MSG_TYPE, ClusterDistributionManager.STANDARD_EXECUTOR,
+    connectHandshake.setMessageHeader(NORMAL_MSG_TYPE, OperationExecutors.STANDARD_EXECUTOR,
         MsgIdGenerator.NO_MSG_ID);
     writeFully(getSocket().getChannel(), connectHandshake.getContentBuffer(), false, null);
   }
@@ -1956,7 +1957,7 @@ public class Connection implements Runnable {
       ReplyMessage.send(getRemoteAddress(), rpId, exception, dm);
     } else if (rpId != 0) {
       DistributionManager dm = this.owner.getDM();
-      dm.getWaitingThreadPool()
+      dm.getExecutors().getWaitingThreadPool()
           .execute(() -> ReplyMessage.send(getRemoteAddress(), rpId, exception, dm));
     }
   }
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageJUnitTest.java
index b3afa4a..d017b96 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageJUnitTest.java
@@ -95,7 +95,7 @@ public class StartupMessageJUnitTest {
     startupMessage.process(distributionManager);
 
     assertThat(
-        startupMessage.getProcessorType() == ClusterDistributionManager.WAITING_POOL_EXECUTOR);
+        startupMessage.getProcessorType() == OperationExecutors.WAITING_POOL_EXECUTOR);
   }
 
   @Test
@@ -111,6 +111,6 @@ public class StartupMessageJUnitTest {
 
     assertThat(
         startupResponseMessage
-            .getProcessorType() == ClusterDistributionManager.WAITING_POOL_EXECUTOR);
+            .getProcessorType() == OperationExecutors.WAITING_POOL_EXECUTOR);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66Test.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66Test.java
index f930eef..61d2d94 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66Test.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66Test.java
@@ -39,6 +39,7 @@ import org.apache.geode.cache.operations.ExecuteFunctionOperationContext;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.control.HeapMemoryMonitor;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
@@ -133,7 +134,9 @@ public class ExecuteFunction66Test {
 
     when(callbackArgPart.getObject()).thenReturn(CALLBACK_ARG);
 
-    when(clusterDistributionManager.getFunctionExecutor()).thenReturn(functionExecutor);
+    OperationExecutors executors = mock(OperationExecutors.class);
+    when(clusterDistributionManager.getExecutors()).thenReturn(executors);
+    when(executors.getFunctionExecutor()).thenReturn(functionExecutor);
 
     when(functionObject.getId()).thenReturn(FUNCTION_ID);
     doCallRealMethod().when(functionObject).getRequiredPermissions(any());
diff --git a/geode-junit/src/main/java/org/apache/geode/test/fake/Fakes.java b/geode-junit/src/main/java/org/apache/geode/test/fake/Fakes.java
index d83feac..a4bcb11 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/fake/Fakes.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/fake/Fakes.java
@@ -37,6 +37,7 @@ import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.DSClock;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.SystemTimer;
 import org.apache.geode.internal.cache.CachePerfStats;
@@ -131,6 +132,7 @@ public class Fakes {
     when(distributionManager.getCancelCriterion()).thenReturn(systemCancelCriterion);
     when(distributionManager.getCache()).thenReturn(cache);
     when(distributionManager.getExistingCache()).thenReturn(cache);
+    when(distributionManager.getExecutors()).thenReturn(mock(OperationExecutors.class));
 
     when(statisticsManager.createAtomicStatistics(any(), any(), anyLong())).thenReturn(stats);
     when(statisticsManager.createAtomicStatistics(any(), any())).thenReturn(stats);
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneBucketListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneBucketListener.java
index cae5052..34b2a8e 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneBucketListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneBucketListener.java
@@ -35,7 +35,7 @@ public class LuceneBucketListener extends PartitionListenerAdapter {
 
   @Override
   public void afterPrimary(int bucketId) {
-    dm.getWaitingThreadPool().execute(() -> {
+    dm.getExecutors().getWaitingThreadPool().execute(() -> {
       try {
         lucenePartitionRepositoryManager.computeRepository(bucketId);
       } catch (PrimaryBucketException e) {
@@ -51,7 +51,7 @@ public class LuceneBucketListener extends PartitionListenerAdapter {
 
   @Override
   public void afterSecondary(int bucketId) {
-    dm.getWaitingThreadPool().execute(() -> {
+    dm.getExecutors().getWaitingThreadPool().execute(() -> {
       try {
         lucenePartitionRepositoryManager.computeRepository(bucketId);
       } catch (PrimaryBucketException | AlreadyClosedException e) {
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index a712cdb..17de988 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -56,7 +56,8 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
 
   public LuceneIndexForPartitionedRegion(String indexName, String regionPath, InternalCache cache) {
     super(indexName, regionPath, cache);
-    this.waitingThreadPoolFromDM = cache.getDistributionManager().getWaitingThreadPool();
+    this.waitingThreadPoolFromDM =
+        cache.getDistributionManager().getExecutors().getWaitingThreadPool();
 
     final String statsName = indexName + "-" + regionPath;
     this.fileSystemStats = new FileSystemStats(cache.getDistributedSystem(), statsName);
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
index 2e23235..f8e8e9d 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
@@ -33,7 +33,7 @@ public class LuceneRawIndex extends LuceneIndexImpl {
       mapper = new HeterogeneousLuceneSerializer();
     }
     RawLuceneRepositoryManager rawLuceneRepositoryManager = new RawLuceneRepositoryManager(this,
-        mapper, cache.getDistributionManager().getWaitingThreadPool());
+        mapper, cache.getDistributionManager().getExecutors().getWaitingThreadPool());
     return rawLuceneRepositoryManager;
   }
 
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplJUnitTest.java
index c501ba8..007efe6 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneServiceImplJUnitTest.java
@@ -54,6 +54,7 @@ import org.apache.geode.cache.lucene.LuceneIndexFactory;
 import org.apache.geode.cache.lucene.LuceneSerializer;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.OperationExecutors;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionDataStore;
@@ -124,9 +125,11 @@ public class LuceneServiceImplJUnitTest {
     when(((StatisticsFactory) ds).createAtomicStatistics(any(), anyString()))
         .thenReturn(luceneIndexStats);
     when(cache.getRegion(anyString())).thenReturn(region);
-    when(cache.getDistributionManager()).thenReturn(mock(DistributionManager.class));
-    when(cache.getDistributionManager().getWaitingThreadPool())
-        .thenReturn(Executors.newSingleThreadExecutor());
+    DistributionManager manager = mock(DistributionManager.class);
+    when(cache.getDistributionManager()).thenReturn(manager);
+    OperationExecutors executors = mock(OperationExecutors.class);
+    when(executors.getWaitingThreadPool()).thenReturn(Executors.newSingleThreadExecutor());
+    when(manager.getExecutors()).thenReturn(executors);
 
     RegionAttributes ratts = mock(RegionAttributes.class);
     when(region.getAttributes()).thenReturn(ratts);