You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/06/08 22:58:46 UTC

geode git commit: Review feedback fixup

Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2632-21 59a268430 -> 028b37547


Review feedback fixup


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/028b3754
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/028b3754
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/028b3754

Branch: refs/heads/feature/GEODE-2632-21
Commit: 028b3754732f7c7d55d6abd63742183de042f8d7
Parents: 59a2684
Author: Kirk Lund <kl...@apache.org>
Authored: Thu Jun 8 15:58:27 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu Jun 8 15:58:27 2017 -0700

----------------------------------------------------------------------
 .../cache/tier/sockets/BaseCommandQuery.java    | 15 ++++---
 .../security/shiro/ConfigInitialization.java    |  6 +--
 .../cache/tier/sockets/command/CloseCQ.java     | 43 +++++++++-----------
 .../cache/tier/sockets/command/ExecuteCQ.java   | 32 +++++++--------
 .../cache/tier/sockets/command/ExecuteCQ61.java | 38 ++++++++---------
 .../cache/tier/sockets/command/GetCQStats.java  | 24 +++++------
 .../tier/sockets/command/GetDurableCQs.java     | 26 +++++-------
 .../cache/tier/sockets/command/MonitorCQ.java   | 25 ++++++------
 .../cache/tier/sockets/command/StopCQ.java      | 36 ++++++++--------
 9 files changed, 115 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
index 086f118..f128b1d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -14,12 +14,6 @@
  */
 package org.apache.geode.internal.cache.tier.sockets;
 
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.geode.cache.RegionDestroyedException;
 import org.apache.geode.cache.operations.QueryOperationContext;
 import org.apache.geode.cache.query.Query;
@@ -44,6 +38,12 @@ import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.security.AuthorizeRequestPP;
 import org.apache.geode.internal.security.SecurityService;
 
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
 public abstract class BaseCommandQuery extends BaseCommand {
 
   /**
@@ -298,8 +298,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
     return false;
   }
 
-  protected void sendCqResponse(int msgType, String msgStr, int txId, Throwable e,
-      ServerConnection servConn, final SecurityService securityService) throws IOException {
+  protected void sendCqResponse(int msgType, String msgStr, int txId, Throwable e, ServerConnection servConn) throws IOException {
     ChunkedMessage cqMsg = servConn.getChunkedResponseMessage();
     if (logger.isDebugEnabled()) {
       logger.debug("CQ Response message :{}", msgStr);

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-core/src/main/java/org/apache/geode/internal/security/shiro/ConfigInitialization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/security/shiro/ConfigInitialization.java b/geode-core/src/main/java/org/apache/geode/internal/security/shiro/ConfigInitialization.java
index 6b2331d..659e3a9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/security/shiro/ConfigInitialization.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/security/shiro/ConfigInitialization.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.security.shiro;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.config.Ini.Section;
 import org.apache.shiro.config.IniSecurityManagerFactory;
+import org.apache.shiro.mgt.SecurityManager;
 
 public class ConfigInitialization {
 
@@ -32,13 +33,12 @@ public class ConfigInitialization {
 
     // we will need to make sure that shiro uses a case sensitive permission resolver
     Section main = factory.getIni().addSection("main");
-    main.put("geodePermissionResolver",
-        "org.apache.geode.internal.security.shiro.GeodePermissionResolver");
+    main.put("geodePermissionResolver", GeodePermissionResolver.class.getName());
     if (!main.containsKey("iniRealm.permissionResolver")) {
       main.put("iniRealm.permissionResolver", "$geodePermissionResolver");
     }
 
-    org.apache.shiro.mgt.SecurityManager securityManager = factory.getInstance();
+    SecurityManager securityManager = factory.getInstance();
     SecurityUtils.setSecurityManager(securityManager);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
index fd5c4d2..6748f7d 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
@@ -14,10 +14,6 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.cache.query.internal.cq.InternalCqQuery;
@@ -33,15 +29,21 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.security.AuthorizeRequest;
 import org.apache.geode.internal.security.SecurityService;
 
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
 public class CloseCQ extends BaseCQCommand {
 
-  private final static CloseCQ singleton = new CloseCQ();
+  private static final CloseCQ singleton = new CloseCQ();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private CloseCQ() {}
+  private CloseCQ() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -50,8 +52,6 @@ public class CloseCQ extends BaseCQCommand {
     ClientProxyMembershipID id = serverConnection.getProxyID();
     CacheServerStats stats = serverConnection.getCacheServerStats();
 
-    // Based on MessageType.QUERY
-    // Added by Rao 2/1/2007
     serverConnection.setAsTrue(REQUIRES_RESPONSE);
     serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
 
@@ -69,7 +69,7 @@ public class CloseCQ extends BaseCQCommand {
       String err =
           LocalizedStrings.CloseCQ_THE_CQNAME_FOR_THE_CQ_CLOSE_REQUEST_IS_NULL.toLocalizedString();
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
 
@@ -89,45 +89,40 @@ public class CloseCQ extends BaseCQCommand {
 
       AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
       if (authzRequest != null) {
-        String queryStr = null;
-        Set cqRegionNames = null;
 
         if (cqQuery != null) {
-          queryStr = cqQuery.getQueryString();
-          cqRegionNames = new HashSet();
-          cqRegionNames.add(((InternalCqQuery) cqQuery).getRegionName());
+          String queryStr = cqQuery.getQueryString();
+          Set cqRegionNames = new HashSet();
+          cqRegionNames.add(cqQuery.getRegionName());
           authzRequest.closeCQAuthorize(cqName, queryStr, cqRegionNames);
         }
 
       }
-      // String cqNameWithClientId = new String(cqName + "__" +
-      // getMembershipID());
+
       cqService.closeCq(cqName, id);
       if (cqQuery != null)
         serverConnection.removeCq(cqName, cqQuery.isDurable());
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe,
-          serverConnection, securityService);
+          serverConnection);
       return;
     } catch (Exception e) {
       String err =
           LocalizedStrings.CloseCQ_EXCEPTION_WHILE_CLOSING_CQ_CQNAME_0.toLocalizedString(cqName);
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
 
     // Send OK to client
     sendCqResponse(MessageType.REPLY,
         LocalizedStrings.CloseCQ_CQ_CLOSED_SUCCESSFULLY.toLocalizedString(),
-        clientMessage.getTransactionId(), null, serverConnection, securityService);
+        clientMessage.getTransactionId(), null, serverConnection);
     serverConnection.setAsTrue(RESPONDED);
 
-    {
-      long oldStart = start;
-      start = DistributionStats.getStatTime();
-      stats.incProcessCloseCqTime(start - oldStart);
-    }
+    long oldStart = start;
+    start = DistributionStats.getStatTime();
+    stats.incProcessCloseCqTime(start - oldStart);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
index a528171..04e32f8 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
@@ -14,11 +14,6 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import java.io.IOException;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
 import org.apache.geode.cache.operations.ExecuteCQOperationContext;
 import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.Query;
@@ -40,17 +35,23 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.security.AuthorizeRequest;
 import org.apache.geode.internal.security.SecurityService;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.util.Set;
 
 public class ExecuteCQ extends BaseCQCommand {
   protected static final Logger logger = LogService.getLogger();
 
-  private final static ExecuteCQ singleton = new ExecuteCQ();
+  private static final ExecuteCQ singleton = new ExecuteCQ();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private ExecuteCQ() {}
+  private ExecuteCQ() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -70,7 +71,7 @@ public class ExecuteCQ extends BaseCQCommand {
 
     Part isDurablePart = clientMessage.getPart(3);
     byte[] isDurableByte = isDurablePart.getSerializedForm();
-    boolean isDurable = (isDurableByte == null || isDurableByte[0] == 0) ? false : true;
+    boolean isDurable = !(isDurableByte == null || isDurableByte[0] == 0);
     if (logger.isDebugEnabled()) {
       logger.debug("{}: Received {} request from {} CqName: {} queryString: {}",
           serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()),
@@ -110,22 +111,21 @@ public class ExecuteCQ extends BaseCQCommand {
           acceptor.getCacheClientNotifier(), isDurable, false, 0, null);
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe,
-          serverConnection, securityService);
+          serverConnection);
       return;
     } catch (Exception e) {
       writeChunkedException(clientMessage, e, serverConnection);
       return;
     }
 
-    long oldstart = start;
     boolean sendResults = false;
-    boolean successQuery = false;
 
     if (clientMessage.getMessageType() == MessageType.EXECUTECQ_WITH_IR_MSG_TYPE) {
       sendResults = true;
     }
 
     // Execute the query and send the result-set to client.
+    boolean successQuery = false;
     try {
       if (query == null) {
         query = qService.newQuery(cqQueryString);
@@ -136,8 +136,8 @@ public class ExecuteCQ extends BaseCQCommand {
           cqQuery, executeCQContext, serverConnection, sendResults, securityService);
 
       // Update the CQ statistics.
-      cqQuery.getVsdStats().setCqInitialResultsTime((DistributionStats.getStatTime()) - oldstart);
-      stats.incProcessExecuteCqWithIRTime((DistributionStats.getStatTime()) - oldstart);
+      cqQuery.getVsdStats().setCqInitialResultsTime(DistributionStats.getStatTime() - start);
+      stats.incProcessExecuteCqWithIRTime(DistributionStats.getStatTime() - start);
       // logger.fine("Time spent in execute with initial results :" +
       // DistributionStats.getStatTime() + ", " + oldstart);
     } finally { // To handle any exception.
@@ -145,7 +145,7 @@ public class ExecuteCQ extends BaseCQCommand {
       if (!successQuery) {
         try {
           cqServiceForExec.closeCq(cqName, id);
-        } catch (Exception ex) {
+        } catch (Exception ignore) {
           // Ignore.
         }
       }
@@ -155,10 +155,10 @@ public class ExecuteCQ extends BaseCQCommand {
       // Send OK to client
       sendCqResponse(MessageType.REPLY,
           LocalizedStrings.ExecuteCQ_CQ_CREATED_SUCCESSFULLY.toLocalizedString(),
-          clientMessage.getTransactionId(), null, serverConnection, securityService);
+          clientMessage.getTransactionId(), null, serverConnection);
 
       long start2 = DistributionStats.getStatTime();
-      stats.incProcessCreateCqTime(start2 - oldstart);
+      stats.incProcessCreateCqTime(start2 - start);
     }
     serverConnection.setAsTrue(RESPONDED);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
index 288879b..77a608c 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
@@ -14,11 +14,6 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import java.io.IOException;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
 import org.apache.geode.cache.operations.ExecuteCQOperationContext;
 import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.Query;
@@ -45,6 +40,10 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.security.AuthorizeRequest;
 import org.apache.geode.internal.security.SecurityService;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.util.Set;
 
 /**
  * @since GemFire 6.1
@@ -52,13 +51,15 @@ import org.apache.geode.internal.security.SecurityService;
 public class ExecuteCQ61 extends BaseCQCommand {
   protected static final Logger logger = LogService.getLogger();
 
-  private final static ExecuteCQ61 singleton = new ExecuteCQ61();
+  private static final ExecuteCQ61 singleton = new ExecuteCQ61();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private ExecuteCQ61() {}
+  private ExecuteCQ61() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -78,7 +79,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
 
     Part isDurablePart = clientMessage.getPart(3);
     byte[] isDurableByte = isDurablePart.getSerializedForm();
-    boolean isDurable = (isDurableByte == null || isDurableByte[0] == 0) ? false : true;
+    boolean isDurable = !(isDurableByte == null || isDurableByte[0] == 0);
     // region data policy
     Part regionDataPolicyPart = clientMessage.getPart(clientMessage.getNumberOfParts() - 1);
     byte[] regionDataPolicyPartBytes = regionDataPolicyPart.getSerializedForm();
@@ -98,7 +99,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
             LocalizedStrings.ExecuteCQ_SERVER_NOTIFYBYSUBSCRIPTION_MODE_IS_SET_TO_FALSE_CQ_EXECUTION_IS_NOT_SUPPORTED_IN_THIS_MODE
                 .toLocalizedString();
         sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
-            null, serverConnection, securityService);
+            null, serverConnection);
         return;
       }
     }
@@ -147,7 +148,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
           isDurable, true, regionDataPolicyPartBytes[0], null);
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe,
-          serverConnection, securityService);
+          serverConnection);
       serverConnection.removeCq(cqName, isDurable);
       return;
     } catch (Exception e) {
@@ -156,9 +157,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
       return;
     }
 
-    long oldstart = start;
     boolean sendResults = false;
-    boolean successQuery = false;
 
     if (clientMessage.getMessageType() == MessageType.EXECUTECQ_WITH_IR_MSG_TYPE) {
       sendResults = true;
@@ -166,8 +165,9 @@ public class ExecuteCQ61 extends BaseCQCommand {
 
     // Execute the query only if it is execute with initial results or
     // if it is a non PR query with execute query and maintain keys flags set
-    if (sendResults || (CqServiceImpl.EXECUTE_QUERY_DURING_INIT && CqServiceProvider.MAINTAIN_KEYS
-        && !cqQuery.isPR())) {
+    boolean successQuery = false;
+    if (sendResults || CqServiceImpl.EXECUTE_QUERY_DURING_INIT && CqServiceProvider.MAINTAIN_KEYS
+        && !cqQuery.isPR()) {
       // Execute the query and send the result-set to client.
       try {
         if (query == null) {
@@ -180,8 +180,8 @@ public class ExecuteCQ61 extends BaseCQCommand {
 
 
         // Update the CQ statistics.
-        cqQuery.getVsdStats().setCqInitialResultsTime((DistributionStats.getStatTime()) - oldstart);
-        stats.incProcessExecuteCqWithIRTime((DistributionStats.getStatTime()) - oldstart);
+        cqQuery.getVsdStats().setCqInitialResultsTime(DistributionStats.getStatTime() - start);
+        stats.incProcessExecuteCqWithIRTime(DistributionStats.getStatTime() - start);
         // logger.fine("Time spent in execute with initial results :" +
         // DistributionStats.getStatTime() + ", " + oldstart);
       } finally { // To handle any exception.
@@ -189,7 +189,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
         if (!successQuery) {
           try {
             cqServiceForExec.closeCq(cqName, id);
-          } catch (Exception ex) {
+          } catch (Exception ignored) {
             // Ignore.
           }
         }
@@ -205,10 +205,10 @@ public class ExecuteCQ61 extends BaseCQCommand {
       // Send OK to client
       sendCqResponse(MessageType.REPLY,
           LocalizedStrings.ExecuteCQ_CQ_CREATED_SUCCESSFULLY.toLocalizedString(),
-          clientMessage.getTransactionId(), null, serverConnection, securityService);
+          clientMessage.getTransactionId(), null, serverConnection);
 
       long start2 = DistributionStats.getStatTime();
-      stats.incProcessCreateCqTime(start2 - oldstart);
+      stats.incProcessCreateCqTime(start2 - start);
     }
     serverConnection.setAsTrue(RESPONDED);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
index 6f833bc..a37263f 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
@@ -14,8 +14,6 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import java.io.IOException;
-
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.distributed.internal.DistributionStats;
 import org.apache.geode.internal.cache.tier.CachedRegionHelper;
@@ -26,15 +24,19 @@ import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.security.SecurityService;
 
+import java.io.IOException;
+
 public class GetCQStats extends BaseCQCommand {
 
-  private final static GetCQStats singleton = new GetCQStats();
+  private static final GetCQStats singleton = new GetCQStats();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private GetCQStats() {}
+  private GetCQStats() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -64,7 +66,7 @@ public class GetCQStats extends BaseCQCommand {
     if (cqName == null) {
       String err = "The cqName for the cq stats request is null";
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
 
@@ -78,19 +80,17 @@ public class GetCQStats extends BaseCQCommand {
     } catch (Exception e) {
       String err = "Exception while Getting the CQ Statistics. ";
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
     // Send OK to client
     sendCqResponse(MessageType.REPLY, "cq stats sent successfully.",
-        clientMessage.getTransactionId(), null, serverConnection, securityService);
+        clientMessage.getTransactionId(), null, serverConnection);
     serverConnection.setAsTrue(RESPONDED);
 
-    {
-      long oldStart = start;
-      start = DistributionStats.getStatTime();
-      stats.incProcessGetCqStatsTime(start - oldStart);
-    }
+    long oldStart = start;
+    start = DistributionStats.getStatTime();
+    stats.incProcessGetCqStatsTime(start - oldStart);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
index 085454a..46da840 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
@@ -36,13 +36,15 @@ import org.apache.geode.internal.security.SecurityService;
 
 public class GetDurableCQs extends BaseCQCommand {
 
-  private final static GetDurableCQs singleton = new GetDurableCQs();
+  private static final GetDurableCQs singleton = new GetDurableCQs();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private GetDurableCQs() {}
+  private GetDurableCQs() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -61,11 +63,10 @@ public class GetDurableCQs extends BaseCQCommand {
           serverConnection.getSocketString());
     }
 
-    DefaultQueryService qService = null;
-    CqService cqServiceForExec = null;
-
     try {
-      qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
+      DefaultQueryService
+          qService =
+          (DefaultQueryService) crHelper.getCache().getLocalQueryService();
 
       securityService.authorizeClusterRead();
 
@@ -75,7 +76,7 @@ public class GetDurableCQs extends BaseCQCommand {
         authzRequest.getDurableCQsAuthorize();
       }
 
-      cqServiceForExec = qService.getCqService();
+      CqService cqServiceForExec = qService.getCqService();
       List<String> durableCqs = cqServiceForExec.getAllDurableClientCqs(id);
 
       ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
@@ -85,7 +86,7 @@ public class GetDurableCQs extends BaseCQCommand {
 
       List durableCqList = new ArrayList(MAXIMUM_CHUNK_SIZE);
       final boolean isTraceEnabled = logger.isTraceEnabled();
-      for (Iterator it = durableCqs.iterator(); it.hasNext();) {
+      for (Iterator<String> it = durableCqs.iterator(); it.hasNext();) {
         Object durableCqName = it.next();
         durableCqList.add(durableCqName);
         if (isTraceEnabled) {
@@ -103,11 +104,9 @@ public class GetDurableCQs extends BaseCQCommand {
 
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe,
-          serverConnection, securityService);
-      return;
+          serverConnection);
     } catch (Exception e) {
       writeChunkedException(clientMessage, e, serverConnection);
-      return;
     }
   }
 
@@ -120,13 +119,10 @@ public class GetDurableCQs extends BaseCQCommand {
     chunkedResponseMsg.addObjPart(list, false);
 
     if (logger.isDebugEnabled()) {
-      logger.debug("{}: Sending {} durableCQs response chunk{}", servConn.getName(),
-          (lastChunk ? " last " : " "),
-          (logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : ""));
+      logger.debug("{}: Sending {} durableCQs response chunk{}", servConn.getName(), lastChunk ? " last " : " ", logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : "");
     }
 
     chunkedResponseMsg.sendChunk(servConn);
   }
 
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
index ceb0ef7..d2700dd 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
@@ -14,8 +14,6 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import java.io.IOException;
-
 import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.internal.cache.tier.CachedRegionHelper;
@@ -26,15 +24,19 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.security.SecurityService;
 
+import java.io.IOException;
+
 public class MonitorCQ extends BaseCQCommand {
 
-  private final static MonitorCQ singleton = new MonitorCQ();
+  private static final MonitorCQ singleton = new MonitorCQ();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private MonitorCQ() {}
+  private MonitorCQ() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -50,7 +52,7 @@ public class MonitorCQ extends BaseCQCommand {
       String err = LocalizedStrings.MonitorCQ__0_THE_MONITORCQ_OPERATION_IS_INVALID
           .toLocalizedString(serverConnection.getName());
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
 
@@ -64,15 +66,14 @@ public class MonitorCQ extends BaseCQCommand {
             LocalizedStrings.MonitorCQ__0_A_NULL_REGION_NAME_WAS_PASSED_FOR_MONITORCQ_OPERATION
                 .toLocalizedString(serverConnection.getName());
         sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
-            null, serverConnection, securityService);
+            null, serverConnection);
         return;
       }
     }
 
     if (logger.isDebugEnabled()) {
       logger.debug("{}: Received MonitorCq request from {} op: {}{}", serverConnection.getName(),
-          serverConnection.getSocketString(), op,
-          (regionName != null) ? " RegionName: " + regionName : "");
+          serverConnection.getSocketString(), op, regionName != null ? " RegionName: " + regionName : "");
     }
 
     securityService.authorizeClusterRead();
@@ -90,14 +91,12 @@ public class MonitorCQ extends BaseCQCommand {
           LocalizedStrings.CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED.toLocalizedString());
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe,
-          serverConnection, securityService);
-      return;
+          serverConnection);
     } catch (Exception e) {
       String err = LocalizedStrings.MonitorCQ_EXCEPTION_WHILE_HANDLING_THE_MONITOR_REQUEST_OP_IS_0
-          .toLocalizedString(Integer.valueOf(op));
+          .toLocalizedString(op);
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e,
-          serverConnection, securityService);
-      return;
+          serverConnection);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/028b3754/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
index d22fe93..a3d51ed 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
@@ -14,12 +14,7 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.geode.cache.query.CqException;
-import org.apache.geode.cache.query.internal.cq.CqQueryImpl;
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.cache.query.internal.cq.InternalCqQuery;
 import org.apache.geode.distributed.internal.DistributionStats;
@@ -34,15 +29,21 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.security.AuthorizeRequest;
 import org.apache.geode.internal.security.SecurityService;
 
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
 public class StopCQ extends BaseCQCommand {
 
-  private final static StopCQ singleton = new StopCQ();
+  private static final StopCQ singleton = new StopCQ();
 
   public static Command getCommand() {
     return singleton;
   }
 
-  private StopCQ() {}
+  private StopCQ() {
+    // nothing
+  }
 
   @Override
   public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
@@ -51,8 +52,6 @@ public class StopCQ extends BaseCQCommand {
     ClientProxyMembershipID id = serverConnection.getProxyID();
     CacheServerStats stats = serverConnection.getCacheServerStats();
 
-    // Based on MessageType.QUERY
-    // Added by Rao 2/1/2007
     serverConnection.setAsTrue(REQUIRES_RESPONSE);
     serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
 
@@ -70,7 +69,7 @@ public class StopCQ extends BaseCQCommand {
       String err =
           LocalizedStrings.StopCQ_THE_CQNAME_FOR_THE_CQ_STOP_REQUEST_IS_NULL.toLocalizedString();
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
 
@@ -97,7 +96,7 @@ public class StopCQ extends BaseCQCommand {
         if (cqQuery != null) {
           queryStr = cqQuery.getQueryString();
           cqRegionNames = new HashSet();
-          cqRegionNames.add(((CqQueryImpl) cqQuery).getRegionName());
+          cqRegionNames.add(cqQuery.getRegionName());
         }
         authzRequest.stopCQAuthorize(cqName, queryStr, cqRegionNames);
       }
@@ -106,29 +105,26 @@ public class StopCQ extends BaseCQCommand {
         serverConnection.removeCq(cqName, cqQuery.isDurable());
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe,
-          serverConnection, securityService);
+          serverConnection);
       return;
     } catch (Exception e) {
       String err =
           LocalizedStrings.StopCQ_EXCEPTION_WHILE_STOPPING_CQ_NAMED_0.toLocalizedString(cqName);
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e,
-          serverConnection, securityService);
+          serverConnection);
       return;
     }
 
     // Send OK to client
     sendCqResponse(MessageType.REPLY,
         LocalizedStrings.StopCQ_CQ_STOPPED_SUCCESSFULLY.toLocalizedString(),
-        clientMessage.getTransactionId(), null, serverConnection, securityService);
+        clientMessage.getTransactionId(), null, serverConnection);
 
     serverConnection.setAsTrue(RESPONDED);
 
-    {
-      long oldStart = start;
-      start = DistributionStats.getStatTime();
-      stats.incProcessStopCqTime(start - oldStart);
-    }
-
+    long oldStart = start;
+    start = DistributionStats.getStatTime();
+    stats.incProcessStopCqTime(start - oldStart);
   }
 
 }