geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [geode] 01/02: GEODE-3940: fix deadlock in backup messages
Date Mon, 06 Nov 2017 23:40:43 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 4faab72a926347d4993779bcc0b681a77db843b3
Author: Lynn Gallinat <lgallinat@pivotal.io>
AuthorDate: Fri Nov 3 17:09:42 2017 -0700

    GEODE-3940: fix deadlock in backup messages
    
    * introduce unit tests for backup messages
    * add unit test for BackupLock
---
 .../geode/admin/internal/FinishBackupRequest.java  |  95 ++++++----
 .../geode/admin/internal/FinishBackupResponse.java |   2 -
 .../geode/admin/internal/FlushToDiskRequest.java   |  45 +++--
 .../geode/admin/internal/PrepareBackupRequest.java |  93 +++++----
 .../org/apache/geode/distributed/internal/DM.java  | 153 ++++++++-------
 .../internal/LonerDistributionManager.java         |  16 ++
 .../admin/remote/AddHealthListenerRequest.java     |   2 +-
 .../admin/remote/AddHealthListenerResponse.java    |   4 +-
 .../admin/remote/AddStatListenerRequest.java       |   3 +-
 .../admin/remote/AddStatListenerResponse.java      |   4 +-
 .../admin/remote/AdminFailureResponse.java         |  34 ++--
 .../admin/remote/AdminMultipleReplyProcessor.java  |  51 +----
 .../geode/internal/admin/remote/AdminRequest.java  |   5 +-
 .../internal/admin/remote/BridgeServerRequest.java |   4 +-
 .../admin/remote/BridgeServerResponse.java         |   4 +-
 .../internal/admin/remote/CacheConfigRequest.java  |   2 +-
 .../internal/admin/remote/CacheConfigResponse.java |   6 +-
 .../internal/admin/remote/CacheInfoRequest.java    |   3 +-
 .../internal/admin/remote/CacheInfoResponse.java   |   6 +-
 .../admin/remote/CancelStatListenerRequest.java    |   2 +-
 .../admin/remote/CancelStatListenerResponse.java   |   4 +-
 .../internal/admin/remote/CliLegacyMessage.java    |   2 +-
 .../internal/admin/remote/CompactRequest.java      |  13 +-
 .../admin/remote/DurableClientInfoRequest.java     |   3 +-
 .../admin/remote/DurableClientInfoResponse.java    |   6 +-
 .../admin/remote/FetchDistLockInfoRequest.java     |   3 +-
 .../admin/remote/FetchDistLockInfoResponse.java    |   4 +-
 .../admin/remote/FetchHealthDiagnosisRequest.java  |   2 +-
 .../admin/remote/FetchHealthDiagnosisResponse.java |   4 +-
 .../internal/admin/remote/FetchHostRequest.java    |   2 +-
 .../internal/admin/remote/FetchHostResponse.java   |   6 +-
 .../remote/FetchResourceAttributesRequest.java     |   2 +-
 .../remote/FetchResourceAttributesResponse.java    |  28 +--
 .../internal/admin/remote/FetchStatsRequest.java   |   2 +-
 .../internal/admin/remote/FetchStatsResponse.java  |  28 ++-
 .../internal/admin/remote/FetchSysCfgRequest.java  |   2 +-
 .../internal/admin/remote/FetchSysCfgResponse.java |   4 +-
 .../internal/admin/remote/LicenseInfoRequest.java  |   3 +-
 .../internal/admin/remote/LicenseInfoResponse.java |  15 +-
 .../admin/remote/MissingPersistentIDsRequest.java  |  13 +-
 .../admin/remote/ObjectDetailsRequest.java         |   3 +-
 .../admin/remote/ObjectDetailsResponse.java        |   4 +-
 .../internal/admin/remote/ObjectNamesRequest.java  |   3 +-
 .../internal/admin/remote/ObjectNamesResponse.java |   4 +-
 .../remote/PrepareRevokePersistentIDRequest.java   |   3 +-
 .../admin/remote/RefreshMemberSnapshotRequest.java |   2 +-
 .../remote/RefreshMemberSnapshotResponse.java      |   6 +-
 .../admin/remote/RegionAttributesRequest.java      |   3 +-
 .../admin/remote/RegionAttributesResponse.java     |   4 +-
 .../geode/internal/admin/remote/RegionRequest.java |   3 +-
 .../internal/admin/remote/RegionResponse.java      |   4 +-
 .../internal/admin/remote/RegionSizeRequest.java   |   3 +-
 .../internal/admin/remote/RegionSizeResponse.java  |   4 +-
 .../admin/remote/RegionStatisticsRequest.java      |   2 +-
 .../admin/remote/RegionStatisticsResponse.java     |   4 +-
 .../admin/remote/RegionSubRegionSizeRequest.java   |   4 +-
 .../admin/remote/RegionSubRegionsSizeResponse.java |   7 +-
 .../admin/remote/RemoveHealthListenerRequest.java  |   2 +-
 .../admin/remote/RemoveHealthListenerResponse.java |   4 +-
 .../admin/remote/ResetHealthStatusRequest.java     |   3 +-
 .../admin/remote/ResetHealthStatusResponse.java    |   4 +-
 .../admin/remote/RevokePersistentIDRequest.java    |   3 +-
 .../internal/admin/remote/RootRegionRequest.java   |   2 +-
 .../internal/admin/remote/RootRegionResponse.java  |   6 +-
 .../internal/admin/remote/ShutdownAllRequest.java  |   4 +-
 .../internal/admin/remote/StoreSysCfgRequest.java  |   2 +-
 .../internal/admin/remote/StoreSysCfgResponse.java |   4 +-
 .../internal/admin/remote/SubRegionRequest.java    |   3 +-
 .../internal/admin/remote/SubRegionResponse.java   |   4 +-
 .../internal/admin/remote/TailLogRequest.java      |   2 +-
 .../internal/admin/remote/TailLogResponse.java     |   6 +-
 .../internal/admin/remote/VersionInfoRequest.java  |   3 +-
 .../internal/admin/remote/VersionInfoResponse.java |   4 +-
 .../apache/geode/internal/cache/BackupLock.java    |  47 +++--
 .../apache/geode/internal/cache/BackupManager.java |  10 +-
 .../cache/persistence/PersistentMemberManager.java |  10 +-
 .../org/apache/geode/management/BackupStatus.java  |   7 +-
 .../internal/messages/CompactRequest.java          |  12 +-
 .../admin/internal/FinishBackupRequestTest.java    | 210 +++++++++++++++++++++
 .../admin/internal/FlushToDiskRequestTest.java     | 177 +++++++++++++++++
 .../admin/internal/PrepareBackupRequestTest.java   | 206 ++++++++++++++++++++
 .../geode/internal/cache/BackupDUnitTest.java      |   2 +-
 .../geode/internal/cache/BackupLockTest.java       | 125 ++++++++++++
 83 files changed, 1195 insertions(+), 410 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
index 12f5bb9..cd7b765 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
@@ -32,14 +32,13 @@ import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.admin.remote.AdminFailureResponse;
 import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
 import org.apache.geode.internal.admin.remote.AdminResponse;
 import org.apache.geode.internal.admin.remote.CliLegacyMessage;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
@@ -48,34 +47,48 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 /**
  * A request send from an admin VM to all of the peers to indicate that that should complete the
  * backup operation.
- *
- *
  */
 public class FinishBackupRequest extends CliLegacyMessage {
   private static final Logger logger = LogService.getLogger();
 
+  private final DM dm;
+  private final FinishBackupReplyProcessor replyProcessor;
   private File targetDir;
   private File baselineDir;
   private boolean abort;
 
   public FinishBackupRequest() {
     super();
+    this.dm = null;
+    this.replyProcessor = null;
+  }
+
+  private FinishBackupRequest(DM dm, Set<InternalDistributedMember> recipients, File targetDir, File baselineDir, boolean abort) {
+    this(dm, recipients, new FinishBackupReplyProcessor(dm, recipients), targetDir, baselineDir, abort);
   }
 
-  public FinishBackupRequest(File targetDir, File baselineDir, boolean abort) {
+  FinishBackupRequest(DM dm, Set<InternalDistributedMember> recipients, FinishBackupReplyProcessor replyProcessor, File targetDir, File baselineDir, boolean abort) {
+    this.dm = dm;
     this.targetDir = targetDir;
     this.baselineDir = baselineDir;
     this.abort = abort;
+    setRecipients(recipients);
+    this.replyProcessor = replyProcessor;
+    this.msgId = this.replyProcessor.getProcessorId();
   }
 
   public static Map<DistributedMember, Set<PersistentID>> send(DM dm, Set recipients,
       File targetDir, File baselineDir, boolean abort) {
-    FinishBackupRequest request = new FinishBackupRequest(targetDir, baselineDir, abort);
-    request.setRecipients(recipients);
+    FinishBackupRequest request = new FinishBackupRequest(dm, recipients, targetDir, baselineDir, abort);
+    return request.send();
+  }
+
+  Map<DistributedMember, Set<PersistentID>> send() {
+    dm.putOutgoing(this);
+
+    // invokes doBackup and releases BackupLock
+    AdminResponse response = createResponse(dm);
 
-    FinishBackupReplyProcessor replyProcessor = new FinishBackupReplyProcessor(dm, recipients);
-    request.msgId = replyProcessor.getProcessorId();
-    dm.putOutgoing(request);
     try {
       replyProcessor.waitForReplies();
     } catch (ReplyException e) {
@@ -83,33 +96,40 @@ public class FinishBackupRequest extends CliLegacyMessage {
         throw e;
       }
     } catch (InterruptedException e) {
-      e.printStackTrace();
+      logger.warn(e.getMessage(), e);
     }
-    AdminResponse response = request.createResponse((DistributionManager) dm);
+
+    // adding local member to the results
     response.setSender(dm.getDistributionManagerId());
     replyProcessor.process(response);
-    return replyProcessor.results;
+    return replyProcessor.getResults();
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
+    HashSet<PersistentID> persistentIds;
+    try {
+      persistentIds = doBackup(dm);
+    } catch (IOException e) {
+      logger.error(
+          LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, getClass()), e);
+      return AdminFailureResponse.create(getSender(), e);
+    }
+    return new FinishBackupResponse(getSender(), persistentIds);
+  }
+
+  private HashSet<PersistentID> doBackup(DM dm) throws IOException {
     InternalCache cache = dm.getCache();
     HashSet<PersistentID> persistentIds;
     if (cache == null || cache.getBackupManager() == null) {
-      persistentIds = new HashSet<PersistentID>();
+      persistentIds = new HashSet<>();
     } else {
-      try {
-        persistentIds = cache.getBackupManager().doBackup(targetDir, baselineDir, abort);
-      } catch (IOException e) {
-        logger.error(
-            LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e);
-        return AdminFailureResponse.create(dm, getSender(), e);
-      }
+      persistentIds = cache.getBackupManager().doBackup(targetDir, baselineDir, abort);
     }
-
-    return new FinishBackupResponse(this.getSender(), persistentIds);
+    return persistentIds;
   }
 
+  @Override
   public int getDSFID() {
     return FINISH_BACKUP_REQUEST;
   }
@@ -130,11 +150,12 @@ public class FinishBackupRequest extends CliLegacyMessage {
     DataSerializer.writeBoolean(abort, out);
   }
 
-  private static class FinishBackupReplyProcessor extends AdminMultipleReplyProcessor {
-    Map<DistributedMember, Set<PersistentID>> results =
+  static class FinishBackupReplyProcessor extends AdminMultipleReplyProcessor {
+
+    private Map<DistributedMember, Set<PersistentID>> results =
         Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>());
 
-    public FinishBackupReplyProcessor(DM dm, Collection initMembers) {
+    FinishBackupReplyProcessor(DM dm, Collection initMembers) {
       super(dm, initMembers);
     }
 
@@ -143,8 +164,6 @@ public class FinishBackupRequest extends CliLegacyMessage {
       return false;
     }
 
-
-
     @Override
     protected int getAckWaitThreshold() {
       // Disable the 15 second warning if the backup is taking a long time
@@ -158,17 +177,23 @@ public class FinishBackupRequest extends CliLegacyMessage {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof FinishBackupResponse) {
-        final HashSet<PersistentID> persistentIds = ((FinishBackupResponse) msg).getPersistentIds();
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof FinishBackupResponse) {
+        HashSet<PersistentID> persistentIds = ((FinishBackupResponse) message).getPersistentIds();
         if (persistentIds != null && !persistentIds.isEmpty()) {
-          results.put(msg.getSender(), persistentIds);
+          results.put(message.getSender(), persistentIds);
         }
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
 
+    @Override
+    protected InternalDistributedMember[] getMembers() {
+      return super.getMembers();
+    }
 
-
+    Map<DistributedMember, Set<PersistentID>> getResults() {
+      return results;
+    }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java
index 97fdb30..9887327 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java
@@ -27,8 +27,6 @@ import org.apache.geode.internal.admin.remote.AdminResponse;
 /**
  * The reply for a {@link FinishBackupRequest}. The reply contains the persistent ids of the disk
  * stores that were backed up on this member.
- *
- *
  */
 public class FinishBackupResponse extends AdminResponse {
 
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
index 3a0048a..3734752 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
@@ -22,12 +22,11 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.CancelException;
 import org.apache.geode.cache.DiskStore;
 import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
 import org.apache.geode.internal.admin.remote.AdminResponse;
 import org.apache.geode.internal.admin.remote.CliLegacyMessage;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 
@@ -39,17 +38,36 @@ import org.apache.geode.internal.logging.LogService;
 public class FlushToDiskRequest extends CliLegacyMessage {
   private static final Logger logger = LogService.getLogger();
 
+  private final DM dm;
+  private final FlushToDiskProcessor replyProcessor;
+
   public FlushToDiskRequest() {
-    // nothing
+    super();
+    this.dm = null;
+    this.replyProcessor = null;
+  }
+
+  private FlushToDiskRequest(DM dm, Set<InternalDistributedMember> recipients) {
+    this(dm, recipients, new FlushToDiskProcessor(dm, recipients));
+  }
+
+  FlushToDiskRequest(DM dm, Set<InternalDistributedMember> recipients, FlushToDiskProcessor replyProcessor) {
+    this.dm = dm;
+    setRecipients(recipients);
+    this.replyProcessor = replyProcessor;
+    this.msgId = this.replyProcessor.getProcessorId();
   }
 
   public static void send(DM dm, Set recipients) {
-    FlushToDiskRequest request = new FlushToDiskRequest();
-    request.setRecipients(recipients);
+    FlushToDiskRequest request = new FlushToDiskRequest(dm, recipients);
+    request.send();
+  }
+
+  void send() {
+    dm.putOutgoing(this);
+
+    AdminResponse response = createResponse(dm);
 
-    FlushToDiskProcessor replyProcessor = new FlushToDiskProcessor(dm, recipients);
-    request.msgId = replyProcessor.getProcessorId();
-    dm.putOutgoing(request);
     try {
       replyProcessor.waitForReplies();
     } catch (ReplyException e) {
@@ -57,15 +75,15 @@ public class FlushToDiskRequest extends CliLegacyMessage {
         throw e;
       }
     } catch (InterruptedException e) {
-      logger.debug(e);
+      logger.warn(e);
     }
-    AdminResponse response = request.createResponse((DistributionManager) dm);
+
     response.setSender(dm.getDistributionManagerId());
     replyProcessor.process(response);
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     if (cache != null) {
       cache.listDiskStoresIncludingRegionOwned().forEach(DiskStore::flush);
@@ -79,8 +97,9 @@ public class FlushToDiskRequest extends CliLegacyMessage {
     return FLUSH_TO_DISK_REQUEST;
   }
 
-  private static class FlushToDiskProcessor extends AdminMultipleReplyProcessor {
-    public FlushToDiskProcessor(DM dm, Collection initMembers) {
+  static class FlushToDiskProcessor extends AdminMultipleReplyProcessor {
+
+    FlushToDiskProcessor(DM dm, Collection initMembers) {
       super(dm, initMembers);
     }
 
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
index 869f774..28f9757 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
@@ -28,15 +28,13 @@ import org.apache.geode.CancelException;
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.admin.remote.AdminFailureResponse;
 import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
 import org.apache.geode.internal.admin.remote.AdminResponse;
 import org.apache.geode.internal.admin.remote.CliLegacyMessage;
-import org.apache.geode.internal.cache.BackupManager;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
@@ -46,23 +44,40 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
  * A request to from an admin VM to all non admin members to start a backup. In the prepare phase of
  * the backup, the members will suspend bucket destroys to make sure buckets aren't missed during
  * the backup.
- *
- *
  */
 public class PrepareBackupRequest extends CliLegacyMessage {
   private static final Logger logger = LogService.getLogger();
 
+  private final DM dm;
+  private final PrepareBackupReplyProcessor replyProcessor;
+
   public PrepareBackupRequest() {
+    super();
+    this.dm = null;
+    this.replyProcessor = null;
+  }
+
+  private PrepareBackupRequest(DM dm, Set<InternalDistributedMember> recipients) {
+    this(dm, recipients, new PrepareBackupReplyProcessor(dm, recipients));
+  }
 
+  PrepareBackupRequest(DM dm, Set<InternalDistributedMember> recipients, PrepareBackupReplyProcessor replyProcessor) {
+    this.dm = dm;
+    setRecipients(recipients);
+    this.replyProcessor = replyProcessor;
+    this.msgId = this.replyProcessor.getProcessorId();
   }
 
   public static Map<DistributedMember, Set<PersistentID>> send(DM dm, Set recipients) {
-    PrepareBackupRequest request = new PrepareBackupRequest();
-    request.setRecipients(recipients);
+    PrepareBackupRequest request = new PrepareBackupRequest(dm, recipients);
+    return request.send();
+  }
+
+  Map<DistributedMember, Set<PersistentID>> send() {
+    dm.putOutgoing(this);
+
+    AdminResponse response = createResponse(dm);
 
-    PrepareBackupReplyProcessor replyProcessor = new PrepareBackupReplyProcessor(dm, recipients);
-    request.msgId = replyProcessor.getProcessorId();
-    dm.putOutgoing(request);
     try {
       replyProcessor.waitForReplies();
     } catch (ReplyException e) {
@@ -70,44 +85,49 @@ public class PrepareBackupRequest extends CliLegacyMessage {
         throw e;
       }
     } catch (InterruptedException e) {
-      e.printStackTrace();
+      logger.warn(e.getMessage(), e);
     }
-    AdminResponse response = request.createResponse((DistributionManager) dm);
+
     response.setSender(dm.getDistributionManagerId());
     replyProcessor.process(response);
-    return replyProcessor.results;
+    return replyProcessor.getResults();
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
+    HashSet<PersistentID> persistentIds;
+    try {
+      persistentIds = prepareForBackup();
+    } catch (IOException e) {
+      logger.error(
+          LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, getClass()), e);
+      return AdminFailureResponse.create(getSender(), e);
+    }
+    return new PrepareBackupResponse(getSender(), persistentIds);
+  }
+
+  HashSet<PersistentID> prepareForBackup() throws IOException {
     InternalCache cache = dm.getCache();
     HashSet<PersistentID> persistentIds;
     if (cache == null) {
       persistentIds = new HashSet<>();
     } else {
-      try {
-        BackupManager manager = cache.startBackup(getSender());
-        persistentIds = manager.prepareForBackup();
-      } catch (IOException e) {
-        logger.error(
-            LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e);
-        return AdminFailureResponse.create(dm, getSender(), e);
-      }
+      persistentIds = cache.startBackup(getSender()).prepareForBackup();
     }
-
-
-    return new PrepareBackupResponse(this.getSender(), persistentIds);
+    return persistentIds;
   }
 
+  @Override
   public int getDSFID() {
     return PREPARE_BACKUP_REQUEST;
   }
 
-  private static class PrepareBackupReplyProcessor extends AdminMultipleReplyProcessor {
-    Map<DistributedMember, Set<PersistentID>> results =
+  static class PrepareBackupReplyProcessor extends AdminMultipleReplyProcessor {
+
+    private Map<DistributedMember, Set<PersistentID>> results =
         Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>());
 
-    public PrepareBackupReplyProcessor(DM dm, Collection initMembers) {
+    PrepareBackupReplyProcessor(DM dm, Collection initMembers) {
       super(dm, initMembers);
     }
 
@@ -117,18 +137,19 @@ public class PrepareBackupRequest extends CliLegacyMessage {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof PrepareBackupResponse) {
-        final HashSet<PersistentID> persistentIds =
-            ((PrepareBackupResponse) msg).getPersistentIds();
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof PrepareBackupResponse) {
+        HashSet<PersistentID> persistentIds =
+            ((PrepareBackupResponse) message).getPersistentIds();
         if (persistentIds != null && !persistentIds.isEmpty()) {
-          results.put(msg.getSender(), persistentIds);
+          results.put(message.getSender(), persistentIds);
         }
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
 
-
-
+    Map<DistributedMember, Set<PersistentID>> getResults() {
+      return results;
+    }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java
index 1ce7421..dc8fb8b 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java
@@ -24,6 +24,7 @@ import java.util.Set;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.geode.CancelCriterion;
+import org.apache.geode.admin.GemFireHealthConfig;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.Role;
 import org.apache.geode.distributed.internal.locks.ElderState;
@@ -37,31 +38,31 @@ import org.apache.geode.internal.cache.InternalCache;
  */
 public interface DM extends ReplySender {
 
-  public boolean shutdownInProgress();
+  boolean shutdownInProgress();
 
   /**
    * Returns the current "cache time" in milliseconds since the epoch. The "cache time" takes into
    * account skew among the local clocks on the various machines involved in the cache.
    */
-  public long cacheTimeMillis();
+  long cacheTimeMillis();
 
   /**
    * Returns the id of this distribution manager.
    */
-  public InternalDistributedMember getDistributionManagerId();
+  InternalDistributedMember getDistributionManagerId();
 
   /**
    * Get a set of all other members (both admin ones and normal).
    *
    * @since GemFire 5.7
    */
-  public Set getAllOtherMembers();
+  Set getAllOtherMembers();
 
   /**
    * Returns the ID in the membership view that is equal to the argument. If the ID is not in the
    * view, the argument is returned.
    */
-  public InternalDistributedMember getCanonicalId(DistributedMember id);
+  InternalDistributedMember getCanonicalId(DistributedMember id);
 
   /**
    * removes members that have older versions from the given collection, typically a Set from a
@@ -69,8 +70,8 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 8.0
    */
-  public void retainMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
-      Version version);
+  void retainMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
+                                           Version version);
 
   /**
    * removes members that have the given version or later from the given collection, typically a Set
@@ -78,20 +79,20 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 8.0
    */
-  public void removeMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
-      Version version);
+  void removeMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
+                                           Version version);
 
   /**
    * 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.
    */
-  public Set getDistributionManagerIds();
+  Set getDistributionManagerIds();
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known "normal" distribution
    * managers. This does not include locators or admin members.
    */
-  public Set getNormalDistributionManagerIds();
+  Set getNormalDistributionManagerIds();
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known distribution managers
@@ -99,22 +100,22 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 5.7
    */
-  public Set getDistributionManagerIdsIncludingAdmin();
+  Set getDistributionManagerIdsIncludingAdmin();
 
   /**
    * Returns a private-memory list containing getDistributionManagerIds() minus our id.
    */
-  public Set getOtherDistributionManagerIds();
+  Set getOtherDistributionManagerIds();
 
   /**
    * Returns a private-memory list containing getNormalDistributionManagerIds() minus our id.
    */
-  public Set getOtherNormalDistributionManagerIds();
+  Set getOtherNormalDistributionManagerIds();
 
   /**
    * Add a membership listener and return other DistribtionManagerIds as an atomic operation
    */
-  public Set addMembershipListenerAndGetDistributionManagerIds(MembershipListener l);
+  Set addMembershipListenerAndGetDistributionManagerIds(MembershipListener l);
 
   /**
    * Add a membership listener for all members and return other DistribtionManagerIds as an atomic
@@ -122,19 +123,19 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 5.7
    */
-  public Set addAllMembershipListenerAndGetAllIds(MembershipListener l);
+  Set addAllMembershipListenerAndGetAllIds(MembershipListener l);
 
   /**
    * Returns the identity of this <code>DistributionManager</code>
    */
-  public InternalDistributedMember getId();
+  InternalDistributedMember getId();
 
   /**
    * Return true if no other distribution manager was in this group when he joined.
    *
    * @since GemFire 4.0
    */
-  public boolean isAdam();
+  boolean isAdam();
 
   /**
    * Returns the identity of the oldest DM in this group.
@@ -144,19 +145,19 @@ public interface DM extends ReplySender {
    * @return the elder member, possibly null
    * @since GemFire 4.0
    */
-  public InternalDistributedMember getElderId();
+  InternalDistributedMember getElderId();
 
   /**
    * Return true if this is the oldest DM in this group.
    *
    * @since GemFire 5.0
    */
-  public boolean isElder();
+  boolean isElder();
 
   /**
    * Return true if this DM is a loner that is not part of a real distributed system.
    */
-  public boolean isLoner();
+  boolean isLoner();
 
   /**
    * Returns the elder state or null if this DM is not the elder.
@@ -169,14 +170,14 @@ public interface DM extends ReplySender {
    * @throws IllegalStateException if elder try lock fails
    * @since GemFire 4.0
    */
-  public ElderState getElderState(boolean force, boolean useTryLock);
+  ElderState getElderState(boolean force, boolean useTryLock);
 
   /**
    * Returns the id of the underlying distribution channel used for communication.
    *
    * @since GemFire 3.0
    */
-  public long getChannelId();
+  long getChannelId();
 
   /**
    * Adds a message to the outgoing queue. Note that <code>message</code> should not be modified
@@ -187,7 +188,7 @@ public interface DM extends ReplySender {
    * @throws NotSerializableException If <code>message</code> cannot be serialized
    * @see #putOutgoing(DistributionMessage)
    */
-  public Set putOutgoingUserData(DistributionMessage message) throws NotSerializableException;
+  Set putOutgoingUserData(DistributionMessage message) throws NotSerializableException;
 
   /**
    * Sends a message, guaranteed to be serialized
@@ -196,24 +197,24 @@ public interface DM extends ReplySender {
    * @param msg
    * @return recipients who did not receive the message
    */
-  public Set putOutgoing(DistributionMessage msg);
+  Set putOutgoing(DistributionMessage msg);
 
   /**
    * Returns the distributed system to which this distribution manager is connected.
    */
-  public InternalDistributedSystem getSystem();
+  InternalDistributedSystem getSystem();
 
   /**
    * Adds a <code>MembershipListener</code> to this distribution manager.
    */
-  public void addMembershipListener(MembershipListener l);
+  void addMembershipListener(MembershipListener l);
 
   /**
    * Removes a <code>MembershipListener</code> from this distribution manager.
    *
    * @throws IllegalArgumentException <code>l</code> was not registered on this distribution manager
    */
-  public void removeMembershipListener(MembershipListener l);
+  void removeMembershipListener(MembershipListener l);
 
   /**
    * Removes a <code>MembershipListener</code> listening for all members from this distribution
@@ -222,11 +223,11 @@ public interface DM extends ReplySender {
    * @throws IllegalArgumentException <code>l</code> was not registered on this distribution manager
    * @since GemFire 5.7
    */
-  public void removeAllMembershipListener(MembershipListener l);
+  void removeAllMembershipListener(MembershipListener l);
 
-  public void addAdminConsole(InternalDistributedMember id);
+  void addAdminConsole(InternalDistributedMember id);
 
-  public DMStats getStats();
+  DMStats getStats();
 
   /**
    * Used to get the DistributionConfig so that Connection can figure out if it is configured for
@@ -234,7 +235,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 4.2.1
    */
-  public DistributionConfig getConfig();
+  DistributionConfig getConfig();
 
   /**
    * Makes note of a distribution manager that has shut down. Invokes the appropriate listeners.
@@ -243,28 +244,28 @@ public interface DM extends ReplySender {
    *
    * @see ShutdownMessage#process
    */
-  public void handleManagerDeparture(InternalDistributedMember theId, boolean crashed,
-      String reason);
+  void handleManagerDeparture(InternalDistributedMember theId, boolean crashed,
+                              String reason);
 
   /**
    * getThreadPool gets this distribution manager's message-processing thread pool
    */
-  public ExecutorService getThreadPool();
+  ExecutorService getThreadPool();
 
   /**
    * Return the high-priority message-processing executor
    */
-  public ExecutorService getHighPriorityThreadPool();
+  ExecutorService getHighPriorityThreadPool();
 
   /**
    * Return the waiting message-processing executor
    */
-  public ExecutorService getWaitingThreadPool();
+  ExecutorService getWaitingThreadPool();
 
   /**
    * Return the special waiting message-processing executor
    */
-  public ExecutorService getPrMetaDataCleanupThreadPool();
+  ExecutorService getPrMetaDataCleanupThreadPool();
 
   /**
    * gets this distribution manager's message-processing executor for ordered (i.e. serialized)
@@ -272,13 +273,13 @@ public interface DM extends ReplySender {
    */
   // public Executor getSerialExecutor();
 
-  public void close();
+  void close();
 
   /**
    * Returns the ordered list of current DistributionManagers in oldest-to-youngest order. Added for
    * DLockGrantor
    */
-  public List<InternalDistributedMember> getViewMembers();
+  List<InternalDistributedMember> getViewMembers();
 
   /**
    * Returns the oldest member in the given set of distribution managers. The current implementation
@@ -288,27 +289,27 @@ public interface DM extends ReplySender {
    * @throws NoSuchElementException when none of the given members is actually a member of the
    *         distributed system.
    */
-  public DistributedMember getOldestMember(Collection members) throws NoSuchElementException;
+  DistributedMember getOldestMember(Collection members) throws NoSuchElementException;
 
   /**
    * @return Set of Admin VM nodes
    */
-  public Set getAdminMemberSet();
+  Set getAdminMemberSet();
 
   /** Throws ShutdownException if closeInProgress returns true. */
-  public void throwIfDistributionStopped();
+  void throwIfDistributionStopped();
 
   /** Returns count of members filling the specified role */
-  public int getRoleCount(Role role);
+  int getRoleCount(Role role);
 
   /** Returns true if at least one member is filling the specified role */
-  public boolean isRolePresent(Role role);
+  boolean isRolePresent(Role role);
 
   /** Returns a set of all roles currently in the distributed system. */
-  public Set getAllRoles();
+  Set getAllRoles();
 
   /** Returns true if id is a current member of the distributed system */
-  public boolean isCurrentMember(InternalDistributedMember id);
+  boolean isCurrentMember(InternalDistributedMember id);
 
   /**
    * Remove given member from list of members who are pending a startup reply
@@ -316,37 +317,37 @@ public interface DM extends ReplySender {
    * @param m the member
    * @param departed true if we're removing them due to membership
    */
-  public void removeUnfinishedStartup(InternalDistributedMember m, boolean departed);
+  void removeUnfinishedStartup(InternalDistributedMember m, boolean departed);
 
-  public void setUnfinishedStartups(Collection s);
+  void setUnfinishedStartups(Collection s);
 
   /**
    * Return the CancelCriterion for this DM.
    *
    * @return CancelCriterion for this DM
    */
-  public CancelCriterion getCancelCriterion();
+  CancelCriterion getCancelCriterion();
 
   /**
    * Return the membership manager for this DM
    *
    * @return the membership manager
    */
-  public MembershipManager getMembershipManager();
+  MembershipManager getMembershipManager();
 
   /**
    * Set the root cause for DM failure
    *
    * @param t the underlying failure
    */
-  public void setRootCause(Throwable t);
+  void setRootCause(Throwable t);
 
   /**
    * Return the underlying root cause for DM failure, possibly null
    *
    * @return the underlying root cause
    */
-  public Throwable getRootCause();
+  Throwable getRootCause();
 
   /**
    * Return all members that are on the the this host
@@ -354,27 +355,27 @@ public interface DM extends ReplySender {
    * @return set of {@link InternalDistributedMember} including this VM
    * @since GemFire 5.9
    */
-  public Set<InternalDistributedMember> getMembersInThisZone();
+  Set<InternalDistributedMember> getMembersInThisZone();
 
   /**
    * Acquire a permit to request a GII from another member
    */
-  public void acquireGIIPermitUninterruptibly();
+  void acquireGIIPermitUninterruptibly();
 
   /**
    * Release a permit to request a GII from another member.
    */
-  public void releaseGIIPermit();
+  void releaseGIIPermit();
 
-  public int getDistributedSystemId();
+  int getDistributedSystemId();
 
-  public boolean enforceUniqueZone();
+  boolean enforceUniqueZone();
 
-  public Set<InternalDistributedMember> getMembersInSameZone(
+  Set<InternalDistributedMember> getMembersInSameZone(
       InternalDistributedMember acceptedMember);
 
-  public boolean areInSameZone(InternalDistributedMember member1,
-      InternalDistributedMember member2);
+  boolean areInSameZone(InternalDistributedMember member1,
+                        InternalDistributedMember member2);
 
   /**
    * Returns true is the two members are on the same equivalent host machine based on overlapping IP
@@ -383,12 +384,12 @@ public interface DM extends ReplySender {
    * @param member1 First member
    * @param member2 Second member
    */
-  public boolean areOnEquivalentHost(InternalDistributedMember member1,
-      InternalDistributedMember member2);
+  boolean areOnEquivalentHost(InternalDistributedMember member1,
+                              InternalDistributedMember member2);
 
-  public Set<InetAddress> getEquivalents(InetAddress in);
+  Set<InetAddress> getEquivalents(InetAddress in);
 
-  public Set<DistributedMember> getGroupMembers(String group);
+  Set<DistributedMember> getGroupMembers(String group);
 
   /**
    * Adds the entry in hostedLocators for a member with one or more hosted locators. The value is a
@@ -402,8 +403,8 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 6.6.3
    */
-  public void addHostedLocators(InternalDistributedMember member, Collection<String> locators,
-      boolean isSharedConfigurationEnabled);
+  void addHostedLocators(InternalDistributedMember member, Collection<String> locators,
+                         boolean isSharedConfigurationEnabled);
 
 
   /**
@@ -415,7 +416,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 6.6.3
    */
-  public Collection<String> getHostedLocators(InternalDistributedMember member);
+  Collection<String> getHostedLocators(InternalDistributedMember member);
 
   /**
    * Gets the map of all members hosting locators. The key is the member, and the value is a
@@ -428,7 +429,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 6.6.3
    */
-  public Map<InternalDistributedMember, Collection<String>> getAllHostedLocators();
+  Map<InternalDistributedMember, Collection<String>> getAllHostedLocators();
 
   /**
    * Gets the map of all members hosting locators with shared configuration. The key is the member,
@@ -439,7 +440,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 8.0
    */
-  public Map<InternalDistributedMember, Collection<String>> getAllHostedLocatorsWithSharedConfiguration();
+  Map<InternalDistributedMember, Collection<String>> getAllHostedLocatorsWithSharedConfiguration();
 
   /****
    * Determines if the distributed system has the shared configuration service enabled or not.
@@ -447,24 +448,30 @@ public interface DM extends ReplySender {
    * @return true if the distributed system was started or had a locator with
    *         enable-cluster-configuration = true
    */
-  public boolean isSharedConfigurationServiceEnabledForDS();
+  boolean isSharedConfigurationServiceEnabledForDS();
 
   /**
    * Forces use of UDP for communications in the current thread. UDP is connectionless, so no tcp/ip
    * connections will be created or used for messaging until this setting is released with
    * releaseUDPMessagingForCurrentThread.
    */
-  public void forceUDPMessagingForCurrentThread();
+  void forceUDPMessagingForCurrentThread();
 
   /**
    * Releases use of UDP for all communications in the current thread, as established by
    * forceUDPMessagingForCurrentThread.
    */
-  public void releaseUDPMessagingForCurrentThread();
+  void releaseUDPMessagingForCurrentThread();
 
   int getDMType();
 
   InternalCache getCache();
 
   void setCache(InternalCache instance);
+
+  HealthMonitor getHealthMonitor(InternalDistributedMember owner);
+
+  void removeHealthMonitor(InternalDistributedMember owner, int theId);
+
+  void createHealthMonitor(InternalDistributedMember owner, GemFireHealthConfig cfg);
 }
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 8bbe019..5655e47 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
@@ -22,6 +22,7 @@ import java.util.concurrent.*;
 
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.InternalGemFireError;
+import org.apache.geode.admin.GemFireHealthConfig;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DurableClientAttributes;
 import org.apache.geode.distributed.Role;
@@ -1387,4 +1388,19 @@ public class LonerDistributionManager implements DM {
   public void setCache(InternalCache instance) {
     this.cache = instance;
   }
+
+  @Override
+  public HealthMonitor getHealthMonitor(InternalDistributedMember owner) {
+    throw new UnsupportedOperationException("getHealthMonitor is not supported by " + getClass().getSimpleName());
+  }
+
+  @Override
+  public void removeHealthMonitor(InternalDistributedMember owner, int theId) {
+    throw new UnsupportedOperationException("removeHealthMonitor is not supported by " + getClass().getSimpleName());
+  }
+
+  @Override
+  public void createHealthMonitor(InternalDistributedMember owner, GemFireHealthConfig cfg) {
+    throw new UnsupportedOperationException("createHealthMonitor is not supported by " + getClass().getSimpleName());
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java
index 795b00c..4ffe064 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java
@@ -57,7 +57,7 @@ public class AddHealthListenerRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return AddHealthListenerResponse.create(dm, this.getSender(), this.cfg);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java
index 3fda3f7..457cfdf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java
@@ -35,8 +35,8 @@ public class AddHealthListenerResponse extends AdminResponse {
    * Returns a <code>AddHealthListenerResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static AddHealthListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, GemFireHealthConfig cfg) {
+  public static AddHealthListenerResponse create(DM dm,
+                                                 InternalDistributedMember recipient, GemFireHealthConfig cfg) {
     AddHealthListenerResponse m = new AddHealthListenerResponse();
     m.setRecipient(recipient);
     dm.createHealthMonitor(recipient, cfg);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java
index 2165ee8..e4de846 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java
@@ -47,9 +47,10 @@ public class AddStatListenerRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return AddStatListenerResponse.create(dm, this.getSender(), this.resourceId, this.statName);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java
index b5f52a9..c71b4c7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java
@@ -34,8 +34,8 @@ public class AddStatListenerResponse extends AdminResponse {
    * Returns a <code>AddStatListenerResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static AddStatListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, long resourceId, String statName) {
+  public static AddStatListenerResponse create(DM dm,
+                                               InternalDistributedMember recipient, long resourceId, String statName) {
     AddStatListenerResponse m = new AddStatListenerResponse();
     m.setRecipient(recipient);
     GemFireStatSampler sampler = null;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java
index fc5556b..43196f3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java
@@ -12,40 +12,38 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-
 package org.apache.geode.internal.admin.remote;
 
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 
-import org.apache.geode.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 
 /**
  * A response to a failed request.
  */
 public class AdminFailureResponse extends AdminResponse {
-  // instance variables
-  Exception cause;
+
+  private Exception cause;
 
   /**
-   * Returns a <code>AdminFailureResponse</code> that will be returned to the specified recipient.
+   * Returns a {@code AdminFailureResponse} that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's system config.
    */
-  public static AdminFailureResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Exception cause) {
-    AdminFailureResponse m = new AdminFailureResponse();
-    m.setRecipient(recipient);
-    m.cause = cause;
-    return m;
+  public static AdminFailureResponse create(InternalDistributedMember recipient, Exception cause) {
+    AdminFailureResponse message = new AdminFailureResponse();
+    message.setRecipient(recipient);
+    message.cause = cause;
+    return message;
   }
 
-  // instance methods
   public Exception getCause() {
     return this.cause;
   }
 
+  @Override
   public int getDSFID() {
     return ADMIN_FAILURE_RESPONSE;
   }
@@ -59,11 +57,11 @@ public class AdminFailureResponse extends AdminResponse {
   @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     super.fromData(in);
-    this.cause = (Exception) DataSerializer.readObject(in);
+    this.cause = DataSerializer.readObject(in);
   }
 
   @Override
   public String toString() {
-    return "AdminFailureResponse from " + this.getRecipient() + " cause=" + this.cause;
+    return "AdminFailureResponse from " + getRecipient() + " cause=" + this.cause;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java
index 95efbe7..3a5cff9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java
@@ -16,21 +16,15 @@ package org.apache.geode.internal.admin.remote;
 
 import java.util.Collection;
 
-import org.apache.geode.CancelCriterion;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionMessage;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-
 
 /**
  * TODO prpersist. This code really needs to be merged with the AdminReplyProcessor. However, we're
  * getting close to the release and I don't want to mess with all of the admin code right now. We
  * need this class to handle failures from admin messages that expect replies from multiple members.
- *
  */
 public class AdminMultipleReplyProcessor extends ReplyProcessor21 {
 
@@ -38,47 +32,16 @@ public class AdminMultipleReplyProcessor extends ReplyProcessor21 {
     super(dm, initMembers);
   }
 
-  public AdminMultipleReplyProcessor(DM dm, InternalDistributedMember member) {
-    super(dm, member);
-  }
-
-  public AdminMultipleReplyProcessor(DM dm, InternalDistributedSystem system,
-      Collection initMembers, CancelCriterion cancelCriterion, boolean register) {
-    super(dm, system, initMembers, cancelCriterion, register);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system, Collection initMembers,
-      CancelCriterion cancelCriterion) {
-    super(system, initMembers, cancelCriterion);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system, Collection initMembers) {
-    super(system, initMembers);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system,
-      InternalDistributedMember member, CancelCriterion cancelCriterion) {
-    super(system, member, cancelCriterion);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system,
-      InternalDistributedMember member) {
-    super(system, member);
-  }
-
   @Override
-  protected void process(DistributionMessage msg, boolean warn) {
-    if (msg instanceof AdminFailureResponse) {
-      Exception ex = ((AdminFailureResponse) msg).getCause();
+  protected void process(DistributionMessage message, boolean warn) {
+    if (message instanceof AdminFailureResponse) {
+      Exception ex = ((AdminFailureResponse) message).getCause();
       if (ex != null) {
-        ReplyException rex = new ReplyException(ex);
-        rex.setSenderIfNull(msg.getSender());
-        processException(msg, rex);
+        ReplyException replyException = new ReplyException(ex);
+        replyException.setSenderIfNull(message.getSender());
+        processException(message, replyException);
       }
     }
-    super.process(msg, warn);
+    super.process(message, warn);
   }
-
-
-
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java
index 6ea7de6..58c078b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java
@@ -24,6 +24,7 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.admin.RuntimeAdminException;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.PooledDistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
@@ -134,7 +135,7 @@ public abstract class AdminRequest extends PooledDistributionMessage {
       cpMgr.jumpToModifiedClassLoader(modifiedClasspath);
       response = createResponse(dm);
     } catch (Exception ex) {
-      response = AdminFailureResponse.create(dm, this.getSender(), ex);
+      response = AdminFailureResponse.create(this.getSender(), ex);
     } finally {
       cpMgr.revertToOldClassLoader();
     }
@@ -150,7 +151,7 @@ public abstract class AdminRequest extends PooledDistributionMessage {
   /**
    * Must return a proper response to this request.
    */
-  protected abstract AdminResponse createResponse(DistributionManager dm);
+  protected abstract AdminResponse createResponse(DM dm);
 
   @Override
   public void toData(DataOutput out) throws IOException {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java
index 04c4233..853d5bf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java
@@ -17,7 +17,7 @@ package org.apache.geode.internal.admin.remote;
 import java.io.*;
 
 import org.apache.geode.DataSerializer;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.internal.admin.CacheInfo;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 
@@ -132,7 +132,7 @@ public class BridgeServerRequest extends AdminRequest {
    * Creates a <Code>BridgeServerResponse</code> to this request
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return BridgeServerResponse.create(dm, this);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
index ddc102d..6e9b32d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
@@ -22,7 +22,7 @@ import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.InternalCache;
@@ -44,7 +44,7 @@ public class BridgeServerResponse extends AdminResponse {
   /**
    * Creates a {@code BridgeServerResponse} in response to the given request.
    */
-  static BridgeServerResponse create(DistributionManager dm, BridgeServerRequest request) {
+  static BridgeServerResponse create(DM dm, BridgeServerRequest request) {
     BridgeServerResponse m = new BridgeServerResponse();
     m.setRecipient(request.getSender());
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java
index dba5810..d833507 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java
@@ -53,7 +53,7 @@ public class CacheConfigRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return CacheConfigResponse.create(dm, this.getSender(), this.cacheId, this.attributeCode,
         this.newValue);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
index 0aae5ff..a1b15d3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.InternalCache;
@@ -45,8 +45,8 @@ public class CacheConfigResponse extends AdminResponse {
   /**
    * Returns a {@code CacheConfigResponse} that will be returned to the specified recipient.
    */
-  public static CacheConfigResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int cacheId, byte attributeCode, int newValue) {
+  public static CacheConfigResponse create(DM dm,
+                                           InternalDistributedMember recipient, int cacheId, byte attributeCode, int newValue) {
     CacheConfigResponse m = new CacheConfigResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java
index db13737..a721040 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java
@@ -42,9 +42,10 @@ public class CacheInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return CacheInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
index f6191c5..6f03a10 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 
@@ -37,8 +37,8 @@ public class CacheInfoResponse extends AdminResponse {
   /**
    * Returns a {@code CacheInfoResponse} that will be returned to the specified recipient.
    */
-  public static CacheInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static CacheInfoResponse create(DM dm,
+                                         InternalDistributedMember recipient) {
     CacheInfoResponse m = new CacheInfoResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java
index 0602fc4..2ac6121 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java
@@ -47,7 +47,7 @@ public class CancelStatListenerRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return CancelStatListenerResponse.create(dm, this.getSender(), this.listenerId);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java
index d105fa3..3f57f76 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java
@@ -34,8 +34,8 @@ public class CancelStatListenerResponse extends AdminResponse {
    * Returns a <code>CancelStatListenerResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static CancelStatListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int listenerId) {
+  public static CancelStatListenerResponse create(DM dm,
+                                                  InternalDistributedMember recipient, int listenerId) {
     CancelStatListenerResponse m = new CancelStatListenerResponse();
     m.setRecipient(recipient);
     GemFireStatSampler sampler = null;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java
index 3e0fc6e..bf8ff7f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java
@@ -40,7 +40,7 @@ public abstract class CliLegacyMessage extends AdminRequest {
     } catch (Exception ex) {
       logger.error(
           LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), ex);
-      response = AdminFailureResponse.create(dm, this.getSender(), ex);
+      response = AdminFailureResponse.create(this.getSender(), ex);
 
     }
     if (response != null) { // cancellations result in null response
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
index 96c87e2..df197f6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
@@ -35,7 +35,6 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.cache.DiskStoreImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.ArrayUtils;
@@ -81,7 +80,7 @@ public class CompactRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     HashSet<PersistentID> compactedStores = new HashSet<>();
     if (cache != null && !cache.isClosed()) {
@@ -135,14 +134,14 @@ public class CompactRequest extends CliLegacyMessage {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof CompactResponse) {
-        final Set<PersistentID> persistentIds = ((CompactResponse) msg).getPersistentIds();
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof CompactResponse) {
+        final Set<PersistentID> persistentIds = ((CompactResponse) message).getPersistentIds();
         if (persistentIds != null && !persistentIds.isEmpty()) {
-          this.results.put(msg.getSender(), persistentIds);
+          this.results.put(message.getSender(), persistentIds);
         }
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java
index a079d25..d8f7e1c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java
@@ -55,8 +55,9 @@ public class DurableClientInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return DurableClientInfoResponse.create(dm, this.getSender(), this);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
index 98837c5..c3f7b80 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.InternalCache;
@@ -40,8 +40,8 @@ public class DurableClientInfoResponse extends AdminResponse {
   /**
    * Returns a {@code DurableClientInfoResponse} that will be returned to the specified recipient.
    */
-  public static DurableClientInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, DurableClientInfoRequest request) {
+  public static DurableClientInfoResponse create(DM dm,
+                                                 InternalDistributedMember recipient, DurableClientInfoRequest request) {
     DurableClientInfoResponse m = new DurableClientInfoResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java
index 0e394ae..fb4e35a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java
@@ -37,9 +37,10 @@ public class FetchDistLockInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchDistLockInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java
index 4492fb8..2f5fa43 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java
@@ -35,8 +35,8 @@ public class FetchDistLockInfoResponse extends AdminResponse {
    * recipient. The message will contains a copy of the local manager's distributed lock service
    * information.
    */
-  public static FetchDistLockInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static FetchDistLockInfoResponse create(DM dm,
+                                                 InternalDistributedMember recipient) {
     FetchDistLockInfoResponse m = new FetchDistLockInfoResponse();
     InternalDistributedMember id = dm.getDistributionManagerId();
     Set entries = DLockService.snapshotAllServices().entrySet();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java
index 37d0a33..05141b4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java
@@ -51,7 +51,7 @@ public class FetchHealthDiagnosisRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchHealthDiagnosisResponse.create(dm, this.getSender(), this.id, this.healthCode);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java
index 1585907..20888f4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java
@@ -36,8 +36,8 @@ public class FetchHealthDiagnosisResponse extends AdminResponse {
    * Returns a <code>FetchHealthDiagnosisResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static FetchHealthDiagnosisResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int id, GemFireHealth.Health healthCode) {
+  public static FetchHealthDiagnosisResponse create(DM dm,
+                                                    InternalDistributedMember recipient, int id, GemFireHealth.Health healthCode) {
     FetchHealthDiagnosisResponse m = new FetchHealthDiagnosisResponse();
     m.setRecipient(recipient);
     {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java
index ee3d8b6..f27aa66 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java
@@ -41,7 +41,7 @@ public class FetchHostRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchHostResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
index f41f0ac..233dccc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
@@ -27,8 +27,8 @@ import java.net.UnknownHostException;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.cache.CacheServerLauncher;
@@ -59,8 +59,8 @@ public class FetchHostResponse extends AdminResponse {
    * Returns a <code>FetchHostResponse</code> that will be returned to the specified recipient. The
    * message will contains a copy of this vm's local host.
    */
-  public static FetchHostResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static FetchHostResponse create(DM dm,
+                                         InternalDistributedMember recipient) {
     FetchHostResponse m = new FetchHostResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java
index 308a759..ed1095a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java
@@ -38,7 +38,7 @@ public class FetchResourceAttributesRequest extends AdminRequest {
   }
 
   @Override
-  public AdminResponse createResponse(DistributionManager dm) {
+  public AdminResponse createResponse(DM dm) {
     return FetchResourceAttributesResponse.create(dm, this.getSender(), resourceUniqueId);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java
index 7f2be75..2273a5d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java
@@ -12,23 +12,25 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-
 package org.apache.geode.internal.admin.remote;
 
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 
-import org.apache.geode.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.StatisticDescriptor;
+import org.apache.geode.Statistics;
+import org.apache.geode.StatisticsType;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 
 public class FetchResourceAttributesResponse extends AdminResponse {
 
-  // instance variables
   private RemoteStat[] stats;
 
-  public static FetchResourceAttributesResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, long rsrcUniqueId) {
+  public static FetchResourceAttributesResponse create(DM dm, InternalDistributedMember recipient, long rsrcUniqueId) {
     FetchResourceAttributesResponse m = new FetchResourceAttributesResponse();
     m.setRecipient(recipient);
     Statistics s = null;
@@ -53,9 +55,11 @@ public class FetchResourceAttributesResponse extends AdminResponse {
   }
 
   /**
-   * Constructor required by <code>DataSerializable</code>
+   * Constructor required by {@code DataSerializable}
    */
-  public FetchResourceAttributesResponse() {}
+  public FetchResourceAttributesResponse() {
+    // nothing
+  }
 
   public int getDSFID() {
     return FETCH_RESOURCE_ATTRIBUTES_RESPONSE;
@@ -75,6 +79,6 @@ public class FetchResourceAttributesResponse extends AdminResponse {
 
   @Override
   public String toString() {
-    return "FetchResourceAttributesResponse from " + this.getRecipient();
+    return "FetchResourceAttributesResponse from " + getRecipient();
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java
index dc98cae..8cd6d1c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java
@@ -40,7 +40,7 @@ public class FetchStatsRequest extends AdminRequest {
   }
 
   @Override
-  public AdminResponse createResponse(DistributionManager dm) {
+  public AdminResponse createResponse(DM dm) {
     return FetchStatsResponse.create(dm, this.getSender(), this.statisticsTypeName);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java
index f9a861c..38fc980 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java
@@ -14,27 +14,23 @@
  */
 package org.apache.geode.internal.admin.remote;
 
+import org.apache.geode.DataSerializer;
+import org.apache.geode.Statistics;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem.StatisticsVisitor;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.Iterator;
 import java.util.List;
 
-import org.apache.geode.DataSerializer;
-import org.apache.geode.Statistics;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.InternalDistributedSystem.StatisticsVisitor;
-import org.apache.geode.distributed.internal.membership.*;
-
 /**
- * Provides a response of remote statistic resources for a <code>FetchStatsRequest</code>
- *
+ * Provides a response of remote statistic resources for a {@code FetchStatsRequest}
  */
 public class FetchStatsResponse extends AdminResponse {
 
-  // instance variables
   private RemoteStatResource[] stats;
 
   /**
@@ -44,12 +40,11 @@ public class FetchStatsResponse extends AdminResponse {
    * @param recipient the recipient who made the original request
    * @return response containing all remote stat resources
    */
-  public static FetchStatsResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, final String statisticsTypeName) {
-    // LogWriterI18n log = dm.getLogger();
+  public static FetchStatsResponse create(DM dm,
+                                          InternalDistributedMember recipient, final String statisticsTypeName) {
     FetchStatsResponse m = new FetchStatsResponse();
     m.setRecipient(recipient);
-    final List<RemoteStatResource> statList = new ArrayList<RemoteStatResource>();
+    List<RemoteStatResource> statList = new ArrayList<RemoteStatResource>();
     // get vm-local stats
     // call visitStatistics to fix for bug 40358
     if (statisticsTypeName == null) {
@@ -72,7 +67,6 @@ public class FetchStatsResponse extends AdminResponse {
     return m;
   }
 
-
   @Override
   public boolean sendViaUDP() {
     return true;
@@ -130,7 +124,7 @@ public class FetchStatsResponse extends AdminResponse {
    */
   @Override
   public String toString() {
-    return "FetchStatsResponse from " + this.getRecipient() + " stats.length=" + stats.length;
+    return "FetchStatsResponse from " + getRecipient() + " stats.length=" + stats.length;
   }
 
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java
index fa1288f..33d78ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java
@@ -48,7 +48,7 @@ public class FetchSysCfgRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchSysCfgResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java
index 57d58c1..21b531c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java
@@ -34,8 +34,8 @@ public class FetchSysCfgResponse extends AdminResponse {
    * Returns a <code>FetchSysCfgResponse</code> that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's config.
    */
-  public static FetchSysCfgResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static FetchSysCfgResponse create(DM dm,
+                                           InternalDistributedMember recipient) {
     FetchSysCfgResponse m = new FetchSysCfgResponse();
     m.setRecipient(recipient);
     Config conf = dm.getSystem().getConfig();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java
index 22a5f67..c15d1dc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java
@@ -40,9 +40,10 @@ public class LicenseInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return LicenseInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java
index ba05780..efa2f38 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java
@@ -14,6 +14,12 @@
  */
 package org.apache.geode.internal.admin.remote;
 
+import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
+
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
@@ -26,22 +32,19 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.logging.LogService;
 
-
 /**
  * A message that is sent in response to a {@link LicenseInfoRequest}.
  */
 public class LicenseInfoResponse extends AdminResponse {
   private static final Logger logger = LogService.getLogger();
 
-  // instance variables
   private Properties p;
 
-
   /**
-   * Returns a <code>LicenseInfoResponse</code> that will be returned to the specified recipient.
+   * Returns a {@code LicenseInfoResponse} that will be returned to the specified recipient.
    */
-  public static LicenseInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static LicenseInfoResponse create(DM dm,
+                                           InternalDistributedMember recipient) {
     LicenseInfoResponse m = new LicenseInfoResponse();
     m.setRecipient(recipient);
     m.p = new Properties();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
index 68ac778..e273824 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
@@ -30,7 +30,6 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.persistence.PersistentMemberID;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
@@ -78,7 +77,7 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     Set<PersistentID> missingIds = new HashSet<>();
     Set<PersistentID> localPatterns = new HashSet<>();
     InternalCache cache = dm.getCache();
@@ -124,12 +123,12 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof MissingPersistentIDsResponse) {
-        this.missing.addAll(((MissingPersistentIDsResponse) msg).getMissingIds());
-        this.existing.addAll(((MissingPersistentIDsResponse) msg).getLocalIds());
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof MissingPersistentIDsResponse) {
+        this.missing.addAll(((MissingPersistentIDsResponse) message).getMissingIds());
+        this.existing.addAll(((MissingPersistentIDsResponse) message).getLocalIds());
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java
index 36dba51..110e66b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java
@@ -56,9 +56,10 @@ public class ObjectDetailsRequest extends RegionAdminRequest implements Cancella
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     CancellationRegistry.getInstance().registerMessage(this);
     resp = ObjectDetailsResponse.create(dm, this.getSender());
     if (cancelled) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java
index aeb33e5..f6518f5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java
@@ -38,8 +38,8 @@ public class ObjectDetailsResponse extends AdminResponse implements Cancellable
    * Returns a <code>ObjectValueResponse</code> that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's system config.
    */
-  public static ObjectDetailsResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static ObjectDetailsResponse create(DM dm,
+                                             InternalDistributedMember recipient) {
     ObjectDetailsResponse m = new ObjectDetailsResponse();
     m.setRecipient(recipient);
     return m;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java
index c51cb2b..5366c20 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java
@@ -44,9 +44,10 @@ public class ObjectNamesRequest extends RegionAdminRequest implements Cancellabl
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     CancellationRegistry.getInstance().registerMessage(this);
     resp = ObjectNamesResponse.create(dm, this.getSender());
     if (cancelled) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java
index 3f02d0b..ce61a21 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java
@@ -36,8 +36,8 @@ public class ObjectNamesResponse extends AdminResponse implements Cancellable {
    * Returns a <code>ObjectNamesResponse</code> that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's system config.
    */
-  public static ObjectNamesResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static ObjectNamesResponse create(DM dm,
+                                           InternalDistributedMember recipient) {
     ObjectNamesResponse m = new ObjectNamesResponse();
     m.setRecipient(recipient);
     return m;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
index ac9fdbc..6a84143 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
@@ -27,7 +27,6 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
@@ -90,7 +89,7 @@ public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     if (cache != null && !cache.isClosed()) {
       PersistentMemberManager mm = cache.getPersistentMemberManager();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java
index 0de8b79..5d76bbb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java
@@ -41,7 +41,7 @@ public class RefreshMemberSnapshotRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RefreshMemberSnapshotResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
index 9e973f9..df71ac8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
@@ -22,7 +22,7 @@ import org.apache.geode.DataSerializer;
 import org.apache.geode.admin.GemFireMemberStatus;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 
@@ -38,8 +38,8 @@ public class RefreshMemberSnapshotResponse extends AdminResponse {
    * Returns a {@code FetchSysCfgResponse} that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's config.
    */
-  public static RefreshMemberSnapshotResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RefreshMemberSnapshotResponse create(DM dm,
+                                                     InternalDistributedMember recipient) {
     RefreshMemberSnapshotResponse m = new RefreshMemberSnapshotResponse();
     m.setRecipient(recipient);
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java
index 9cf6d3c..29d0f13 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java
@@ -42,9 +42,10 @@ public class RegionAttributesRequest extends RegionAdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RegionAttributesResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem()));
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java
index f618826..d44edec 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java
@@ -34,8 +34,8 @@ public class RegionAttributesResponse extends AdminResponse {
    * Returns a <code>RegionAttributesResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static RegionAttributesResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Region r) {
+  public static RegionAttributesResponse create(DM dm,
+                                                InternalDistributedMember recipient, Region r) {
     RegionAttributesResponse m = new RegionAttributesResponse();
     m.setRecipient(recipient);
     m.attributes = new RemoteRegionAttributes(r.getAttributes());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java
index ebd176e..1529cd6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java
@@ -111,9 +111,10 @@ public class RegionRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     // nothing needs to be done. If we got this far then a cache must exist.
     return RegionResponse.create(dm, this.getSender(), this);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java
index e444be8..09519a4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java
@@ -48,8 +48,8 @@ public class RegionResponse extends AdminResponse {
    * Returns a <code>RegionResponse</code> that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's system config.
    */
-  public static RegionResponse create(DistributionManager dm, InternalDistributedMember recipient,
-      RegionRequest request) {
+  public static RegionResponse create(DM dm, InternalDistributedMember recipient,
+                                      RegionRequest request) {
     RegionResponse m = new RegionResponse();
 
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java
index 73a5b50..e809cf9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java
@@ -40,9 +40,10 @@ public class RegionSizeRequest extends RegionAdminRequest implements Cancellable
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     Assert.assertTrue(this.getSender() != null);
     CancellationRegistry.getInstance().registerMessage(this);
     resp = RegionSizeResponse.create(dm, this.getSender());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java
index 69fbec4..999a92f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java
@@ -35,8 +35,8 @@ public class RegionSizeResponse extends AdminResponse implements Cancellable {
   /**
    * Returns a <code>RegionSizeResponse</code> that will be returned to the specified recipient.
    */
-  public static RegionSizeResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RegionSizeResponse create(DM dm,
+                                          InternalDistributedMember recipient) {
     RegionSizeResponse m = new RegionSizeResponse();
     m.setRecipient(recipient);
     return m;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java
index 4799b91..e8cc225 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java
@@ -44,7 +44,7 @@ public class RegionStatisticsRequest extends RegionAdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RegionStatisticsResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem()));
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java
index 9197eda..e260bf6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java
@@ -34,8 +34,8 @@ public class RegionStatisticsResponse extends AdminResponse {
    * Returns a <code>RegionStatisticsResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static RegionStatisticsResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Region r) {
+  public static RegionStatisticsResponse create(DM dm,
+                                                InternalDistributedMember recipient, Region r) {
     RegionStatisticsResponse m = new RegionStatisticsResponse();
     m.setRecipient(recipient);
     m.regionStatistics = new RemoteCacheStatistics(r.getStatistics());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java
index 2306bca..13123d9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java
@@ -18,7 +18,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 
 /**
  * Admin request to transfer region info for a member
@@ -38,7 +38,7 @@ public class RegionSubRegionSizeRequest extends AdminRequest implements Cancella
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     CancellationRegistry.getInstance().registerMessage(this);
 
     resp = RegionSubRegionsSizeResponse.create(dm, this.getSender());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
index 5e24f63..2ee08cd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
@@ -26,7 +26,7 @@ import org.apache.geode.admin.RegionSubRegionSnapshot;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
@@ -54,8 +54,7 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
    * Returns a {@code RegionSubRegionsSizeResponse} that will be returned to the specified
    * recipient. The message will contains a copy of the region snapshot
    */
-  public static RegionSubRegionsSizeResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RegionSubRegionsSizeResponse create(DM dm, InternalDistributedMember recipient) {
     RegionSubRegionsSizeResponse m = new RegionSubRegionsSizeResponse();
     m.setRecipient(recipient);
     m.snapshot = null;
@@ -64,7 +63,7 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
     return m;
   }
 
-  void populateSnapshot(DistributionManager dm) {
+  void populateSnapshot(DM dm) {
     if (this.cancelled) {
       return;
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java
index 3a615a5..2225bde 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java
@@ -48,7 +48,7 @@ public class RemoveHealthListenerRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RemoveHealthListenerResponse.create(dm, this.getSender(), this.id);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java
index eeb85b2..c3c825d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java
@@ -33,8 +33,8 @@ public class RemoveHealthListenerResponse extends AdminResponse {
    * Returns a <code>RemoveHealthListenerResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static RemoveHealthListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int id) {
+  public static RemoveHealthListenerResponse create(DM dm,
+                                                    InternalDistributedMember recipient, int id) {
     RemoveHealthListenerResponse m = new RemoveHealthListenerResponse();
     m.setRecipient(recipient);
     dm.removeHealthMonitor(recipient, id);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java
index 709f069..ef2a834 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java
@@ -46,9 +46,10 @@ public class ResetHealthStatusRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return ResetHealthStatusResponse.create(dm, this.getSender(), this.id);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java
index 0659b9c..c622164 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java
@@ -33,8 +33,8 @@ public class ResetHealthStatusResponse extends AdminResponse {
    * Returns a <code>ResetHealthStatusResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static ResetHealthStatusResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int id) {
+  public static ResetHealthStatusResponse create(DM dm,
+                                                 InternalDistributedMember recipient, int id) {
     ResetHealthStatusResponse m = new ResetHealthStatusResponse();
     m.setRecipient(recipient);
     {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
index f425a2b..feb638e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
@@ -26,7 +26,6 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
@@ -74,7 +73,7 @@ public class RevokePersistentIDRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     if (cache != null && !cache.isClosed()) {
       PersistentMemberManager mm = cache.getPersistentMemberManager();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java
index f6332dd..392fe6b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java
@@ -45,7 +45,7 @@ public class RootRegionRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     // nothing needs to be done. If we got this far then a cache must exist.
     return RootRegionResponse.create(dm, this.getSender());
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
index 3dad8f7..beb141d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
@@ -25,8 +25,8 @@ import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.admin.GemFireVM;
 import org.apache.geode.internal.cache.InternalCache;
@@ -43,8 +43,8 @@ public class RootRegionResponse extends AdminResponse {
    * Returns a {@code RootRegionResponse} that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's system config.
    */
-  public static RootRegionResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RootRegionResponse create(DM dm,
+                                          InternalDistributedMember recipient) {
     RootRegionResponse m = new RootRegionResponse();
     try {
       InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
index b7b2c30..3023a37 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
@@ -87,7 +87,7 @@ public class ShutdownAllRequest extends AdminRequest {
           if (logger.isDebugEnabled()) {
             logger.debug("caught exception while processing shutdownAll locally", ex);
           }
-          response = AdminFailureResponse.create(dism, myId, ex);
+          response = AdminFailureResponse.create(myId, ex);
         }
         response.setSender(myId);
         replyProcessor.process(response);
@@ -173,7 +173,7 @@ public class ShutdownAllRequest extends AdminRequest {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     boolean isToShutdown = hasCache();
     if (isToShutdown) {
       boolean isSuccess = false;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java
index f05cf9d..b3c6fd3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java
@@ -50,7 +50,7 @@ public class StoreSysCfgRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return StoreSysCfgResponse.create(dm, this.getSender(), this.sc);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java
index 6cbb08d..b9479e1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java
@@ -35,8 +35,8 @@ public class StoreSysCfgResponse extends AdminResponse {
    * Returns a <code>StoreSysCfgResponse</code> that states that a given set of distribution
    * managers are known by <code>dm</code> to be started.
    */
-  public static StoreSysCfgResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Config sc) {
+  public static StoreSysCfgResponse create(DM dm,
+                                           InternalDistributedMember recipient, Config sc) {
     StoreSysCfgResponse m = new StoreSysCfgResponse();
     m.setRecipient(recipient);
     InternalDistributedSystem sys = dm.getSystem();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java
index 6641941..e473aee 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java
@@ -42,9 +42,10 @@ public class SubRegionRequest extends RegionAdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return SubRegionResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem()));
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java
index 513a1fe..7edb84b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java
@@ -37,8 +37,8 @@ public class SubRegionResponse extends AdminResponse {
    * Returns a <code>SubRegionResponse</code> that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's system config.
    */
-  public static SubRegionResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Region r) {
+  public static SubRegionResponse create(DM dm,
+                                         InternalDistributedMember recipient, Region r) {
     SubRegionResponse m = new SubRegionResponse();
     m.setRecipient(recipient);
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java
index e79b99c..d911b08 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java
@@ -28,7 +28,7 @@ public class TailLogRequest extends AdminRequest {
   }
 
   @Override
-  public AdminResponse createResponse(DistributionManager dm) {
+  public AdminResponse createResponse(DM dm) {
     return TailLogResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java
index 137c8ba..4f3602a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java
@@ -21,8 +21,8 @@ import java.io.*;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -38,8 +38,8 @@ public class TailLogResponse extends AdminResponse {
   private String tail;
   private String childTail;
 
-  public static TailLogResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static TailLogResponse create(DM dm,
+                                       InternalDistributedMember recipient) {
     TailLogResponse m = new TailLogResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java
index db4fa42..5ea387b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java
@@ -42,9 +42,10 @@ public class VersionInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return VersionInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java
index e8a87ed..21b21a4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java
@@ -36,8 +36,8 @@ public class VersionInfoResponse extends AdminResponse {
   /**
    * Returns a <code>VersionInfoResponse</code> that will be returned to the specified recipient.
    */
-  public static VersionInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static VersionInfoResponse create(DM dm,
+                                           InternalDistributedMember recipient) {
     VersionInfoResponse m = new VersionInfoResponse();
     m.setRecipient(recipient);
     m.verInfo = GemFireVersion.asString();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java
index 1c130bf..23f075d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.internal.cache;
 
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -21,54 +22,68 @@ import java.util.concurrent.locks.ReentrantLock;
  * A lock used for the backup process. This is a reentrant lock that provides a "backup" mode, where
  * the lock is held by a "backup thread" which can be assigned later than the time we lock.
  *
- * We need this because our backup process is two phase. In the first phase we aquire the lock and
+ * <p>
+ * We need this because our backup process is two phase. In the first phase we acquire the lock and
  * in the second phase we actually do the backup. During the second phase we need to reenter the
  * lock and release it with a different thread.
- *
  */
 public class BackupLock extends ReentrantLock {
 
-  private final ThreadLocal<Boolean> isBackupThread = new ThreadLocal<Boolean>();
-  boolean isBackingUp;
-  Condition backupDone = super.newCondition();
+  private final ThreadLocal<Boolean> isBackupThread = new ThreadLocal<>();
+  private boolean isBackingUp;
+  private Condition backupDone = super.newCondition();
 
   // test hook
-  private BackupLockTestHook hook = null;
+  private final AtomicReference<BackupLockTestHook> hook = new AtomicReference<>();
 
   public interface BackupLockTestHook {
     /**
      * Test hook called before the wait for backup to complete
      */
-    public void beforeWaitForBackupCompletion();
+    void beforeWaitForBackupCompletion();
   }
 
   public void setBackupLockTestHook(BackupLockTestHook testHook) {
-    hook = testHook;
+    hook.set(testHook);
   }
 
-  public void lockForBackup() {
+  void lockForBackup() {
     super.lock();
     isBackingUp = true;
     super.unlock();
   }
 
-  public void setBackupThread() {
+  void setBackupThread() {
     isBackupThread.set(true);
   }
 
-  public void unlockForBackup() {
+  void unlockForBackup() {
     super.lock();
     isBackingUp = false;
-    isBackupThread.set(false);
+    isBackupThread.remove();
     backupDone.signalAll();
     super.unlock();
   }
 
-  public boolean isCurrentThreadDoingBackup() {
+  boolean isCurrentThreadDoingBackup() {
     Boolean result = isBackupThread.get();
     return (result != null) && result;
   }
 
+  /**
+   * For testing only
+   */
+  boolean isBackingUp() {
+    return isBackingUp;
+  }
+
+  /**
+   * For testing only
+   */
+  boolean hasThreadLocal() {
+    return isBackupThread.get() != null;
+  }
+
   @Override
   public void unlock() {
     // The backup thread does not need to unlock this lock since it never gets the lock. It is the
@@ -80,7 +95,6 @@ public class BackupLock extends ReentrantLock {
 
   /**
    * Acquire this lock, waiting for a backup to finish the first phase.
-   *
    */
   @Override
   public void lock() {
@@ -89,8 +103,9 @@ public class BackupLock extends ReentrantLock {
     if (!isCurrentThreadDoingBackup()) {
       super.lock();
       while (isBackingUp) {
-        if (hook != null) {
-          hook.beforeWaitForBackupCompletion();
+        BackupLockTestHook testHook = hook.get();
+        if (testHook != null) {
+          testHook.beforeWaitForBackupCompletion();
         }
         backupDone.awaitUninterruptibly();
       }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java
index 70a4345..a35bb8b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java
@@ -354,18 +354,16 @@ public class BackupManager implements MembershipListener {
           diskStore.getPersistentOplogSet().forceRoll(null);
 
           if (logger.isDebugEnabled()) {
-            logger.debug("done snaphotting for disk store {}", diskStore.getName());
+            logger.debug("done backing up disk store {}", diskStore.getName());
           }
           break;
         }
       }
       done = true;
     } finally {
-      if (!done) {
-        if (backup != null) {
-          backupByDiskStore.remove(diskStore);
-          backup.cleanup();
-        }
+      if (!done && backup != null) {
+        backupByDiskStore.remove(diskStore);
+        backup.cleanup();
       }
     }
     return backup;
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 e0f6173..201ad85 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
@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.persistence.RevokedPersistentDataException;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.MembershipListener;
 import org.apache.geode.distributed.internal.ProfileListener;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -164,8 +164,8 @@ public class PersistentMemberManager {
    * @return true if this member is not currently running the chosen disk store. false if the revoke
    *         should be aborted because the disk store is already running.
    */
-  public boolean prepareRevoke(PersistentMemberPattern pattern, DistributionManager dm,
-      InternalDistributedMember sender) {
+  public boolean prepareRevoke(PersistentMemberPattern pattern, DM dm,
+                               InternalDistributedMember sender) {
     if (logger.isDebugEnabled()) {
       logger.debug("Preparing revoke if pattern {}", pattern);
     }
@@ -232,10 +232,10 @@ public class PersistentMemberManager {
   public class PendingRevokeListener implements MembershipListener {
     InternalDistributedMember sender;
     private PersistentMemberPattern pattern;
-    private DistributionManager dm;
+    private DM dm;
 
     public PendingRevokeListener(PersistentMemberPattern pattern, InternalDistributedMember sender,
-        DistributionManager dm) {
+                                 DM dm) {
       this.dm = dm;
       this.pattern = pattern;
       this.sender = sender;
diff --git a/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java b/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java
index 9ac5b50..fb78607 100644
--- a/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java
+++ b/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java
@@ -19,14 +19,11 @@ import java.util.Set;
 
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.internal.cache.BackupUtil;
 
 /**
- * The status of a backup operation, returned by
- * {@link BackupUtil#backupAllMembers(DM, java.io.File,java.io.File)}.
+ * The status of a backup operation.
  *
- * @since GemFire 6.5
+ * @since Geode 1.4
  */
 public interface BackupStatus {
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java
index 2b22d27..72cb1d8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java
@@ -95,7 +95,7 @@ public class CompactRequest extends AdminRequest {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     PersistentID compactedDiskStore = compactDiskStore(this.diskStoreName);
 
     return new CompactResponse(this.getSender(), compactedDiskStore);
@@ -159,14 +159,14 @@ public class CompactRequest extends AdminRequest {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof CompactResponse) {
-        final PersistentID persistentId = ((CompactResponse) msg).getPersistentId();
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof CompactResponse) {
+        final PersistentID persistentId = ((CompactResponse) message).getPersistentId();
         if (persistentId != null) {
-          results.put(msg.getSender(), persistentId);
+          results.put(message.getSender(), persistentId);
         }
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/admin/internal/FinishBackupRequestTest.java b/geode-core/src/test/java/org/apache/geode/admin/internal/FinishBackupRequestTest.java
new file mode 100644
index 0000000..492fd44
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/admin/internal/FinishBackupRequestTest.java
@@ -0,0 +1,210 @@
+/*
+ * 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.admin.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.InOrder;
+
+import org.apache.geode.admin.internal.FinishBackupRequest.FinishBackupReplyProcessor;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.cache.BackupManager;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FinishBackupRequestTest {
+
+  private FinishBackupRequest finishBackupRequest;
+
+  private FinishBackupReplyProcessor replyProcessor;
+  private DM dm;
+  private InternalCache cache;
+  private BackupManager backupManager;
+  private File targetDir;
+  private File baselineDir;
+
+  private InternalDistributedMember localMember;
+  private InternalDistributedMember member1;
+  private InternalDistributedMember member2;
+
+  private Set<InternalDistributedMember> recipients;
+
+  @Before
+  public void setUp() throws Exception {
+    // mocks here
+    replyProcessor = mock(FinishBackupReplyProcessor.class);
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+    backupManager = mock(BackupManager.class);
+    targetDir = mock(File.class);
+    baselineDir = mock(File.class);
+
+    when(dm.getCache()).thenReturn(cache);
+    when(dm.getDistributionManagerId()).thenReturn(localMember);
+    when(cache.getBackupManager()).thenReturn(backupManager);
+    when(replyProcessor.getResults()).thenReturn(Collections.emptyMap());
+
+    localMember = mock(InternalDistributedMember.class);
+    member1 = mock(InternalDistributedMember.class);
+    member2 = mock(InternalDistributedMember.class);
+
+    recipients = new HashSet<>();
+    recipients.add(member1);
+    recipients.add(member2);
+
+    finishBackupRequest = new FinishBackupRequest(dm, recipients, replyProcessor, targetDir, baselineDir, false);
+  }
+
+  @Test
+  public void getRecipientsReturnsRecipientMembers() throws Exception {
+    assertThat(finishBackupRequest.getRecipients()).hasSize(2).contains(member1, member2);
+  }
+
+  @Test
+  public void getRecipientsDoesNotIncludeNull() throws Exception {
+    InternalDistributedMember nullMember = null;
+
+    assertThat(finishBackupRequest.getRecipients()).doesNotContain(nullMember);
+  }
+
+  @Test
+  public void sendShouldUseDMToSendMessage() throws Exception {
+    finishBackupRequest.send();
+
+    verify(dm, times(1)).putOutgoing(finishBackupRequest);
+  }
+
+  @Test
+  public void sendShouldWaitForRepliesFromRecipients() throws Exception {
+    finishBackupRequest.send();
+
+    verify(replyProcessor, times(1)).waitForReplies();
+  }
+
+  @Test
+  public void sendShouldReturnResultsContainingRecipientsAndLocalMember() throws Exception {
+    Set<PersistentID> localMember_PersistentIdSet = new HashSet<>();
+    localMember_PersistentIdSet.add(mock(PersistentID.class));
+    Set<PersistentID> member1_PersistentIdSet = new HashSet<>();
+    member1_PersistentIdSet.add(mock(PersistentID.class));
+    Set<PersistentID> member2_PersistentIdSet = new HashSet<>();
+    member2_PersistentIdSet.add(mock(PersistentID.class));
+    member2_PersistentIdSet.add(mock(PersistentID.class));
+    Map<DistributedMember, Set<PersistentID>> expectedResults = new HashMap<>();
+    expectedResults.put(localMember, localMember_PersistentIdSet);
+    expectedResults.put(member1, member1_PersistentIdSet);
+    expectedResults.put(member2, member2_PersistentIdSet);
+    when(replyProcessor.getResults()).thenReturn(expectedResults);
+
+    Map<DistributedMember, Set<PersistentID>> results = finishBackupRequest.send();
+
+    assertThat(results).isEqualTo(expectedResults);
+  }
+
+  @Test
+  public void sendShouldInvokeProcessLocally() throws Exception {
+    finishBackupRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(AdminResponse.class));
+  }
+
+  @Test
+  public void sendShouldInvokeDoBackupLocally() throws Exception {
+    finishBackupRequest.send();
+
+    verify(backupManager, times(1)).doBackup(targetDir, baselineDir, false);
+  }
+
+  /**
+   * Confirms fix for GEODE-3940: Backup can hang while trying to get a lock
+   */
+  @Test
+  public void sendShouldDoBackupInLocalMemberBeforeWaitingForReplies() throws Exception {
+    InOrder inOrder = inOrder(backupManager, replyProcessor);
+
+    finishBackupRequest.send();
+
+    // assert that doBackup which releases BackupLock is invoked before invoking waitForReplies
+    inOrder.verify(backupManager, times(1)).doBackup(targetDir, baselineDir, false);
+    inOrder.verify(replyProcessor, times(1)).waitForReplies();
+  }
+
+  @Test
+  public void repliesWithFinishBackupResponse() throws Exception {
+    finishBackupRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(FinishBackupResponse.class));
+  }
+
+  @Test
+  public void repliesWithAdminFailureResponseWhenDoBackupThrowsIOException() throws Exception {
+    when(backupManager.doBackup(targetDir, baselineDir, false)).thenThrow(new IOException());
+
+    finishBackupRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(AdminFailureResponse.class));
+  }
+
+  @Test
+  public void sendShouldCompleteIfWaitForRepliesThrowsReplyExceptionCausedByCacheClosedException() throws Exception {
+    doThrow(new ReplyException(new CacheClosedException())).when(replyProcessor).waitForReplies();
+
+    finishBackupRequest.send();
+  }
+
+  @Test
+  public void sendShouldThrowIfWaitForRepliesThrowsReplyExceptionNotCausedByCacheClosedException() throws Exception {
+    doThrow(new ReplyException(new NullPointerException())).when(replyProcessor).waitForReplies();
+
+    assertThatThrownBy(() -> finishBackupRequest.send())
+        .isInstanceOf(ReplyException.class)
+        .hasCauseInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void sendCompletesWhenWaitForRepliesThrowsInterruptedException() throws Exception {
+    doThrow(new InterruptedException()).when(replyProcessor).waitForReplies();
+
+    finishBackupRequest.send();
+  }
+
+}
diff --git a/geode-core/src/test/java/org/apache/geode/admin/internal/FlushToDiskRequestTest.java b/geode-core/src/test/java/org/apache/geode/admin/internal/FlushToDiskRequestTest.java
new file mode 100644
index 0000000..277db59
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/admin/internal/FlushToDiskRequestTest.java
@@ -0,0 +1,177 @@
+/*
+ * 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.admin.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.InOrder;
+
+import org.apache.geode.admin.internal.FlushToDiskRequest.FlushToDiskProcessor;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.DiskStore;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FlushToDiskRequestTest {
+
+  private FlushToDiskRequest flushToDiskRequest;
+
+  private FlushToDiskProcessor replyProcessor;
+  private DM dm;
+  private InternalCache cache;
+
+  private DiskStore diskStore1;
+  private DiskStore diskStore2;
+  private Collection<DiskStore> diskStoreCollection;
+
+  private InternalDistributedMember localMember;
+  private InternalDistributedMember member1;
+  private InternalDistributedMember member2;
+
+  private Set<InternalDistributedMember> recipients;
+
+  @Before
+  public void setUp() throws Exception {
+    // mocks here
+    replyProcessor = mock(FlushToDiskProcessor.class);
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+    diskStore1 = mock(DiskStore.class);
+    diskStore2 = mock(DiskStore.class);
+
+    diskStoreCollection = new ArrayList<>();
+    diskStoreCollection.add(diskStore1);
+    diskStoreCollection.add(diskStore2);
+
+    when(dm.getCache()).thenReturn(cache);
+    when(dm.getDistributionManagerId()).thenReturn(localMember);
+    when(cache.listDiskStoresIncludingRegionOwned()).thenReturn(diskStoreCollection);
+
+    localMember = mock(InternalDistributedMember.class);
+    member1 = mock(InternalDistributedMember.class);
+    member2 = mock(InternalDistributedMember.class);
+
+    recipients = new HashSet<>();
+    recipients.add(member1);
+    recipients.add(member2);
+
+    flushToDiskRequest = new FlushToDiskRequest(dm, recipients, replyProcessor);
+  }
+
+  @Test
+  public void getRecipientsReturnsRecipientMembers() throws Exception {
+    assertThat(flushToDiskRequest.getRecipients()).hasSize(2).contains(member1, member2);
+  }
+
+  @Test
+  public void getRecipientsDoesNotIncludeNull() throws Exception {
+    InternalDistributedMember nullMember = null;
+
+    assertThat(flushToDiskRequest.getRecipients()).doesNotContain(nullMember);
+  }
+
+  @Test
+  public void sendShouldUseDMToSendMessage() throws Exception {
+    flushToDiskRequest.send();
+
+    verify(dm, times(1)).putOutgoing(flushToDiskRequest);
+  }
+
+  @Test
+  public void sendShouldWaitForRepliesFromRecipients() throws Exception {
+    flushToDiskRequest.send();
+
+    verify(replyProcessor, times(1)).waitForReplies();
+  }
+
+  @Test
+  public void sendShouldInvokeProcessLocally() throws Exception {
+    flushToDiskRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(AdminResponse.class));
+  }
+
+  @Test
+  public void sendShouldFlushDiskStores() throws Exception {
+    flushToDiskRequest.send();
+
+    verify(diskStore1, times(1)).flush();
+    verify(diskStore2, times(1)).flush();
+  }
+
+  @Test
+  public void sendShouldFlushDiskStoresInLocalMemberBeforeWaitingForReplies() throws Exception {
+    InOrder inOrder = inOrder(diskStore1, diskStore2, replyProcessor);
+
+    flushToDiskRequest.send();
+
+    // assert that prepareForBackup is invoked before invoking waitForReplies
+    inOrder.verify(diskStore1, times(1)).flush();
+    inOrder.verify(diskStore2, times(1)).flush();
+    inOrder.verify(replyProcessor, times(1)).waitForReplies();
+  }
+
+  @Test
+  public void repliesWithFinishBackupResponse() throws Exception {
+    flushToDiskRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(FlushToDiskResponse.class));
+  }
+
+  @Test
+  public void sendShouldCompleteIfWaitForRepliesThrowsReplyExceptionCausedByCacheClosedException() throws Exception {
+    doThrow(new ReplyException(new CacheClosedException())).when(replyProcessor).waitForReplies();
+
+    flushToDiskRequest.send();
+  }
+
+  @Test
+  public void sendShouldThrowIfWaitForRepliesThrowsReplyExceptionNotCausedByCancelException() throws Exception {
+    doThrow(new ReplyException(new NullPointerException())).when(replyProcessor).waitForReplies();
+
+    assertThatThrownBy(() -> flushToDiskRequest.send())
+        .isInstanceOf(ReplyException.class)
+        .hasCauseInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void sendCompletesWhenWaitForRepliesThrowsInterruptedException() throws Exception {
+    doThrow(new InterruptedException()).when(replyProcessor).waitForReplies();
+
+    flushToDiskRequest.send();
+  }
+
+}
\ No newline at end of file
diff --git a/geode-core/src/test/java/org/apache/geode/admin/internal/PrepareBackupRequestTest.java b/geode-core/src/test/java/org/apache/geode/admin/internal/PrepareBackupRequestTest.java
new file mode 100644
index 0000000..c8fd60f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/admin/internal/PrepareBackupRequestTest.java
@@ -0,0 +1,206 @@
+/*
+ * 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.admin.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.CALLS_REAL_METHODS;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.InOrder;
+
+import org.apache.geode.admin.internal.PrepareBackupRequest.PrepareBackupReplyProcessor;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.cache.BackupManager;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class PrepareBackupRequestTest {
+  
+  private PrepareBackupRequest prepareBackupRequest;
+
+  private PrepareBackupReplyProcessor replyProcessor;
+  private DM dm;
+  private InternalCache cache;
+  private BackupManager backupManager;
+
+  private InternalDistributedMember localMember;
+  private InternalDistributedMember member1;
+  private InternalDistributedMember member2;
+
+  private Set<InternalDistributedMember> recipients;
+
+  @Before
+  public void setUp() throws Exception {
+    // mocks here
+    replyProcessor = mock(PrepareBackupReplyProcessor.class);
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+    backupManager = mock(BackupManager.class);
+
+    when(dm.getCache()).thenReturn(cache);
+    when(dm.getDistributionManagerId()).thenReturn(localMember);
+    when(cache.startBackup(any())).thenReturn(backupManager);
+    when(replyProcessor.getResults()).thenReturn(Collections.emptyMap());
+
+    localMember = mock(InternalDistributedMember.class);
+    member1 = mock(InternalDistributedMember.class);
+    member2 = mock(InternalDistributedMember.class);
+
+    recipients = new HashSet<>();
+    recipients.add(member1);
+    recipients.add(member2);
+
+    prepareBackupRequest = new PrepareBackupRequest(dm, recipients, replyProcessor);
+  }
+
+  @Test
+  public void getRecipientsReturnsRecipientMembers() throws Exception {
+    assertThat(prepareBackupRequest.getRecipients()).hasSize(2).contains(member1, member2);
+  }
+
+  @Test
+  public void getRecipientsDoesNotIncludeNull() throws Exception {
+    InternalDistributedMember nullMember = null;
+
+    assertThat(prepareBackupRequest.getRecipients()).doesNotContain(nullMember);
+  }
+
+  @Test
+  public void sendShouldUseDMToSendMessage() throws Exception {
+    prepareBackupRequest.send();
+
+    verify(dm, times(1)).putOutgoing(prepareBackupRequest);
+  }
+
+  @Test
+  public void sendShouldWaitForRepliesFromRecipients() throws Exception {
+    prepareBackupRequest.send();
+
+    verify(replyProcessor, times(1)).waitForReplies();
+  }
+
+  @Test
+  public void sendShouldReturnResultsContainingRecipientsAndLocalMember() throws Exception {
+    Set<PersistentID> localMember_PersistentIdSet = new HashSet<>();
+    localMember_PersistentIdSet.add(mock(PersistentID.class));
+    Set<PersistentID> member1_PersistentIdSet = new HashSet<>();
+    member1_PersistentIdSet.add(mock(PersistentID.class));
+    Set<PersistentID> member2_PersistentIdSet = new HashSet<>();
+    member2_PersistentIdSet.add(mock(PersistentID.class));
+    member2_PersistentIdSet.add(mock(PersistentID.class));
+    Map<DistributedMember, Set<PersistentID>> expectedResults = new HashMap<>();
+    expectedResults.put(localMember, localMember_PersistentIdSet);
+    expectedResults.put(member1, member1_PersistentIdSet);
+    expectedResults.put(member2, member2_PersistentIdSet);
+    when(replyProcessor.getResults()).thenReturn(expectedResults);
+
+    Map<DistributedMember, Set<PersistentID>> results = prepareBackupRequest.send();
+
+    assertThat(results).isEqualTo(expectedResults);
+  }
+
+  @Test
+  public void sendShouldInvokeProcessLocally() throws Exception {
+    prepareBackupRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(AdminResponse.class));
+  }
+
+  @Test
+  public void sendShouldInvokePrepareForBackup() throws Exception {
+    prepareBackupRequest.send();
+
+    verify(backupManager, times(1)).prepareForBackup();
+  }
+
+  @Test
+  public void sendShouldPrepareForBackupInLocalMemberBeforeWaitingForReplies() throws Exception {
+    InOrder inOrder = inOrder(backupManager, replyProcessor);
+
+    prepareBackupRequest.send();
+
+    // assert that prepareForBackup is invoked before invoking waitForReplies
+    inOrder.verify(backupManager, times(1)).prepareForBackup();
+    inOrder.verify(replyProcessor, times(1)).waitForReplies();
+  }
+
+  @Test
+  public void repliesWithFinishBackupResponse() throws Exception {
+    prepareBackupRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(PrepareBackupResponse.class));
+  }
+
+  @Test
+  public void repliesWithAdminFailureResponseWhenPrepareForBackupThrowsIOException() throws Exception {
+    prepareBackupRequest = spy(prepareBackupRequest);
+    doThrow(new IOException()).when(prepareBackupRequest).prepareForBackup();
+
+    prepareBackupRequest.send();
+
+    verify(replyProcessor, times(1)).process(any(AdminFailureResponse.class));
+  }
+
+  @Test
+  public void sendShouldCompleteIfWaitForRepliesThrowsReplyExceptionCausedByCacheClosedException() throws Exception {
+    doThrow(new ReplyException(new CacheClosedException())).when(replyProcessor).waitForReplies();
+
+    prepareBackupRequest.send();
+  }
+
+  @Test
+  public void sendShouldThrowIfWaitForRepliesThrowsReplyExceptionNotCausedByCacheClosedException() throws Exception {
+    doThrow(new ReplyException(new NullPointerException())).when(replyProcessor).waitForReplies();
+
+    assertThatThrownBy(() -> prepareBackupRequest.send())
+        .isInstanceOf(ReplyException.class)
+        .hasCauseInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void sendCompletesWhenWaitForRepliesThrowsInterruptedException() throws Exception {
+    doThrow(new InterruptedException()).when(replyProcessor).waitForReplies();
+
+    prepareBackupRequest.send();
+  }
+
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java
index 9c45e2d..5d0cce9 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java
@@ -341,7 +341,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
           DistributionMessageObserver.setInstance(null);
           IOException exception = new IOException("Backup in progess");
           AdminFailureResponse response =
-              AdminFailureResponse.create(dm, message.getSender(), exception);
+              AdminFailureResponse.create(message.getSender(), exception);
           response.setMsgId(((PrepareBackupRequest) message).getMsgId());
           dm.putOutgoing(response);
           throw new RuntimeException("Stop processing");
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupLockTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupLockTest.java
new file mode 100644
index 0000000..9c5282a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupLockTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.internal.cache;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.awaitility.Awaitility.await;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class BackupLockTest {
+
+  private BackupLock backupLock;
+  private ExecutorService executor;
+
+  @Before
+  public void setUp() throws Exception {
+    backupLock = new BackupLock();
+    executor = Executors.newSingleThreadExecutor();
+  }
+
+  // BackupLock does not protect from multiple threads calling lockForBackup
+  public void onlyOneThreadCanLockForBackupAndSetBackupThread() throws Exception {
+    // problem #1: two threads can can lockForBackup without invoking unlockForBackup
+    // problem #2: lockForBackup and setBackupThread should be one call
+
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    Future<Boolean> future = executor.submit(() -> {
+      backupLock.lockForBackup();
+      backupLock.setBackupThread();
+      return true;
+    });
+
+    assertThatThrownBy(() -> future.get(5, SECONDS)).isInstanceOf(TimeoutException.class);
+  }
+
+  @Test
+  public void lockShouldBlockUntilLockForBackup() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    AtomicBoolean beforeLock = new AtomicBoolean();
+    AtomicBoolean afterLock = new AtomicBoolean();
+
+    backupLock.setBackupLockTestHook(() -> beforeLock.set(true));
+
+    executor.submit(() -> {
+      backupLock.lock(); // beforeLock is set inside lock() method
+      afterLock.set(true);
+    });
+
+    await().atMost(10, SECONDS).until(() -> assertThat(beforeLock).isTrue());
+    assertThat(afterLock).isFalse();
+
+    backupLock.unlockForBackup();
+    await().atMost(10, SECONDS).until(() -> assertThat(afterLock).isTrue());
+  }
+
+  @Test
+  public void otherThreadShouldBeAbleToUnlockForBackup() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    await().atMost(10, SECONDS).until(() -> assertThat(backupLock.isBackingUp()).isTrue());
+    assertThat(backupLock.isCurrentThreadDoingBackup()).isTrue();
+
+    executor.submit(() -> {
+      assertThat(backupLock.isCurrentThreadDoingBackup()).isFalse();
+      backupLock.unlockForBackup();
+    });
+
+    await().atMost(10, SECONDS).until(() -> assertThat(backupLock.isBackingUp()).isFalse());
+  }
+
+  @Test
+  public void isCurrentThreadDoingBackupShouldBeSetAndUnset() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    assertThat(backupLock.isCurrentThreadDoingBackup()).isTrue();
+
+    backupLock.unlockForBackup();
+
+    assertThat(backupLock.isCurrentThreadDoingBackup()).isFalse();
+  }
+
+  @Test
+  public void threadLocalShouldNotLeak() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    assertThat(backupLock.hasThreadLocal()).isTrue();
+
+    backupLock.unlockForBackup();
+
+    assertThat(backupLock.hasThreadLocal()).isFalse();
+  }
+
+}
\ No newline at end of file

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

Mime
View raw message