geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [17/49] geode git commit: GEODE-2632: change dependencies on GemFireCacheImpl to InternalCache
Date Mon, 08 May 2017 23:05:53 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
index ca9cc20..7879538 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/QueueRemovalMessage.java
@@ -33,6 +33,7 @@ import org.apache.geode.distributed.internal.PooledDistributionMessage;
 import org.apache.geode.internal.cache.EventID;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.HARegion;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
@@ -42,34 +43,17 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
  * This message is sent to all the nodes in the DistributedSystem. It contains the list of messages
  * that have been dispatched by this node. The messages are received by other nodes and the
  * processing is handed over to an executor
- * 
- * 
  */
 public final class QueueRemovalMessage extends PooledDistributionMessage {
   private static final Logger logger = LogService.getLogger();
 
-  // /**
-  // * Executor for processing incoming messages
-  // */
-  // private static final Executor executor;
-
-
   /**
    * List of messages (String[] )
    */
   private List messagesList;
 
-  // /**
-  // * create the executor in a static block
-  // */
-  // static {
-  // //TODO:Mitul best implementation of executor for this task?
-  // executor = Executors.newCachedThreadPool();
-  // }
-
   /**
    * Constructor : Set the recipient list to ALL_RECIPIENTS
-   * 
    */
   public QueueRemovalMessage() {
     this.setRecipient(ALL_RECIPIENTS);
@@ -77,8 +61,6 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
 
   /**
    * Set the message list
-   * 
-   * @param messages
    */
   public void setMessagesList(List messages) {
     this.messagesList = messages;
@@ -87,22 +69,19 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
   /**
    * Extracts the region from the message list and hands over the message removal task to the
    * executor
-   * 
-   * @param dm
    */
   @Override
   protected void process(DistributionManager dm) {
-
-    final GemFireCacheImpl cache;
+    final InternalCache cache;
     // use GemFireCache.getInstance to avoid blocking during cache.xml processing.
-    cache = GemFireCacheImpl.getInstance(); // CacheFactory.getAnyInstance();
+    cache = GemFireCacheImpl.getInstance();
     if (cache != null) {
       Iterator iterator = this.messagesList.iterator();
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
         while (iterator.hasNext()) {
           final String regionName = (String) iterator.next();
-          final int size = ((Integer) iterator.next()).intValue();
+          final int size = (Integer) iterator.next();
           final LocalRegion region = (LocalRegion) cache.getRegion(regionName);
           final HARegionQueue hrq;
           if (region == null || !region.isInitialized()) {
@@ -134,21 +113,21 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
                       regionName, id);
                 }
                 hrq.removeDispatchedEvents(id);
-              } catch (RegionDestroyedException rde) {
+              } catch (RegionDestroyedException ignore) {
                 logger.info(LocalizedMessage.create(
                     LocalizedStrings.QueueRemovalMessage_QUEUE_FOUND_DESTROYED_WHILE_PROCESSING_THE_LAST_DISPTACHED_SEQUENCE_ID_FOR_A_HAREGIONQUEUES_DACE_THE_EVENT_ID_IS_0_FOR_HAREGION_WITH_NAME_1,
                     new Object[] {id, regionName}));
-              } catch (CancelException e) {
+              } catch (CancelException ignore) {
                 return; // cache or DS is closing
               } catch (CacheException e) {
                 logger.error(LocalizedMessage.create(
                     LocalizedStrings.QueueRemovalMessage_QUEUEREMOVALMESSAGEPROCESSEXCEPTION_IN_PROCESSING_THE_LAST_DISPTACHED_SEQUENCE_ID_FOR_A_HAREGIONQUEUES_DACE_THE_PROBLEM_IS_WITH_EVENT_ID__0_FOR_HAREGION_WITH_NAME_1,
                     new Object[] {regionName, id}), e);
-              } catch (InterruptedException ie) {
+              } catch (InterruptedException ignore) {
                 return; // interrupt occurs during shutdown. this runs in an executor, so just stop
                         // processing
               }
-            } catch (RejectedExecutionException e) {
+            } catch (RejectedExecutionException ignore) {
               interrupted = true;
             } finally {
               if (interrupted) {
@@ -165,14 +144,13 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
 
   @Override
   public void toData(DataOutput out) throws IOException {
-    /**
+    /*
      * first write the total list size then in a loop write the region name, number of eventIds and
      * the event ids
-     * 
      */
     super.toData(out);
     // write the size of the data list
-    DataSerializer.writeInteger(Integer.valueOf(this.messagesList.size()), out);
+    DataSerializer.writeInteger(this.messagesList.size(), out);
     Iterator iterator = messagesList.iterator();
     String regionName = null;
     Integer numberOfIds = null;
@@ -185,7 +163,7 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
       numberOfIds = (Integer) iterator.next();
       // write the number of event ids
       DataSerializer.writeInteger(numberOfIds, out);
-      maxVal = numberOfIds.intValue();
+      maxVal = numberOfIds;
       // write the event ids
       for (int i = 0; i < maxVal; i++) {
         eventId = iterator.next();
@@ -200,14 +178,13 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
 
   @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    /**
+    /*
      * read the total list size, reconstruct the message list in a loop by reading the region name,
      * number of eventIds and the event ids
-     * 
      */
     super.fromData(in);
     // read the size of the message
-    int size = DataSerializer.readInteger(in).intValue();
+    int size = DataSerializer.readInteger(in);
     this.messagesList = new LinkedList();
     int eventIdSizeInt;
     for (int i = 0; i < size; i++) {
@@ -216,7 +193,7 @@ public final class QueueRemovalMessage extends PooledDistributionMessage {
       // read the datasize
       Integer eventIdSize = DataSerializer.readInteger(in);
       this.messagesList.add(eventIdSize);
-      eventIdSizeInt = eventIdSize.intValue();
+      eventIdSizeInt = eventIdSize;
       // read the total number of events
       for (int j = 0; j < eventIdSizeInt; j++) {
         this.messagesList.add(DataSerializer.readObject(in));

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapEvictor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapEvictor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapEvictor.java
index 707b408..2ff6ed6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapEvictor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapEvictor.java
@@ -87,7 +87,7 @@ public class HeapEvictor implements ResourceListener<MemoryEvent> {
 
   private AtomicBoolean mustEvict = new AtomicBoolean(false);
 
-  protected final Cache cache;
+  protected final InternalCache cache;
 
   private final ArrayList<Integer> testTaskSetSizes = new ArrayList<>();
   public volatile int testAbortAfterLoopCount = Integer.MAX_VALUE;
@@ -96,7 +96,7 @@ public class HeapEvictor implements ResourceListener<MemoryEvent> {
 
   private final AtomicBoolean isRunning = new AtomicBoolean(true);
 
-  public HeapEvictor(Cache gemFireCache) {
+  public HeapEvictor(InternalCache gemFireCache) {
     this.cache = gemFireCache;
     initializeEvictorThreadPool();
   }
@@ -169,8 +169,8 @@ public class HeapEvictor implements ResourceListener<MemoryEvent> {
     return allRegionList;
   }
 
-  public GemFireCacheImpl getGemFireCache() {
-    return (GemFireCacheImpl) this.cache;
+  public InternalCache getGemFireCache() {
+    return (InternalCache) this.cache;
   }
 
   private void initializeEvictorThreadPool() {

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
index 2fd42f5..fdf694b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
@@ -14,6 +14,8 @@
  */
 package org.apache.geode.internal.cache.lru;
 
+import java.util.Properties;
+
 import org.apache.geode.StatisticDescriptor;
 import org.apache.geode.StatisticsFactory;
 import org.apache.geode.StatisticsType;
@@ -23,21 +25,20 @@ import org.apache.geode.cache.EvictionAlgorithm;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.util.ObjectSizer;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
-import org.apache.geode.internal.cache.*;
+import org.apache.geode.internal.cache.BucketRegion;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.Token;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.i18n.LocalizedStrings;
-
-import java.util.Properties;
+import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
 
 /**
  * A <code>HeapLRUCapacityController</code> controls the contents of {@link Region} based on the
  * percentage of memory that is currently being used. If the percentage of memory in use exceeds the
  * given percentage, then the least recently used entry of the region is evicted.
- * 
- * <P>
- * 
+ * <p>
  * For heap regions: GemStone has found that the <code>HeapLRUCapacityController</code> has the most
  * effect on a VM that is lauched with both the <code>-Xmx</code> and <code>-Xms</code> switches
  * used. Many virtual machine implementations have additional VM switches to control the behavior of
@@ -46,8 +47,7 @@ import java.util.Properties;
  * <A href="http://java.sun.com/docs/hotspot/gc/index.html">HotSpot</a> VM, the
  * <code>-XX:+UseConcMarkSweepGC</code> and <code>-XX:+UseParNewGC</code> options improve the
  * behavior of the <code>HeapLRUCapacityController</code>.
- * 
- * 
+ *
  * @since GemFire 3.2
  */
 @SuppressWarnings("synthetic-access")
@@ -268,7 +268,7 @@ public class HeapLRUCapacityController extends LRUAlgorithm {
        * greater than the overflow threshold, then we evict the LRU entry.
        */
       public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
-        final GemFireCacheImpl cache = (GemFireCacheImpl) region.getRegionService();
+        final InternalCache cache = (InternalCache) region.getRegionService();
         InternalResourceManager resourceManager = cache.getInternalResourceManager();
         boolean offheap = region.getAttributes().getOffHeap();
         final boolean monitorStateIsEviction =

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/lru/OffHeapEvictor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/OffHeapEvictor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/OffHeapEvictor.java
index 2d2e7cc..058673f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/OffHeapEvictor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/OffHeapEvictor.java
@@ -14,9 +14,8 @@
  */
 package org.apache.geode.internal.cache.lru;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
@@ -36,7 +35,7 @@ public class OffHeapEvictor extends HeapEvictor {
 
   private long bytesToEvictWithEachBurst;
 
-  public OffHeapEvictor(Cache gemFireCache) {
+  public OffHeapEvictor(InternalCache gemFireCache) {
     super(gemFireCache);
     calculateEvictionBurst();
   }
@@ -46,7 +45,7 @@ public class OffHeapEvictor extends HeapEvictor {
         DistributionConfig.GEMFIRE_PREFIX + "HeapLRUCapacityController.evictionBurstPercentage",
         "0.4"));
 
-    MemoryAllocator allocator = ((GemFireCacheImpl) this.cache).getOffHeapStore();
+    MemoryAllocator allocator = this.cache.getOffHeapStore();
 
     /*
      * Bail if there is no off-heap memory to evict.

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
index df6e2f2..eeb3704 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BecomePrimaryBucketMessage.java
@@ -134,7 +134,7 @@ public class BecomePrimaryBucketMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
     buff.append("; isRebalance=").append(this.isRebalance);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
index 04349aa..ed17740 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketSizeMessage.java
@@ -114,7 +114,7 @@ public final class BucketSizeMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
index 3cca861..d6422c2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ContainsKeyValueMessage.java
@@ -143,7 +143,7 @@ public final class ContainsKeyValueMessage extends PartitionMessageWithDirectRep
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; valueCheck=").append(this.valueCheck).append("; key=").append(this.key)
         .append("; bucketId=").append(this.bucketId);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
index 03b5ded..744e013 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/CreateBucketMessage.java
@@ -172,9 +172,10 @@ public final class CreateBucketMessage extends PartitionMessage {
    * Assists the toString method in reporting the contents of this message
    * 
    * @see PartitionMessage#toString()
+   * @param buff
    */
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId).append("; bucketSize=")
         .append(this.bucketSize);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
index e765df0..f305fa8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
@@ -113,7 +113,7 @@ public class DeposePrimaryBucketMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
index dc55835..bffaf4d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DestroyMessage.java
@@ -419,9 +419,10 @@ public class DestroyMessage extends PartitionMessageWithDirectReply {
    * Assists the toString method in reporting the contents of this message
    * 
    * @see PartitionMessage#toString()
+   * @param buff
    */
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; key=").append(getKey());
     if (originalSender != null) {

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
index e9468dc..6314f2d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DumpB2NRegion.java
@@ -315,7 +315,7 @@ public final class DumpB2NRegion extends PartitionMessage {
    * StringBuffer)
    */
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append(" bucketId=").append(this.bucketId).append(" primaryInfoOnly=")
         .append(this.onlyReturnPrimaryInfo);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
index 4a09f94..0502d5f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/EndBucketCreationMessage.java
@@ -107,7 +107,7 @@ public class EndBucketCreationMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
     buff.append("; newPrimary=").append(this.newPrimary);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
index 7208baf..41186ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchBulkEntriesMessage.java
@@ -47,7 +47,6 @@ import org.apache.geode.internal.HeapDataOutputStream;
 import org.apache.geode.internal.Version;
 import org.apache.geode.internal.cache.BucketDump;
 import org.apache.geode.internal.cache.BucketRegion;
-import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.ForceReattemptException;
 import org.apache.geode.internal.cache.InitialImageOperation;
 import org.apache.geode.internal.cache.PartitionedRegion;
@@ -139,7 +138,7 @@ public final class FetchBulkEntriesMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketIds);
     buff.append("; recipient=").append(this.getRecipient());

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
index b0f052a..c7ca279 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessage.java
@@ -128,7 +128,7 @@ public final class FetchEntriesMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
     buff.append("; recipient=").append(this.getRecipient());

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
index ae2ce37..301e154 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
@@ -174,7 +174,7 @@ public final class FetchEntryMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; key=").append(this.key);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
index 5d44b20..e1c708a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchKeysMessage.java
@@ -181,7 +181,7 @@ public final class FetchKeysMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
index 76a0dac..5f4dec1 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
@@ -120,7 +120,7 @@ public class FetchPartitionDetailsMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; internal=").append(this.internal);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
index 54e80c6..1c2a6a7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/GetMessage.java
@@ -219,7 +219,7 @@ public final class GetMessage extends PartitionMessageWithDirectReply {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; key=").append(this.key).append("; callback arg=").append(this.cbArg)
         .append("; context=").append(this.context);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
index a0cda9b..8259818 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/InterestEventMessage.java
@@ -96,7 +96,7 @@ public class InterestEventMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; event=").append(this.event);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
index 65cb072..786006e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBackupBucketMessage.java
@@ -192,9 +192,10 @@ public final class ManageBackupBucketMessage extends PartitionMessage {
    * Assists the toString method in reporting the contents of this message
    * 
    * @see PartitionMessage#toString()
+   * @param buff
    */
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
     buff.append("; isRebalance=").append(this.isRebalance);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
index 85b9af8..1092145 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/ManageBucketMessage.java
@@ -189,9 +189,10 @@ public final class ManageBucketMessage extends PartitionMessage {
    * Assists the toString method in reporting the contents of this message
    * 
    * @see PartitionMessage#toString()
+   * @param buff
    */
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId).append("; bucketSize=")
         .append(this.bucketSize);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
index 43e4341..8a607c0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
@@ -119,7 +119,7 @@ public class MoveBucketMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
     buff.append("; source=").append(this.source);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
index fe1acfa..5c5af24 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java
@@ -68,7 +68,7 @@ public final class PRSanityCheckMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append(" regionName=").append(this.regionName);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
index 0e6b707..3552b5d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRTombstoneMessage.java
@@ -25,7 +25,6 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
 import org.apache.geode.cache.Operation;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
@@ -113,7 +112,7 @@ public final class PRTombstoneMessage extends PartitionMessageWithDirectReply
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; keys=").append(this.keys.size());
     buff.append("; eventID=").append(this.eventID);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
index 1dcf27f..eb7dcaf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRUpdateEntryVersionMessage.java
@@ -200,10 +200,11 @@ public class PRUpdateEntryVersionMessage extends PartitionMessageWithDirectReply
    * Assists the toString method in reporting the contents of this message
    * 
    * @see PartitionMessage#toString()
+   * @param buff
    */
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; key=").append(getKey());
     buff.append("; op=").append(this.op);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
index bdd26ce..5129044 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
@@ -53,10 +53,10 @@ import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.FilterRoutingInfo;
 import org.apache.geode.internal.cache.ForceReattemptException;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionException;
 import org.apache.geode.internal.cache.PrimaryBucketException;
-import org.apache.geode.internal.cache.TXId;
 import org.apache.geode.internal.cache.TXManagerImpl;
 import org.apache.geode.internal.cache.TXStateProxy;
 import org.apache.geode.internal.cache.TransactionMessage;
@@ -134,7 +134,7 @@ public abstract class PartitionMessage extends DistributionMessage
     setRecipient(recipient);
     this.regionId = regionId;
     this.processorId = processor == null ? 0 : processor.getProcessorId();
-    if (processor != null && this.isSevereAlertCompatible()) {
+    if (processor != null && isSevereAlertCompatible()) {
       processor.enableSevereAlertProcessing();
     }
     initTxMemberId();
@@ -146,7 +146,7 @@ public abstract class PartitionMessage extends DistributionMessage
     setRecipients(recipients);
     this.regionId = regionId;
     this.processorId = processor == null ? 0 : processor.getProcessorId();
-    if (processor != null && this.isSevereAlertCompatible()) {
+    if (processor != null && isSevereAlertCompatible()) {
       processor.enableSevereAlertProcessing();
     }
     initTxMemberId();
@@ -174,8 +174,6 @@ public abstract class PartitionMessage extends DistributionMessage
 
   /**
    * Copy constructor that initializes the fields declared in this class
-   * 
-   * @param other
    */
   public PartitionMessage(PartitionMessage other) {
     this.regionId = other.regionId;
@@ -262,7 +260,7 @@ public abstract class PartitionMessage extends DistributionMessage
    * check to see if the cache is closing
    */
   public boolean checkCacheClosing(DistributionManager dm) {
-    GemFireCacheImpl cache = getGemFireCacheImpl();
+    InternalCache cache = getInternalCache();
     // return (cache != null && cache.isClosed());
     return cache == null || cache.isClosed();
   }
@@ -281,11 +279,11 @@ public abstract class PartitionMessage extends DistributionMessage
     return PartitionedRegion.getPRFromId(this.regionId);
   }
 
-  GemFireCacheImpl getGemFireCacheImpl() {
+  InternalCache getInternalCache() {
     return GemFireCacheImpl.getInstance();
   }
 
-  TXManagerImpl getTXManagerImpl(GemFireCacheImpl cache) {
+  TXManagerImpl getTXManagerImpl(InternalCache cache) {
     return cache.getTxManager();
   }
 
@@ -321,8 +319,7 @@ public abstract class PartitionMessage extends DistributionMessage
         // the partitioned region can't be found (bug 36585)
         thr = new ForceReattemptException(
             LocalizedStrings.PartitionMessage_0_COULD_NOT_FIND_PARTITIONED_REGION_WITH_ID_1
-                .toLocalizedString(
-                    new Object[] {dm.getDistributionManagerId(), Integer.valueOf(regionId)}));
+                .toLocalizedString(dm.getDistributionManagerId(), regionId));
         return; // reply sent in finally block below
       }
 
@@ -331,7 +328,7 @@ public abstract class PartitionMessage extends DistributionMessage
       }
       thr = UNHANDLED_EXCEPTION;
 
-      GemFireCacheImpl cache = getGemFireCacheImpl();
+      InternalCache cache = getInternalCache();
       if (cache == null) {
         throw new ForceReattemptException(
             LocalizedStrings.PartitionMessage_REMOTE_CACHE_IS_CLOSED_0.toLocalizedString());
@@ -401,8 +398,8 @@ public abstract class PartitionMessage extends DistributionMessage
                   .toLocalizedString());
         }
       }
-      if (logger.isTraceEnabled(LogMarker.DM) && (t instanceof RuntimeException)) {
-        logger.trace(LogMarker.DM, "Exception caught while processing message: ", t.getMessage(),
+      if (logger.isTraceEnabled(LogMarker.DM) && t instanceof RuntimeException) {
+        logger.trace(LogMarker.DM, "Exception caught while processing message: {}", t.getMessage(),
             t);
       }
     } finally {
@@ -598,7 +595,7 @@ public abstract class PartitionMessage extends DistributionMessage
 
   @Override
   public String toString() {
-    StringBuffer buff = new StringBuffer();
+    StringBuilder buff = new StringBuilder();
     String className = getClass().getName();
     // className.substring(className.lastIndexOf('.', className.lastIndexOf('.') - 1) + 1); //
     // partition.<foo> more generic version
@@ -613,7 +610,7 @@ public abstract class PartitionMessage extends DistributionMessage
       if (pr != null) {
         name = pr.getFullPath();
       }
-    } catch (Exception e) {
+    } catch (Exception ignore) {
       /* ignored */
       name = null;
     }
@@ -630,10 +627,10 @@ public abstract class PartitionMessage extends DistributionMessage
 
   /**
    * Helper class of {@link #toString()}
-   * 
+   *
    * @param buff buffer in which to append the state of this instance
    */
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     buff.append(" processorId=").append(this.processorId);
     if (this.notificationOnly) {
       buff.append(" notificationOnly=").append(this.notificationOnly);
@@ -704,7 +701,7 @@ public abstract class PartitionMessage extends DistributionMessage
         return false;
       }
       return pr.notifiesMultipleSerialGateways();
-    } catch (PRLocallyDestroyedException e) {
+    } catch (PRLocallyDestroyedException ignore) {
       return false;
     } catch (RuntimeException ignore) {
       return false;
@@ -770,15 +767,15 @@ public abstract class PartitionMessage extends DistributionMessage
         if (removeMember(id, true)) {
           this.prce = new ForceReattemptException(
               LocalizedStrings.PartitionMessage_PARTITIONRESPONSE_GOT_MEMBERDEPARTED_EVENT_FOR_0_CRASHED_1
-                  .toLocalizedString(new Object[] {id, Boolean.valueOf(crashed)}));
+                  .toLocalizedString(id, crashed));
         }
         checkIfDone();
       } else {
         Exception e = new Exception(
             LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID.toLocalizedString());
         logger.info(LocalizedMessage.create(
-            LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID_CRASHED_0,
-            Boolean.valueOf(crashed)), e);
+            LocalizedStrings.PartitionMessage_MEMBERDEPARTED_GOT_NULL_MEMBERID_CRASHED_0, crashed),
+            e);
       }
     }
 
@@ -788,7 +785,6 @@ public abstract class PartitionMessage extends DistributionMessage
      * @throws CacheException if the recipient threw a cache exception during message processing
      * @throws ForceReattemptException if the recipient left the distributed system before the
      *         response was received.
-     * @throws PrimaryBucketException
      */
     final public void waitForCacheException()
         throws CacheException, ForceReattemptException, PrimaryBucketException {
@@ -867,7 +863,7 @@ public abstract class PartitionMessage extends DistributionMessage
    * For Distributed Tx
    */
   private void setIfTransactionDistributed() {
-    GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+    InternalCache cache = GemFireCacheImpl.getInstance();
     if (cache != null) {
       if (cache.getTxManager() != null) {
         this.isTransactionDistributed = cache.getTxManager().isDistributed();

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
index 6bead2e..b5f5e6f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessageWithDirectReply.java
@@ -122,7 +122,7 @@ public abstract class PartitionMessageWithDirectReply extends PartitionMessage
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; posDup=").append(this.posDup);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
index c24a0aa..f7ca7e6 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionFunctionStreamingMessage.java
@@ -170,7 +170,7 @@ public class PartitionedRegionFunctionStreamingMessage extends PartitionMessage
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
index 38f9b45..e91bd15 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
@@ -14,6 +14,18 @@
  */
 package org.apache.geode.internal.cache.partitioned;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.CancelException;
 import org.apache.geode.cache.partition.PartitionMemberInfo;
 import org.apache.geode.cache.partition.PartitionRebalanceInfo;
@@ -24,7 +36,7 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.BucketAdvisor;
 import org.apache.geode.internal.cache.ColocationHelper;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegion.RecoveryLock;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
@@ -33,15 +45,17 @@ import org.apache.geode.internal.cache.control.ResourceManagerStats;
 import org.apache.geode.internal.cache.partitioned.BecomePrimaryBucketMessage.BecomePrimaryBucketResponse;
 import org.apache.geode.internal.cache.partitioned.MoveBucketMessage.MoveBucketResponse;
 import org.apache.geode.internal.cache.partitioned.RemoveBucketMessage.RemoveBucketResponse;
-import org.apache.geode.internal.cache.partitioned.rebalance.*;
+import org.apache.geode.internal.cache.partitioned.rebalance.BucketOperator;
+import org.apache.geode.internal.cache.partitioned.rebalance.BucketOperatorImpl;
+import org.apache.geode.internal.cache.partitioned.rebalance.BucketOperatorWrapper;
+import org.apache.geode.internal.cache.partitioned.rebalance.ParallelBucketOperator;
+import org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel;
 import org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.AddressComparor;
+import org.apache.geode.internal.cache.partitioned.rebalance.RebalanceDirector;
+import org.apache.geode.internal.cache.partitioned.rebalance.SimulatedBucketOperator;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.util.*;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * This class performs a rebalance on a single partitioned region.
@@ -62,8 +76,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
  * 
  * There is also a FPRDirector that creates buckets and moves primaries for fixed partititioned
  * regions.
- * 
- *
  */
 @SuppressWarnings("synthetic-access")
 public class PartitionedRegionRebalanceOp {
@@ -179,8 +191,7 @@ public class PartitionedRegionRebalanceOp {
       leaderRegion.getRegionAdvisor().addMembershipListener(listener);
       PartitionedRegionLoadModel model = null;
 
-
-      GemFireCacheImpl cache = (GemFireCacheImpl) leaderRegion.getCache();
+      InternalCache cache = leaderRegion.getCache();
       Map<PartitionedRegion, InternalPRInfo> detailsMap = fetchDetails(cache);
       BucketOperatorWrapper serialOperator = getBucketOperator(detailsMap);
       ParallelBucketOperator parallelOperator = new ParallelBucketOperator(MAX_PARALLEL_OPERATIONS,
@@ -324,7 +335,7 @@ public class PartitionedRegionRebalanceOp {
     }
 
     long start = System.nanoTime();
-    GemFireCacheImpl cache = (GemFireCacheImpl) leaderRegion.getCache();
+    InternalCache cache = leaderRegion.getCache();
     InternalResourceManager resourceManager =
         InternalResourceManager.getInternalResourceManager(cache);
     InternalResourceManager.getResourceObserver().recoveryStarted(targetRegion);
@@ -387,7 +398,7 @@ public class PartitionedRegionRebalanceOp {
     }
   }
 
-  private Map<PartitionedRegion, InternalPRInfo> fetchDetails(GemFireCacheImpl cache) {
+  private Map<PartitionedRegion, InternalPRInfo> fetchDetails(InternalCache cache) {
     LoadProbe probe = cache.getInternalResourceManager().getLoadProbe();
     Map<PartitionedRegion, InternalPRInfo> detailsMap =
         new LinkedHashMap<PartitionedRegion, InternalPRInfo>(colocatedRegions.size());

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
index ed1fe0a..06c3d89 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutAllPRMessage.java
@@ -78,7 +78,7 @@ import org.apache.geode.internal.offheap.annotations.Retained;
  *
  * @since GemFire 6.0
  */
-public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
+public class PutAllPRMessage extends PartitionMessageWithDirectReply {
   private static final Logger logger = LogService.getLogger();
 
   private PutAllEntryData[] putAllPRData;
@@ -118,7 +118,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
 
   public PutAllPRMessage(int bucketId, int size, boolean notificationOnly, boolean posDup,
       boolean skipCallbacks, Object callbackArg) {
-    this.bucketId = Integer.valueOf(bucketId);
+    this.bucketId = bucketId;
     putAllPRData = new PutAllEntryData[size];
     this.notificationOnly = notificationOnly;
     this.posDup = posDup;
@@ -217,7 +217,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
   @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     super.fromData(in);
-    this.bucketId = Integer.valueOf((int) InternalDataSerializer.readSignedVL(in));
+    this.bucketId = (int) InternalDataSerializer.readSignedVL(in);
     if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
       this.bridgeContext = DataSerializer.readObject(in);
     }
@@ -249,7 +249,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
     if (bucketId == null) {
       InternalDataSerializer.writeSignedVL(-1, out);
     } else {
-      InternalDataSerializer.writeSignedVL(bucketId.intValue(), out);
+      InternalDataSerializer.writeSignedVL(bucketId, out);
     }
     if (this.bridgeContext != null) {
       DataSerializer.writeObject(this.bridgeContext, out);
@@ -313,7 +313,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
    * indefinitely for the acknowledgement
    */
   @Override
-  protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
+  protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr,
       long startTime) throws EntryExistsException, ForceReattemptException, DataLocationException {
     boolean sendReply = true;
 
@@ -321,14 +321,14 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
 
     long lastModified = 0L;
     try {
-      result = doLocalPutAll(r, eventSender, lastModified);
+      result = doLocalPutAll(pr, eventSender, lastModified);
     } catch (ForceReattemptException fre) {
-      sendReply(getSender(), getProcessorId(), dm, new ReplyException(fre), r, startTime);
+      sendReply(getSender(), getProcessorId(), dm, new ReplyException(fre), pr, startTime);
       return false;
     }
 
     if (sendReply) {
-      sendReply(getSender(), getProcessorId(), dm, null, r, startTime);
+      sendReply(getSender(), getProcessorId(), dm, null, pr, startTime);
     }
     return false;
   }
@@ -363,8 +363,8 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
    *        lastModified timestamp for last modification
    * @return If succeeds, return true, otherwise, throw exception
    */
-  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "IMSE_DONT_CATCH_IMSE")
-  public final boolean doLocalPutAll(PartitionedRegion r, InternalDistributedMember eventSender,
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings("IMSE_DONT_CATCH_IMSE")
+  public boolean doLocalPutAll(PartitionedRegion r, InternalDistributedMember eventSender,
       long lastModified)
       throws EntryExistsException, ForceReattemptException, DataLocationException {
     boolean didPut = false;
@@ -501,10 +501,8 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
               }
             } // for
 
-          } catch (IllegalMonitorStateException ex) {
-            ForceReattemptException fre =
-                new ForceReattemptException("unable to get lock for primary, retrying... ");
-            throw fre;
+          } catch (IllegalMonitorStateException ignore) {
+            throw new ForceReattemptException("unable to get lock for primary, retrying... ");
           } catch (CacheWriterException cwe) {
             // encounter cacheWriter exception
             partialKeys.saveFailedKey(key, cwe);
@@ -650,7 +648,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
 
 
   @Override
-  protected final void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; putAllPRDataSize=").append(putAllPRDataSize).append("; bucketId=")
         .append(bucketId);
@@ -661,21 +659,16 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
     buff.append("; directAck=").append(this.directAck);
 
     for (int i = 0; i < putAllPRDataSize; i++) {
-      // buff.append("; entry"+i+":").append(putAllPRData[i]);
-      buff.append("; entry" + i + ":").append(putAllPRData[i].getKey()).append(",")
+      buff.append("; entry").append(i).append(":").append(putAllPRData[i].getKey()).append(",")
           .append(putAllPRData[i].versionTag);
     }
   }
 
-  public final InternalDistributedSystem getInternalDs() {
-    return internalDs;
-  }
-
-  public final void setInternalDs(InternalDistributedSystem internalDs) {
+  public void setInternalDs(InternalDistributedSystem internalDs) {
     this.internalDs = internalDs;
   }
 
-  public final void setDirectAck(boolean directAck) {
+  public void setDirectAck(boolean directAck) {
     this.directAck = directAck;
   }
 
@@ -686,10 +679,8 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
 
   @Override
   public String toString() {
-    StringBuffer buff = new StringBuffer();
+    StringBuilder buff = new StringBuilder();
     String className = getClass().getName();
-    // className.substring(className.lastIndexOf('.', className.lastIndexOf('.') - 1) + 1); //
-    // partition.<foo> more generic version
     buff.append(className.substring(className.indexOf(PN_TOKEN) + PN_TOKEN.length())); // partition.<foo>
     buff.append("(prid="); // make sure this is the first one
     buff.append(this.regionId);
@@ -701,7 +692,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
       if (pr != null) {
         name = pr.getFullPath();
       }
-    } catch (Exception e) {
+    } catch (Exception ignore) {
       /* ignored */
       name = null;
     }
@@ -721,7 +712,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
     return buff.toString();
   }
 
-  public static final class PutAllReplyMessage extends ReplyMessage {
+  public static class PutAllReplyMessage extends ReplyMessage {
     /** Result of the PutAll operation */
     boolean result;
     VersionedObjectList versions;
@@ -801,7 +792,7 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
 
     @Override
     public String toString() {
-      StringBuffer sb = new StringBuffer();
+      StringBuilder sb = new StringBuilder();
       sb.append("PutAllReplyMessage ").append("processorid=").append(this.processorId)
           .append(" returning ").append(this.result).append(" exception=").append(getException())
           .append(" versions= ").append(this.versions);
@@ -843,17 +834,6 @@ public final class PutAllPRMessage extends PartitionMessageWithDirectReply {
       } catch (ForceReattemptException e) {
         throw e;
       }
-      // try {
-      // waitForRepliesUninterruptibly();
-      // }
-      // catch (ReplyException e) {
-      // Throwable t = e.getCause();
-      // if (t instanceof CacheClosedException) {
-      // throw new PartitionedRegionCommunicationException("Put operation received an exception",
-      // t);
-      // }
-      // e.handleAsUnexpected();
-      // }
       return new PutAllResult(this.returnValue, this.versions);
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
index dd2698c..1c41e61 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PutMessage.java
@@ -44,7 +44,6 @@ import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.NanoTimer;
 import org.apache.geode.internal.cache.CachedDeserializable;
-import org.apache.geode.internal.cache.CachedDeserializableFactory;
 import org.apache.geode.internal.cache.DataLocationException;
 import org.apache.geode.internal.cache.DistributedCacheOperation;
 import org.apache.geode.internal.cache.EntryEventImpl;
@@ -58,7 +57,6 @@ import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionDataStore;
 import org.apache.geode.internal.cache.PrimaryBucketException;
 import org.apache.geode.internal.cache.RemotePutMessage;
-import org.apache.geode.internal.cache.VMCachedDeserializable;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.cache.versions.VersionTag;
 import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -67,7 +65,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.offheap.annotations.Released;
 import org.apache.geode.internal.offheap.annotations.Retained;
 import org.apache.geode.internal.offheap.annotations.Unretained;
-import org.apache.geode.internal.util.BlobHelper;
 
 import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_OLD_VALUE;
 import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
@@ -826,7 +823,7 @@ public final class PutMessage extends PartitionMessageWithDirectReply implements
 
 
   @Override
-  protected final void appendFields(StringBuffer buff) {
+  protected final void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; key=").append(getKey()).append("; value=");
     // buff.append(getValBytes());

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
index 51844aa..b6028fe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/QueryMessage.java
@@ -64,18 +64,18 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
   private volatile boolean isPdxSerialized;
   private volatile boolean traceOn;
 
-  // private transient PRQueryResultCollector resultCollector = new PRQueryResultCollector();
-  private transient List<Collection> resultCollector = new ArrayList<Collection>();
-  private transient int tokenCount = 0; // counts how many end of stream tokens received
-  private transient Iterator currentResultIterator;
-  private transient Iterator<Collection> currentSelectResultIterator;
-  private transient boolean isTraceInfoIteration = false;
-  private transient boolean isStructType = false;
+  private final List<Collection> resultCollector = new ArrayList<>();
+  private Iterator currentResultIterator;
+  private Iterator<Collection> currentSelectResultIterator;
+  private boolean isTraceInfoIteration = false;
+  private boolean isStructType = false;
 
   /**
    * Empty constructor to satisfy {@link DataSerializer} requirements
    */
-  public QueryMessage() {}
+  public QueryMessage() {
+    // do nothing
+  }
 
   public QueryMessage(InternalDistributedMember recipient, int regionId, ReplyProcessor21 processor,
       DefaultQuery query, Object[] parameters, final List buckets) {
@@ -87,7 +87,6 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
     this.traceOn = query.isTraced() || DefaultQuery.QUERY_VERBOSE;
   }
 
-
   /**
    * Provide results to send back to requestor. terminate by returning END_OF_STREAM token object
    */
@@ -101,10 +100,11 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
           .toLocalizedString(QueryMonitor.getMemoryUsedDuringLowMemory());
       throw new QueryExecutionLowMemoryException(reason);
     }
-    if (Thread.interrupted())
+    if (Thread.interrupted()) {
       throw new InterruptedException();
+    }
 
-    while ((this.currentResultIterator == null || !this.currentResultIterator.hasNext())) {
+    while (this.currentResultIterator == null || !this.currentResultIterator.hasNext()) {
       if (this.currentSelectResultIterator.hasNext()) {
         if (this.isTraceInfoIteration && this.currentResultIterator != null) {
           this.isTraceInfoIteration = false;
@@ -115,22 +115,20 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
         }
         this.currentResultIterator = results.iterator();
       } else {
-        // Assert.assertTrue(this.resultCollector.isEmpty());
         return Token.END_OF_STREAM;
       }
     }
     Object data = this.currentResultIterator.next();
     boolean isPostGFE_8_1 = this.getSender().getVersionObject().compareTo(Version.GFE_81) > 0;
-    // Asif: There is a bug in older versions of GFE such that the query node expects the structs to
-    // have
+
+    // There is a bug in older versions of GFE such that the query node expects the structs to have
     // type as ObjectTypes only & not specific types. So the new version needs to send the
-    // inaccurate
-    // struct type for backward compatibility.
+    // inaccurate struct type for backward compatibility.
     if (this.isStructType && !this.isTraceInfoIteration && isPostGFE_8_1) {
       return ((Struct) data).getFieldValues();
     } else if (this.isStructType && !this.isTraceInfoIteration) {
-      Struct s = (Struct) data;
-      ObjectType[] fieldTypes = s.getStructType().getFieldTypes();
+      Struct struct = (Struct) data;
+      ObjectType[] fieldTypes = struct.getStructType().getFieldTypes();
       for (int i = 0; i < fieldTypes.length; ++i) {
         fieldTypes[i] = new ObjectTypeImpl(Object.class);
       }
@@ -140,32 +138,27 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
     }
   }
 
-
   @Override
-  protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
+  protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr,
       long startTime)
       throws CacheException, QueryException, ForceReattemptException, InterruptedException {
-    // calculate trace start time if trace is on
-    // this is because the start time is only set if enableClock stats is on
-    // in this case we still want to see trace time even if clock is not enabled
+    // calculate trace start time if trace is on this is because the start time is only set if
+    // enableClock stats is on in this case we still want to see trace time even if clock is not
+    // enabled
     long traceStartTime = 0;
     if (this.traceOn) {
       traceStartTime = NanoTimer.getTime();
     }
-    PRQueryTraceInfo queryTraceInfo = null;
-    List queryTraceList = null;
-    if (Thread.interrupted())
+    if (Thread.interrupted()) {
       throw new InterruptedException();
+    }
     if (logger.isTraceEnabled(LogMarker.DM)) {
       logger.trace(LogMarker.DM, "QueryMessage operateOnPartitionedRegion: {} buckets {}",
-          r.getFullPath(), buckets);
+          pr.getFullPath(), this.buckets);
     }
 
-    r.waitOnInitialization();
-
-    // PartitionedRegionDataStore ds = r.getDataStore();
+    pr.waitOnInitialization();
 
-    // if (ds != null) {
     if (QueryMonitor.isLowMemory()) {
       String reason = LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY
           .toLocalizedString(QueryMonitor.getMemoryUsedDuringLowMemory());
@@ -174,25 +167,26 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
       throw new QueryExecutionLowMemoryException(reason);
     }
 
-    DefaultQuery query = new DefaultQuery(this.queryString, r.getCache(), false);
+    DefaultQuery query = new DefaultQuery(this.queryString, pr.getCache(), false);
     // Remote query, use the PDX types in serialized form.
-    DefaultQuery.setPdxReadSerialized(r.getCache(), true);
-    // In case of "select *" queries we can keep the results in serialized
-    // form and send
+    DefaultQuery.setPdxReadSerialized(pr.getCache(), true);
+    // In case of "select *" queries we can keep the results in serialized form and send
     query.setRemoteQuery(true);
     QueryObserver indexObserver = query.startTrace();
     boolean isQueryTraced = false;
+    List queryTraceList = null;
+
     try {
       query.setIsCqQuery(this.cqQuery);
-      // ds.queryLocalNode(query, this.parameters, this.buckets,
-      // this.resultCollector);
-      PRQueryProcessor qp = new PRQueryProcessor(r, query, parameters, buckets);
+      PRQueryProcessor qp = new PRQueryProcessor(pr, query, this.parameters, this.buckets);
       if (logger.isDebugEnabled()) {
         logger.debug("Started executing query from remote node: {}", query.getQueryString());
       }
       isQueryTraced =
           query.isTraced() && this.sender.getVersionObject().compareTo(Version.GFE_81) >= 0;
+
       // Adds a query trace info object to the results list for remote queries
+      PRQueryTraceInfo queryTraceInfo = null;
       if (isQueryTraced) {
         this.isTraceInfoIteration = true;
         if (DefaultQuery.testHook != null) {
@@ -200,85 +194,77 @@ public final class QueryMessage extends StreamingPartitionOperation.StreamingPar
         }
         queryTraceInfo = new PRQueryTraceInfo();
         queryTraceList = Collections.singletonList(queryTraceInfo);
-
       }
 
       this.isStructType = qp.executeQuery(this.resultCollector);
-      // Add the trace info list object after the NWayMergeResults is created so as to
-      // exclude it from the sorted collection of NWayMergeResults
+      // Add the trace info list object after the NWayMergeResults is created so as to exclude it
+      // from the sorted collection of NWayMergeResults
       if (isQueryTraced) {
         this.resultCollector.add(0, queryTraceList);
       }
       this.currentSelectResultIterator = this.resultCollector.iterator();
 
-      // If trace is enabled, we will generate a trace object to send back
-      // The time info will be slightly different than the one logged on this
-      // node
-      // due to generating the trace object information here rather than the
-      // finally
-      // block.
+      // If trace is enabled, we will generate a trace object to send back. The time info will be
+      // slightly different than the one logged on this node due to generating the trace object
+      // information here rather than the finally block.
       if (isQueryTraced) {
         if (DefaultQuery.testHook != null) {
           DefaultQuery.testHook.doTestHook("Populating Trace Info for Remote Query");
         }
+
         // calculate the number of rows being sent
-        int traceSize = 0;
-        traceSize = queryTraceInfo.calculateNumberOfResults(resultCollector);
-        traceSize -= 1; // subtract the query trace info object
+        int traceSize = queryTraceInfo.calculateNumberOfResults(this.resultCollector);
+        // subtract the query trace info object
+        traceSize -= 1;
         queryTraceInfo.setTimeInMillis((NanoTimer.getTime() - traceStartTime) / 1.0e6f);
         queryTraceInfo.setNumResults(traceSize);
+
         // created the indexes used string
         if (indexObserver instanceof IndexTrackingQueryObserver) {
           Map indexesUsed = ((IndexTrackingQueryObserver) indexObserver).getUsedIndexes();
-          StringBuffer buf = new StringBuffer();
-          buf.append(" indexesUsed(").append(indexesUsed.size()).append(")");
+          StringBuilder sb = new StringBuilder();
+          sb.append(" indexesUsed(").append(indexesUsed.size()).append(")");
           if (indexesUsed.size() > 0) {
-            buf.append(":");
+            sb.append(":");
             for (Iterator itr = indexesUsed.entrySet().iterator(); itr.hasNext();) {
               Map.Entry entry = (Map.Entry) itr.next();
-              buf.append(entry.getKey().toString() + entry.getValue());
+              sb.append(entry.getKey()).append(entry.getValue());
               if (itr.hasNext()) {
-                buf.append(",");
+                sb.append(",");
               }
             }
           }
-          queryTraceInfo.setIndexesUsed(buf.toString());
+          queryTraceInfo.setIndexesUsed(sb.toString());
         }
       }
 
-      // resultSize = this.resultCollector.size() - this.buckets.size(); //Minus
-      // END_OF_BUCKET elements.
       if (QueryMonitor.isLowMemory()) {
         String reason = LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY
             .toLocalizedString(QueryMonitor.getMemoryUsedDuringLowMemory());
         throw new QueryExecutionLowMemoryException(reason);
       }
-      super.operateOnPartitionedRegion(dm, r, startTime);
+      super.operateOnPartitionedRegion(dm, pr, startTime);
     } finally {
-      // remove trace info so that it is not included in the num results when
-      // logged
+      // remove trace info so that it is not included in the num results when logged
       if (isQueryTraced) {
-        resultCollector.remove(queryTraceList);
+        this.resultCollector.remove(queryTraceList);
       }
-      DefaultQuery.setPdxReadSerialized(r.getCache(), false);
+      DefaultQuery.setPdxReadSerialized(pr.getCache(), false);
       query.setRemoteQuery(false);
       query.endTrace(indexObserver, traceStartTime, this.resultCollector);
     }
-    // }
-    // else {
-    // l.warning(LocalizedStrings.QueryMessage_QUERYMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER);
-    // }
 
     // Unless there was an exception thrown, this message handles sending the response
     return false;
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; query=").append(this.queryString).append("; bucketids=").append(this.buckets);
   }
 
+  @Override
   public int getDSFID() {
     return PR_QUERY_MESSAGE;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
index 0e38ddc..5f05e4b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
@@ -67,7 +67,6 @@ import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
 import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException;
 import org.apache.geode.internal.cache.versions.VersionTag;
-import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.offheap.annotations.Released;
@@ -632,7 +631,7 @@ public final class RemoveAllPRMessage extends PartitionMessageWithDirectReply {
 
 
   @Override
-  protected final void appendFields(StringBuffer buff) {
+  protected final void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; removeAllPRDataSize=").append(removeAllPRDataSize).append("; bucketId=")
         .append(bucketId);

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
index d7699ee..6336841 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
@@ -116,7 +116,7 @@ public class RemoveBucketMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketId=").append(this.bucketId);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
index 7e371f9..3dc5217 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
@@ -185,7 +185,7 @@ public final class SizeMessage extends PartitionMessage {
   }
 
   @Override
-  protected void appendFields(StringBuffer buff) {
+  protected void appendFields(StringBuilder buff) {
     super.appendFields(buff);
     buff.append("; bucketIds=").append(this.bucketIds);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/8c2210db/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModel.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModel.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModel.java
index ebf8fbe..46c55a0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModel.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModel.java
@@ -32,7 +32,6 @@ import org.apache.geode.cache.partition.PartitionMemberInfo;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.FixedPartitionAttributesImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.partitioned.InternalPartitionDetails;
 import org.apache.geode.internal.cache.partitioned.OfflineMemberDetails;
@@ -65,7 +64,6 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
  * This model is not threadsafe.
  * 
  * @since GemFire 6.0
- * 
  */
 @SuppressWarnings("synthetic-access")
 public class PartitionedRegionLoadModel {
@@ -147,7 +145,6 @@ public class PartitionedRegionLoadModel {
 
   private final PartitionedRegion partitionedRegion;
 
-
   /**
    * Create a new model
    * 
@@ -408,10 +405,7 @@ public class PartitionedRegionLoadModel {
         });
   }
 
-
-
   protected void remoteOverRedundancyBucket(BucketRollup bucket, Member targetMember) {
-
     Move bestMove = new Move(null, targetMember, bucket);
     Map<String, Long> colocatedRegionSizes = getColocatedRegionSizes(bucket);
 
@@ -1037,13 +1031,10 @@ public class PartitionedRegionLoadModel {
     Map<String, Member> getColocatedMembers() {
       return this.colocatedMembers;
     }
-
-
   }
 
   /**
    * Represents the sum of all of colocated buckets with a given bucket id.
-   *
    */
   protected class BucketRollup extends Bucket {
     private final Map<String, Bucket> colocatedBuckets = new HashMap<String, Bucket>();
@@ -1073,7 +1064,6 @@ public class PartitionedRegionLoadModel {
             primaryLoad = b.getPrimaryLoad();
           }
           rollup.updateLoad(b.getLoad(), primaryLoad, b.getBytes());
-
         }
         return true;
       }
@@ -1466,8 +1456,6 @@ public class PartitionedRegionLoadModel {
   /**
    * Represents a move from one node to another. Used to keep track of moves that we have already
    * attempted that have failed.
-   * 
-   *
    */
   protected static class Move {
     private final Member source;
@@ -1481,7 +1469,6 @@ public class PartitionedRegionLoadModel {
       this.bucket = bucket;
     }
 
-
     /**
      * @return the source
      */
@@ -1489,7 +1476,6 @@ public class PartitionedRegionLoadModel {
       return this.source;
     }
 
-
     /**
      * @return the target
      */
@@ -1497,7 +1483,6 @@ public class PartitionedRegionLoadModel {
       return this.target;
     }
 
-
     /**
      * @return the bucket
      */
@@ -1505,7 +1490,6 @@ public class PartitionedRegionLoadModel {
       return this.bucket;
     }
 
-
     @Override
     public int hashCode() {
       final int prime = 31;
@@ -1542,9 +1526,6 @@ public class PartitionedRegionLoadModel {
         return false;
       return true;
     }
-
-
-
   }
 
   public static interface AddressComparor {


Mime
View raw message