geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [48/50] [abbrv] geode git commit: Convert to use FunctionContext.getCache()
Date Tue, 01 Aug 2017 21:03:42 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MembersForRegionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MembersForRegionFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MembersForRegionFunction.java
index 72d37e7..931e01c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MembersForRegionFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MembersForRegionFunction.java
@@ -21,7 +21,6 @@ import java.util.Map;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
@@ -29,24 +28,20 @@ import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
 
 /**
- * 
  * @since GemFire 8.0
  */
-
 public class MembersForRegionFunction implements Function, InternalEntity {
   private static final Logger logger = LogService.getLogger();
-
   private static final long serialVersionUID = 8746830191680509335L;
 
-  private static final String ID = MembersForRegionFunction.class.getName();
-
   @Override
-  public void execute(FunctionContext context) {
-    Map<String, String> resultMap = new HashMap<String, String>();
+  public void execute(final FunctionContext context) {
+    Map<String, String> resultMap = new HashMap<>();
+
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       String memberNameOrId = cache.getDistributedSystem().getDistributedMember().getId();
-      Object args = (Object) context.getArguments();
+      Object args = context.getArguments();
       String regionName = ((String) args);
       Region<Object, Object> region = cache.getRegion(regionName);
 
@@ -61,9 +56,10 @@ public class MembersForRegionFunction implements Function, InternalEntity {
           resultMap.put("", "");
         }
       }
+
       context.getResultSender().lastResult(resultMap);
+
     } catch (Exception ex) {
-      Cache cache = CacheFactory.getAnyInstance();
       logger.info("MembersForRegionFunction exception {}", ex.getMessage(), ex);
       resultMap.put("", "");
       context.getResultSender().lastResult(resultMap);
@@ -71,22 +67,17 @@ public class MembersForRegionFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return MembersForRegionFunction.ID;
+  public boolean hasResult() {
+    return true;
   }
 
   @Override
-  public boolean isHA() {
+  public boolean optimizeForWrite() {
     return false;
   }
 
   @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
+  public boolean isHA() {
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/NetstatFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/NetstatFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/NetstatFunction.java
index 5c1cb29..f054621 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/NetstatFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/NetstatFunction.java
@@ -14,7 +14,12 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import static org.apache.geode.internal.lang.SystemUtils.*;
+import static org.apache.geode.internal.lang.SystemUtils.getOsArchitecture;
+import static org.apache.geode.internal.lang.SystemUtils.getOsName;
+import static org.apache.geode.internal.lang.SystemUtils.getOsVersion;
+import static org.apache.geode.internal.lang.SystemUtils.isLinux;
+import static org.apache.geode.internal.lang.SystemUtils.isMacOSX;
+import static org.apache.geode.internal.lang.SystemUtils.isSolaris;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -29,7 +34,6 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
@@ -42,36 +46,26 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
  * 
  * @since GemFire 7.0
  */
-@SuppressWarnings({"serial"})
 public class NetstatFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
   private static final long serialVersionUID = 1L;
-
-  public static final NetstatFunction INSTANCE = new NetstatFunction();
-
-  private static final String ID = NetstatFunction.class.getName();
+  private static final Logger logger = LogService.getLogger();
 
   private static final String NETSTAT_COMMAND = "netstat";
   private static final String LSOF_COMMAND = "lsof";
 
   @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
   public void execute(final FunctionContext context) {
-    DistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
+    DistributedSystem ds = context.getCache().getDistributedSystem();
     if (ds == null || !ds.isConnected()) {
       return;
     }
 
     String host = ds.getDistributedMember().getHost();
     NetstatFunctionArgument args = (NetstatFunctionArgument) context.getArguments();
-    boolean withlsof = args.isWithlsof();
+    boolean withLsof = args.isWithLsof();
     String lineSeparator = args.getLineSeparator();
 
-    String netstatOutput = executeCommand(lineSeparator, withlsof);
+    String netstatOutput = executeCommand(lineSeparator, withLsof);
 
     StringBuilder netstatInfo = new StringBuilder();
 
@@ -84,6 +78,21 @@ public class NetstatFunction implements Function, InternalEntity {
     context.getResultSender().lastResult(result);
   }
 
+  @Override
+  public boolean hasResult() {
+    return true;
+  }
+
+  @Override
+  public boolean optimizeForWrite() {
+    return false;
+  }
+
+  @Override
+  public boolean isHA() {
+    return false;
+  }
+
   private static void addMemberHostHeader(final StringBuilder netstatInfo, final String id,
       final String host, final String lineSeparator) {
 
@@ -91,7 +100,7 @@ public class NetstatFunction implements Function, InternalEntity {
 
     StringBuilder memberPlatFormInfo = new StringBuilder();
     memberPlatFormInfo.append(CliStrings.format(CliStrings.NETSTAT__MSG__FOR_HOST_1_OS_2_MEMBER_0,
-        new Object[] {id, host, osInfo, lineSeparator}));
+        id, host, osInfo, lineSeparator));
 
     int nameIdLength = Math.max(Math.max(id.length(), host.length()), osInfo.length()) * 2;
 
@@ -126,24 +135,27 @@ public class NetstatFunction implements Function, InternalEntity {
     }
 
     ProcessBuilder processBuilder = new ProcessBuilder(cmdOptionsList);
+    Process netstat = null;
     try {
-      Process netstat = processBuilder.start();
-
+      netstat = processBuilder.start();
       InputStream is = netstat.getInputStream();
-      BufferedReader breader = new BufferedReader(new InputStreamReader(is));
+      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
       String line;
 
-      while ((line = breader.readLine()) != null) {
+      while ((line = bufferedReader.readLine()) != null) {
         netstatInfo.append(line).append(lineSeparator);
       }
 
-      // TODO: move to finally-block
-      netstat.destroy();
     } catch (IOException e) {
       // TODO: change this to keep the full stack trace
       netstatInfo.append(CliStrings.format(CliStrings.NETSTAT__MSG__COULD_NOT_EXECUTE_0_REASON_1,
-          new Object[] {NETSTAT_COMMAND, e.getMessage()}));
+          NETSTAT_COMMAND, e.getMessage()));
+
     } finally {
+      if (netstat != null) {
+        netstat.destroy();
+      }
+
       netstatInfo.append(lineSeparator); // additional new line
     }
   }
@@ -154,10 +166,10 @@ public class NetstatFunction implements Function, InternalEntity {
         .append(" output ###################").append(lineSeparator);
 
     if (isLinux() || isMacOSX() || isSolaris()) {
-
       ProcessBuilder procBuilder = new ProcessBuilder(LSOF_COMMAND);
+      Process lsof = null;
       try {
-        Process lsof = procBuilder.start();
+        lsof = procBuilder.start();
         InputStreamReader reader = new InputStreamReader(lsof.getInputStream());
         BufferedReader breader = new BufferedReader(reader);
         String line = "";
@@ -165,23 +177,27 @@ public class NetstatFunction implements Function, InternalEntity {
         while ((line = breader.readLine()) != null) {
           existingNetstatInfo.append(line).append(lineSeparator);
         }
-        // TODO: move this to finally-block
-        lsof.destroy();
+
       } catch (IOException e) {
         // TODO: change this to keep the full stack trace
         String message = e.getMessage();
         if (message.contains("error=2, No such file or directory")) {
           existingNetstatInfo
               .append(CliStrings.format(CliStrings.NETSTAT__MSG__COULD_NOT_EXECUTE_0_REASON_1,
-                  new Object[] {LSOF_COMMAND, CliStrings.NETSTAT__MSG__LSOF_NOT_IN_PATH}));
+                  LSOF_COMMAND, CliStrings.NETSTAT__MSG__LSOF_NOT_IN_PATH));
         } else {
-          existingNetstatInfo
-              .append(CliStrings.format(CliStrings.NETSTAT__MSG__COULD_NOT_EXECUTE_0_REASON_1,
-                  new Object[] {LSOF_COMMAND, e.getMessage()}));
+          existingNetstatInfo.append(CliStrings.format(
+              CliStrings.NETSTAT__MSG__COULD_NOT_EXECUTE_0_REASON_1, LSOF_COMMAND, e.getMessage()));
         }
+
       } finally {
+        if (lsof != null) {
+          lsof.destroy();
+        }
+
         existingNetstatInfo.append(lineSeparator); // additional new line
       }
+
     } else {
       existingNetstatInfo.append(CliStrings.NETSTAT__MSG__NOT_AVAILABLE_FOR_WINDOWS)
           .append(lineSeparator);
@@ -200,46 +216,40 @@ public class NetstatFunction implements Function, InternalEntity {
     return netstatInfo.toString();
   }
 
-  @Override
-  public String getId() {
-    return ID;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-
+  /**
+   * Java main, probably for manual testing?
+   */
   public static void main(final String[] args) {
     String netstat = executeCommand(GfshParser.LINE_SEPARATOR, true);
     System.out.println(netstat);
   }
 
+  /**
+   * Argument for NetstatFunction.
+   */
   public static class NetstatFunctionArgument implements Serializable {
     private static final long serialVersionUID = 1L;
 
     private final String lineSeparator;
-    private final boolean withlsof;
+    private final boolean withLsof;
 
-    public NetstatFunctionArgument(final String lineSeparator, final boolean withlsof) {
+    public NetstatFunctionArgument(final String lineSeparator, final boolean withLsof) {
       this.lineSeparator = lineSeparator;
-      this.withlsof = withlsof;
+      this.withLsof = withLsof;
     }
 
     public String getLineSeparator() {
       return lineSeparator;
     }
 
-    public boolean isWithlsof() {
-      return withlsof;
+    public boolean isWithLsof() {
+      return withLsof;
     }
   }
 
+  /**
+   * Result of executing NetstatFunction.
+   */
   public static class NetstatFunctionResult implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -266,4 +276,5 @@ public class NetstatFunction implements Function, InternalEntity {
       return compressedBytes;
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RebalanceFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RebalanceFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RebalanceFunction.java
index 218f212..df83a82 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RebalanceFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RebalanceFunction.java
@@ -14,14 +14,12 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.CancellationException;
 
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.control.RebalanceFactory;
 import org.apache.geode.cache.control.RebalanceOperation;
 import org.apache.geode.cache.control.RebalanceResults;
@@ -32,23 +30,13 @@ import org.apache.geode.cache.partition.PartitionRebalanceInfo;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
 
-
-
 public class RebalanceFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = RebalanceFunction.class.getName();
-
-
   private static final long serialVersionUID = 1L;
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
-
-    RebalanceOperation op = null;
-    String[] str = new String[0];
-
-    Cache cache = CacheFactory.getAnyInstance();
+  public void execute(final FunctionContext context) {
+    Cache cache = context.getCache();
     ResourceManager manager = cache.getResourceManager();
     Object[] args = (Object[]) context.getArguments();
     String simulate = ((String) args[0]);
@@ -59,6 +47,7 @@ public class RebalanceFunction implements Function, InternalEntity {
     rbFactory.includeRegions(includeRegionNames);
     RebalanceResults results = null;
 
+    RebalanceOperation op;
     if (simulate.equals("true")) {
       op = rbFactory.simulate();
     } else {
@@ -68,24 +57,29 @@ public class RebalanceFunction implements Function, InternalEntity {
     try {
       results = op.getResults();
       logger.info("Starting RebalanceFunction got results = {}", results);
-      StringBuilder str1 = new StringBuilder();
-      str1.append(results.getTotalBucketCreateBytes() + "," + results.getTotalBucketCreateTime()
-          + "," + results.getTotalBucketCreatesCompleted() + ","
-          + results.getTotalBucketTransferBytes() + "," + results.getTotalBucketTransferTime() + ","
-          + results.getTotalBucketTransfersCompleted() + "," + results.getTotalPrimaryTransferTime()
-          + "," + results.getTotalPrimaryTransfersCompleted() + "," + results.getTotalTime() + ",");
+      StringBuilder sb = new StringBuilder();
+      sb.append(results.getTotalBucketCreateBytes()).append(",")
+          .append(results.getTotalBucketCreateTime()).append(",")
+          .append(results.getTotalBucketCreatesCompleted()).append(",")
+          .append(results.getTotalBucketTransferBytes()).append(",")
+          .append(results.getTotalBucketTransferTime()).append(",")
+          .append(results.getTotalBucketTransfersCompleted()).append(",")
+          .append(results.getTotalPrimaryTransferTime()).append(",")
+          .append(results.getTotalPrimaryTransfersCompleted()).append(",")
+          .append(results.getTotalTime()).append(",");
 
       Set<PartitionRebalanceInfo> regns1 = results.getPartitionRebalanceDetails();
-      Iterator it = regns1.iterator();
-      while (it.hasNext()) {
-        PartitionRebalanceInfo rgn = (PartitionRebalanceInfo) it.next();
-        str1.append(rgn.getRegionPath() + ",");
+      for (PartitionRebalanceInfo rgn : regns1) {
+        sb.append(rgn.getRegionPath()).append(",");
       }
-      logger.info("Starting RebalanceFunction str1={}", str1);
-      context.getResultSender().lastResult(str1.toString());
+
+      logger.info("Starting RebalanceFunction with {}", sb);
+      context.getResultSender().lastResult(sb.toString());
+
     } catch (CancellationException e) {
-      logger.info("Starting RebalanceFunction CancellationException: ", e.getMessage(), e);
+      logger.info("Starting RebalanceFunction CancellationException: {}", e.getMessage(), e);
       context.getResultSender().lastResult("CancellationException1 " + e.getMessage());
+
     } catch (InterruptedException e) {
       logger.info("Starting RebalanceFunction InterruptedException: {}", e.getMessage(), e);
       context.getResultSender().lastResult("InterruptedException2 " + e.getMessage());
@@ -93,11 +87,6 @@ public class RebalanceFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return RebalanceFunction.ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionAlterFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionAlterFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionAlterFunction.java
index 79dcbd4..ea1d27d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionAlterFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionAlterFunction.java
@@ -21,14 +21,13 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.AttributesMutator;
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.CacheListener;
 import org.apache.geode.cache.CacheLoader;
 import org.apache.geode.cache.CacheWriter;
 import org.apache.geode.cache.ExpirationAction;
 import org.apache.geode.cache.ExpirationAttributes;
 import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.internal.ClassPathLoader;
@@ -46,21 +45,15 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
  * 
  * @since GemFire 8.0
  */
-public class RegionAlterFunction extends FunctionAdapter implements InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
+public class RegionAlterFunction implements Function, InternalEntity {
   private static final long serialVersionUID = -4846425364943216425L;
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public boolean isHA() {
-    return false;
-  }
-
-  @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     ResultSender<Object> resultSender = context.getResultSender();
 
-    Cache cache = CacheFactory.getAnyInstance();
+    Cache cache = context.getCache();
     String memberNameOrId =
         CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
 
@@ -70,16 +63,12 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
       XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", alteredRegion.getName());
       resultSender.lastResult(new CliFunctionResult(memberNameOrId, xmlEntity,
           CliStrings.format(CliStrings.ALTER_REGION__MSG__REGION_0_ALTERED_ON_1,
-              new Object[] {alteredRegion.getFullPath(), memberNameOrId})));
+              alteredRegion.getFullPath(), memberNameOrId)));
 
-    } catch (IllegalStateException e) {
+    } catch (IllegalArgumentException | IllegalStateException e) {
       logger.error(e.getMessage(), e);
-
       resultSender.lastResult(new CliFunctionResult(memberNameOrId, false, e.getMessage()));
-    } catch (IllegalArgumentException e) {
-      logger.error(e.getMessage(), e);
 
-      resultSender.lastResult(new CliFunctionResult(memberNameOrId, false, e.getMessage()));
     } catch (VirtualMachineError e) {
       SystemFailure.initiateFailure(e);
       throw e;
@@ -96,8 +85,14 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     }
   }
 
-  private <K, V> Region<?, ?> alterRegion(Cache cache, RegionFunctionArgs regionAlterArgs) {
-    final String regionPathString = regionAlterArgs.getRegionPath();
+  @Override
+  public boolean isHA() {
+    return false;
+  }
+
+  private <K, V> Region<?, ?> alterRegion(final Cache cache,
+      final RegionFunctionArgs regionAlterArgs) {
+    String regionPathString = regionAlterArgs.getRegionPath();
 
     RegionPath regionPath = new RegionPath(regionPathString);
     AbstractRegion region = (AbstractRegion) cache.getRegion(regionPathString);
@@ -123,7 +118,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     }
 
     // Alter expiration attributes
-    final RegionFunctionArgs.ExpirationAttrs newEntryExpirationIdleTime =
+    RegionFunctionArgs.ExpirationAttrs newEntryExpirationIdleTime =
         regionAlterArgs.getEntryExpirationIdleTime();
     if (newEntryExpirationIdleTime != null) {
       mutator.setEntryIdleTimeout(
@@ -133,7 +128,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
       }
     }
 
-    final RegionFunctionArgs.ExpirationAttrs newEntryExpirationTTL =
+    RegionFunctionArgs.ExpirationAttrs newEntryExpirationTTL =
         regionAlterArgs.getEntryExpirationTTL();
     if (newEntryExpirationTTL != null) {
       mutator.setEntryTimeToLive(
@@ -143,7 +138,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
       }
     }
 
-    final RegionFunctionArgs.ExpirationAttrs newRegionExpirationIdleTime =
+    RegionFunctionArgs.ExpirationAttrs newRegionExpirationIdleTime =
         regionAlterArgs.getRegionExpirationIdleTime();
     if (newRegionExpirationIdleTime != null) {
       mutator.setRegionIdleTimeout(
@@ -153,7 +148,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
       }
     }
 
-    final RegionFunctionArgs.ExpirationAttrs newRegionExpirationTTL =
+    RegionFunctionArgs.ExpirationAttrs newRegionExpirationTTL =
         regionAlterArgs.getRegionExpirationTTL();
     if (newRegionExpirationTTL != null) {
       mutator.setRegionTimeToLive(
@@ -164,7 +159,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     }
 
     // Alter Gateway Sender Ids
-    final Set<String> newGatewaySenderIds = regionAlterArgs.getGatewaySenderIds();
+    Set<String> newGatewaySenderIds = regionAlterArgs.getGatewaySenderIds();
     if (newGatewaySenderIds != null) {
 
       // Remove old gateway sender ids that aren't in the new list
@@ -190,7 +185,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     }
 
     // Alter Async Queue Ids
-    final Set<String> newAsyncEventQueueIds = regionAlterArgs.getAsyncEventQueueIds();
+    Set<String> newAsyncEventQueueIds = regionAlterArgs.getAsyncEventQueueIds();
     if (newAsyncEventQueueIds != null) {
 
       // Remove old async event queue ids that aren't in the new list
@@ -216,7 +211,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     }
 
     // Alter Cache Listeners
-    final Set<String> newCacheListenerNames = regionAlterArgs.getCacheListeners();
+    Set<String> newCacheListenerNames = regionAlterArgs.getCacheListeners();
     if (newCacheListenerNames != null) {
 
       // Remove old cache listeners that aren't in the new list
@@ -232,6 +227,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
         if (newCacheListenerName.isEmpty()) {
           continue;
         }
+
         boolean nameFound = false;
         for (CacheListener oldCacheListener : oldCacheListeners) {
           if (oldCacheListener.getClass().getName().equals(newCacheListenerName)) {
@@ -253,7 +249,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
       }
     }
 
-    final String cacheLoader = regionAlterArgs.getCacheLoader();
+    String cacheLoader = regionAlterArgs.getCacheLoader();
     if (cacheLoader != null) {
       if (cacheLoader.isEmpty()) {
         mutator.setCacheLoader(null);
@@ -268,7 +264,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
       }
     }
 
-    final String cacheWriter = regionAlterArgs.getCacheWriter();
+    String cacheWriter = regionAlterArgs.getCacheWriter();
     if (cacheWriter != null) {
       if (cacheWriter.isEmpty()) {
         mutator.setCacheWriter(null);
@@ -293,12 +289,12 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
    * @param newExpirationAttrs Attributes supplied by the command
    * @param oldExpirationAttributes Attributes currently applied to the Region.
    * 
-   * @return A new pair of expiration attributes taken from the command if it was given or the
-   *         current value from the Region if it was not.
+   * @return New expiration attributes taken from the command if it was given or the current value
+   *         from the Region if it was not.
    */
   private ExpirationAttributes parseExpirationAttributes(
-      RegionFunctionArgs.ExpirationAttrs newExpirationAttrs,
-      ExpirationAttributes oldExpirationAttributes) {
+      final RegionFunctionArgs.ExpirationAttrs newExpirationAttrs,
+      final ExpirationAttributes oldExpirationAttributes) {
 
     ExpirationAction action = oldExpirationAttributes.getAction();
     int timeout = oldExpirationAttributes.getTimeout();
@@ -306,6 +302,7 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     if (newExpirationAttrs.getTime() != null) {
       timeout = newExpirationAttrs.getTime();
     }
+
     if (newExpirationAttrs.getAction() != null) {
       action = newExpirationAttrs.getAction();
     }
@@ -313,20 +310,22 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     return new ExpirationAttributes(timeout, action);
   }
 
-  @SuppressWarnings("unchecked")
-  private static <K> Class<K> forName(String classToLoadName, String neededFor) {
+  private static <K> Class<K> forName(final String classToLoadName, final String neededFor) {
     Class<K> loadedClass = null;
+
     try {
       // Set Constraints
       ClassPathLoader classPathLoader = ClassPathLoader.getLatest();
       if (classToLoadName != null && !classToLoadName.isEmpty()) {
         loadedClass = (Class<K>) classPathLoader.forName(classToLoadName);
       }
+
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(
           CliStrings.format(CliStrings.ALTER_REGION__MSG__COULD_NOT_FIND_CLASS_0_SPECIFIED_FOR_1,
               classToLoadName, neededFor),
           e);
+
     } catch (ClassCastException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.ALTER_REGION__MSG__CLASS_SPECIFIED_FOR_0_SPECIFIED_FOR_1_IS_NOT_OF_EXPECTED_TYPE,
@@ -336,14 +335,17 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     return loadedClass;
   }
 
-  private static <K> K newInstance(Class<K> klass, String neededFor) {
-    K instance = null;
+  private static <K> K newInstance(final Class<K> klass, final String neededFor) {
+    K instance;
+
     try {
       instance = klass.newInstance();
+
     } catch (InstantiationException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.ALTER_REGION__MSG__COULD_NOT_INSTANTIATE_CLASS_0_SPECIFIED_FOR_1, klass,
           neededFor), e);
+
     } catch (IllegalAccessException e) {
       throw new RuntimeException(
           CliStrings.format(CliStrings.ALTER_REGION__MSG__COULD_NOT_ACCESS_CLASS_0_SPECIFIED_FOR_1,
@@ -354,8 +356,4 @@ public class RegionAlterFunction extends FunctionAdapter implements InternalEnti
     return instance;
   }
 
-  @Override
-  public String getId() {
-    return RegionAlterFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
index 6ae10a3..ea4f288 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
@@ -20,7 +20,6 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.CacheListener;
 import org.apache.geode.cache.CacheLoader;
 import org.apache.geode.cache.CacheWriter;
@@ -33,7 +32,7 @@ import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.RegionExistsException;
 import org.apache.geode.cache.RegionFactory;
 import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.compression.Compressor;
@@ -50,29 +49,17 @@ import org.apache.geode.management.internal.cli.util.RegionPath;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
 /**
- *
  * @since GemFire 7.0
  */
-public class RegionCreateFunction extends FunctionAdapter implements InternalEntity {
-
-  private static final Logger logger = LogService.getLogger();
-
+public class RegionCreateFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 8746830191680509335L;
-
-  private static final String ID = RegionCreateFunction.class.getName();
-
-  public static RegionCreateFunction INSTANCE = new RegionCreateFunction();
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     ResultSender<Object> resultSender = context.getResultSender();
 
-    Cache cache = CacheFactory.getAnyInstance();
+    Cache cache = context.getCache();
     String memberNameOrId =
         CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
 
@@ -94,7 +81,8 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
       XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", createdRegion.getName());
       resultSender.lastResult(new CliFunctionResult(memberNameOrId, xmlEntity,
           CliStrings.format(CliStrings.CREATE_REGION__MSG__REGION_0_CREATED_ON_1,
-              new Object[] {createdRegion.getFullPath(), memberNameOrId})));
+              createdRegion.getFullPath(), memberNameOrId)));
+
     } catch (IllegalStateException e) {
       String exceptionMsg = e.getMessage();
       String localizedString =
@@ -105,15 +93,16 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
                 String.valueOf(CreateAlterDestroyRegionCommands.PERSISTENT_OVERFLOW_SHORTCUTS)});
       }
       resultSender.lastResult(handleException(memberNameOrId, exceptionMsg, null/* do not log */));
-    } catch (IllegalArgumentException e) {
+
+    } catch (CreateSubregionException | IllegalArgumentException e) {
       resultSender.lastResult(handleException(memberNameOrId, e.getMessage(), e));
+
     } catch (RegionExistsException e) {
       String exceptionMsg =
           CliStrings.format(CliStrings.CREATE_REGION__MSG__REGION_PATH_0_ALREADY_EXISTS_ON_1,
               regionCreateArgs.getRegionPath(), memberNameOrId);
       resultSender.lastResult(handleException(memberNameOrId, exceptionMsg, e));
-    } catch (CreateSubregionException e) {
-      resultSender.lastResult(handleException(memberNameOrId, e.getMessage(), e));
+
     } catch (Exception e) {
       String exceptionMsg = e.getMessage();
       if (exceptionMsg == null) {
@@ -123,11 +112,17 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
   }
 
+  @Override
+  public boolean isHA() {
+    return false;
+  }
+
   private CliFunctionResult handleException(final String memberNameOrId, final String exceptionMsg,
       final Exception e) {
     if (e != null && logger.isDebugEnabled()) {
       logger.debug(e.getMessage(), e);
     }
+
     if (exceptionMsg != null) {
       return new CliFunctionResult(memberNameOrId, false, exceptionMsg);
     }
@@ -135,17 +130,17 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     return new CliFunctionResult(memberNameOrId);
   }
 
-  public static <K, V> Region<?, ?> createRegion(Cache cache, RegionFunctionArgs regionCreateArgs) {
-    Region<K, V> createdRegion = null;
-
-    final String regionPath = regionCreateArgs.getRegionPath();
-    final RegionShortcut regionShortcut = regionCreateArgs.getRegionShortcut();
-    final String useAttributesFrom = regionCreateArgs.getUseAttributesFrom();
+  public static <K, V> Region<?, ?> createRegion(final Cache cache,
+      final RegionFunctionArgs regionCreateArgs) {
+    String regionPath = regionCreateArgs.getRegionPath();
+    RegionShortcut regionShortcut = regionCreateArgs.getRegionShortcut();
+    String useAttributesFrom = regionCreateArgs.getUseAttributesFrom();
 
     // If a region path indicates a sub-region, check whether the parent region exists
     RegionPath regionPathData = new RegionPath(regionPath);
     String parentRegionPath = regionPathData.getParent();
     Region<?, ?> parentRegion = null;
+
     if (parentRegionPath != null && !Region.SEPARATOR.equals(parentRegionPath)) {
       parentRegion = cache.getRegion(parentRegionPath);
       if (parentRegion == null) {
@@ -168,9 +163,10 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
           CliStrings.CREATE_REGION__MSG__ONE_OF_REGIONSHORTCUT_AND_USEATTRIBUTESFROM_IS_REQUIRED);
     }
 
-    boolean isPartitioned = false;
-    RegionFactory<K, V> factory = null;
-    RegionAttributes<K, V> regionAttributes = null;
+    boolean isPartitioned;
+    RegionFactory<K, V> factory;
+    RegionAttributes<K, V> regionAttributes;
+
     if (regionShortcut != null) {
       regionAttributes = cache.getRegionAttributes(regionShortcut.toString());
       if (logger.isDebugEnabled()) {
@@ -187,6 +183,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
             CliStrings.CREATE_REGION__MSG__COULD_NOT_LOAD_REGION_ATTRIBUTES_FOR_SHORTCUT_0,
             regionShortcut));
       }
+
     } else {
       if (logger.isDebugEnabled()) {
         logger.debug("Using Manager's region attributes for {}", regionPath);
@@ -196,8 +193,8 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
         logger.debug("Using Attributes : {}", regionAttributes);
       }
     }
-    isPartitioned = regionAttributes.getPartitionAttributes() != null;
 
+    isPartitioned = regionAttributes.getPartitionAttributes() != null;
     factory = cache.createRegionFactory(regionAttributes);
 
     if (!isPartitioned && regionCreateArgs.hasPartitionAttributes()) {
@@ -219,8 +216,9 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
 
     // Set Constraints
-    final String keyConstraint = regionCreateArgs.getKeyConstraint();
-    final String valueConstraint = regionCreateArgs.getValueConstraint();
+    String keyConstraint = regionCreateArgs.getKeyConstraint();
+    String valueConstraint = regionCreateArgs.getValueConstraint();
+
     if (keyConstraint != null && !keyConstraint.isEmpty()) {
       Class<K> keyConstraintClass =
           CliUtil.forName(keyConstraint, CliStrings.CREATE_REGION__KEYCONSTRAINT);
@@ -234,32 +232,36 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
 
     // Expiration attributes
-    final RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime =
+    RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime =
         regionCreateArgs.getEntryExpirationIdleTime();
     if (entryExpirationIdleTime != null) {
       factory.setEntryIdleTimeout(entryExpirationIdleTime.convertToExpirationAttributes());
     }
-    final RegionFunctionArgs.ExpirationAttrs entryExpirationTTL =
+
+    RegionFunctionArgs.ExpirationAttrs entryExpirationTTL =
         regionCreateArgs.getEntryExpirationTTL();
     if (entryExpirationTTL != null) {
       factory.setEntryTimeToLive(entryExpirationTTL.convertToExpirationAttributes());
     }
-    final RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime =
+
+    RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime =
         regionCreateArgs.getRegionExpirationIdleTime();
     if (regionExpirationIdleTime != null) {
       factory.setEntryIdleTimeout(regionExpirationIdleTime.convertToExpirationAttributes());
     }
-    final RegionFunctionArgs.ExpirationAttrs regionExpirationTTL =
+
+    RegionFunctionArgs.ExpirationAttrs regionExpirationTTL =
         regionCreateArgs.getRegionExpirationTTL();
     if (regionExpirationTTL != null) {
       factory.setEntryTimeToLive(regionExpirationTTL.convertToExpirationAttributes());
     }
 
     // Associate a Disk Store
-    final String diskStore = regionCreateArgs.getDiskStore();
+    String diskStore = regionCreateArgs.getDiskStore();
     if (diskStore != null && !diskStore.isEmpty()) {
       factory.setDiskStoreName(diskStore);
     }
+
     if (regionCreateArgs.isSetDiskSynchronous()) {
       factory.setDiskSynchronous(regionCreateArgs.isDiskSynchronous());
     }
@@ -277,12 +279,13 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     if (regionCreateArgs.isSetEnableAsyncConflation()) {
       factory.setEnableAsyncConflation(regionCreateArgs.isEnableAsyncConflation());
     }
+
     if (regionCreateArgs.isSetEnableSubscriptionConflation()) {
       factory.setEnableSubscriptionConflation(regionCreateArgs.isEnableSubscriptionConflation());
     }
 
     // Gateway Sender Ids
-    final Set<String> gatewaySenderIds = regionCreateArgs.getGatewaySenderIds();
+    Set<String> gatewaySenderIds = regionCreateArgs.getGatewaySenderIds();
     if (gatewaySenderIds != null && !gatewaySenderIds.isEmpty()) {
       for (String gatewaySenderId : gatewaySenderIds) {
         factory.addGatewaySenderId(gatewaySenderId);
@@ -290,7 +293,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
 
     // Async Queue Ids
-    final Set<String> asyncEventQueueIds = regionCreateArgs.getAsyncEventQueueIds();
+    Set<String> asyncEventQueueIds = regionCreateArgs.getAsyncEventQueueIds();
     if (asyncEventQueueIds != null && !asyncEventQueueIds.isEmpty()) {
       for (String asyncEventQueueId : asyncEventQueueIds) {
         factory.addAsyncEventQueueId(asyncEventQueueId);
@@ -301,6 +304,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     if (regionCreateArgs.isSetConcurrencyChecksEnabled()) {
       factory.setConcurrencyChecksEnabled(regionCreateArgs.isConcurrencyChecksEnabled());
     }
+
     if (regionCreateArgs.isSetConcurrencyLevel()) {
       factory.setConcurrencyLevel(regionCreateArgs.getConcurrencyLevel());
     }
@@ -316,7 +320,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
 
     // Set plugins
-    final Set<String> cacheListeners = regionCreateArgs.getCacheListeners();
+    Set<String> cacheListeners = regionCreateArgs.getCacheListeners();
     if (cacheListeners != null && !cacheListeners.isEmpty()) {
       for (String cacheListener : cacheListeners) {
         Class<CacheListener<K, V>> cacheListenerKlass =
@@ -334,7 +338,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
           CliUtil.newInstance(compressorKlass, CliStrings.CREATE_REGION__COMPRESSOR));
     }
 
-    final String cacheLoader = regionCreateArgs.getCacheLoader();
+    String cacheLoader = regionCreateArgs.getCacheLoader();
     if (cacheLoader != null) {
       Class<CacheLoader<K, V>> cacheLoaderKlass =
           CliUtil.forName(cacheLoader, CliStrings.CREATE_REGION__CACHELOADER);
@@ -342,7 +346,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
           CliUtil.newInstance(cacheLoaderKlass, CliStrings.CREATE_REGION__CACHELOADER));
     }
 
-    final String cacheWriter = regionCreateArgs.getCacheWriter();
+    String cacheWriter = regionCreateArgs.getCacheWriter();
     if (cacheWriter != null) {
       Class<CacheWriter<K, V>> cacheWriterKlass =
           CliUtil.forName(cacheWriter, CliStrings.CREATE_REGION__CACHEWRITER);
@@ -351,7 +355,7 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
 
     String regionName = regionPathData.getName();
-
+    Region<K, V> createdRegion;
     if (parentRegion != null) {
       createdRegion = factory.createSubregion(parentRegion, regionName);
     } else {
@@ -361,13 +365,11 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     return createdRegion;
   }
 
-  @SuppressWarnings("unchecked")
-  private static <K, V> PartitionAttributes<K, V> extractPartitionAttributes(Cache cache,
-      RegionAttributes<K, V> regionAttributes, RegionFunctionArgs regionCreateArgs) {
+  private static <K, V> PartitionAttributes<K, V> extractPartitionAttributes(final Cache cache,
+      final RegionAttributes<K, V> regionAttributes, final RegionFunctionArgs regionCreateArgs) {
     RegionFunctionArgs.PartitionArgs partitionArgs = regionCreateArgs.getPartitionArgs();
 
-    PartitionAttributesFactory<K, V> prAttrFactory = null;
-
+    PartitionAttributesFactory<K, V> prAttrFactory;
     PartitionAttributes<K, V> partitionAttributes = regionAttributes.getPartitionAttributes();
     if (partitionAttributes != null) {
       prAttrFactory = new PartitionAttributesFactory<K, V>(partitionAttributes);
@@ -389,21 +391,27 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
       }
       prAttrFactory.setColocatedWith(colocatedWith);
     }
+
     if (partitionArgs.isSetPRLocalMaxMemory()) {
       prAttrFactory.setLocalMaxMemory(partitionArgs.getPrLocalMaxMemory());
     }
+
     if (partitionArgs.isSetPRTotalMaxMemory()) {
       prAttrFactory.setTotalMaxMemory(partitionArgs.getPrTotalMaxMemory());
     }
+
     if (partitionArgs.isSetPRTotalNumBuckets()) {
       prAttrFactory.setTotalNumBuckets(partitionArgs.getPrTotalNumBuckets());
     }
+
     if (partitionArgs.isSetPRRedundantCopies()) {
       prAttrFactory.setRedundantCopies(partitionArgs.getPrRedundantCopies());
     }
+
     if (partitionArgs.isSetPRRecoveryDelay()) {
       prAttrFactory.setRecoveryDelay(partitionArgs.getPrRecoveryDelay());
     }
+
     if (partitionArgs.isSetPRStartupRecoveryDelay()) {
       prAttrFactory.setStartupRecoveryDelay(partitionArgs.getPrStartupRecoveryDelay());
     }
@@ -415,22 +423,24 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
           .setPartitionResolver((PartitionResolver<K, V>) newInstance(partitionResolverClass,
               CliStrings.CREATE_REGION__PARTITION_RESOLVER));
     }
+
     return prAttrFactory.create();
   }
 
-
-  private static Class<PartitionResolver> forName(String className, String neededFor) {
+  private static Class<PartitionResolver> forName(final String className, final String neededFor) {
     if (StringUtils.isBlank(className)) {
-      throw new IllegalArgumentException(
-          CliStrings.format(CliStrings.CREATE_REGION__MSG__INVALID_PARTITION_RESOLVER,
-              new Object[] {className, neededFor}));
+      throw new IllegalArgumentException(CliStrings
+          .format(CliStrings.CREATE_REGION__MSG__INVALID_PARTITION_RESOLVER, className, neededFor));
     }
+
     try {
       return (Class<PartitionResolver>) ClassPathLoader.getLatest().forName(className);
+
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_REGION_PARTITION_RESOLVER__MSG__COULD_NOT_FIND_CLASS_0_SPECIFIED_FOR_1,
           className, neededFor), e);
+
     } catch (ClassCastException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_REGION__MSG__PARTITION_RESOLVER__CLASS_0_SPECIFIED_FOR_1_IS_NOT_OF_EXPECTED_TYPE,
@@ -438,13 +448,16 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
   }
 
-  private static PartitionResolver newInstance(Class<PartitionResolver> klass, String neededFor) {
+  private static PartitionResolver newInstance(final Class<PartitionResolver> klass,
+      final String neededFor) {
     try {
       return klass.newInstance();
+
     } catch (InstantiationException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_REGION__MSG__PARTITION_RESOLVER__COULD_NOT_INSTANTIATE_CLASS_0_SPECIFIED_FOR_1,
           klass, neededFor), e);
+
     } catch (IllegalAccessException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_REGION__MSG__PARTITION_RESOLVER__COULD_NOT_ACCESS_CLASS_0_SPECIFIED_FOR_1,
@@ -452,8 +465,4 @@ public class RegionCreateFunction extends FunctionAdapter implements InternalEnt
     }
   }
 
-  @Override
-  public String getId() {
-    return ID;
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
index 5e4af3d..3a2becd 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
@@ -15,7 +15,6 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
@@ -25,31 +24,22 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
 /**
- * 
  * @since GemFire 7.0
  */
 public class RegionDestroyFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 9172773671865750685L;
 
-  public static final RegionDestroyFunction INSTANCE = new RegionDestroyFunction();
-
-  private static final String ID = RegionDestroyFunction.class.getName();
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     String regionPath = null;
+
     try {
       String functionId = context.getFunctionId();
       if (getId().equals(functionId)) {
         Object arguments = context.getArguments();
         if (arguments != null) {
           regionPath = (String) arguments;
-          Cache cache = CacheFactory.getAnyInstance();
+          Cache cache = context.getCache();
           Region<?, ?> region = cache.getRegion(regionPath);
           region.destroyRegion();
           String regionName =
@@ -58,22 +48,25 @@ public class RegionDestroyFunction implements Function, InternalEntity {
           context.getResultSender().lastResult(new CliFunctionResult("", xmlEntity, regionPath));
         }
       }
+
       context.getResultSender().lastResult(new CliFunctionResult("", false, "FAILURE"));
+
     } catch (IllegalStateException e) {
       context.getResultSender().lastResult(new CliFunctionResult("", e, null));
+
     } catch (Exception ex) {
       context.getResultSender()
           .lastResult(new CliFunctionResult("",
               new RuntimeException(CliStrings.format(
                   CliStrings.DESTROY_REGION__MSG__ERROR_WHILE_DESTROYING_REGION_0_REASON_1,
-                  new Object[] {regionPath, ex.getMessage()})),
+                  regionPath, ex.getMessage())),
               null));
     }
   }
 
   @Override
-  public String getId() {
-    return ID;
+  public boolean hasResult() {
+    return true;
   }
 
   @Override
@@ -85,4 +78,5 @@ public class RegionDestroyFunction implements Function, InternalEntity {
   public boolean isHA() {
     return false;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
index 3af79eb..96c1cf8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
@@ -44,55 +44,130 @@ public class RegionFunctionArgs implements Serializable {
   private final Boolean skipIfExists;
   private final String keyConstraint;
   private final String valueConstraint;
-  private Boolean statisticsEnabled;
+  private final Boolean statisticsEnabled;
   private final boolean isSetStatisticsEnabled;
   private final RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime;
   private final RegionFunctionArgs.ExpirationAttrs entryExpirationTTL;
   private final RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime;
   private final RegionFunctionArgs.ExpirationAttrs regionExpirationTTL;
   private final String diskStore;
-  private Boolean diskSynchronous;
+  private final Boolean diskSynchronous;
   private final boolean isSetDiskSynchronous;
-  private Boolean enableAsyncConflation;
+  private final Boolean enableAsyncConflation;
   private final boolean isSetEnableAsyncConflation;
-  private Boolean enableSubscriptionConflation;
+  private final Boolean enableSubscriptionConflation;
   private final boolean isSetEnableSubscriptionConflation;
   private final Set<String> cacheListeners;
   private final String cacheLoader;
   private final String cacheWriter;
   private final Set<String> asyncEventQueueIds;
   private final Set<String> gatewaySenderIds;
-  private Boolean concurrencyChecksEnabled;
+  private final Boolean concurrencyChecksEnabled;
   private final boolean isSetConcurrencyChecksEnabled;
-  private Boolean cloningEnabled;
+  private final Boolean cloningEnabled;
   private final boolean isSetCloningEnabled;
-  private Boolean mcastEnabled;
+  private final Boolean mcastEnabled;
   private final boolean isSetMcastEnabled;
-  private Integer concurrencyLevel;
+  private final Integer concurrencyLevel;
   private final boolean isSetConcurrencyLevel;
   private final PartitionArgs partitionArgs;
   private final Integer evictionMax;
-  private String compressor;
+  private final String compressor;
   private final boolean isSetCompressor;
-  private Boolean offHeap;
+  private final Boolean offHeap;
   private final boolean isSetOffHeap;
-  private RegionAttributes<?, ?> regionAttributes;
   private final boolean isPartitionResolver;
-  private String partitionResolver;
-
-  public RegionFunctionArgs(String regionPath, RegionShortcut regionShortcut,
-      String useAttributesFrom, boolean skipIfExists, String keyConstraint, String valueConstraint,
-      Boolean statisticsEnabled, RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime,
-      RegionFunctionArgs.ExpirationAttrs entryExpirationTTL,
-      RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime,
-      RegionFunctionArgs.ExpirationAttrs regionExpirationTTL, String diskStore,
-      Boolean diskSynchronous, Boolean enableAsyncConflation, Boolean enableSubscriptionConflation,
-      String[] cacheListeners, String cacheLoader, String cacheWriter, String[] asyncEventQueueIds,
-      String[] gatewaySenderIds, Boolean concurrencyChecksEnabled, Boolean cloningEnabled,
-      Integer concurrencyLevel, String prColocatedWith, Integer prLocalMaxMemory,
-      Long prRecoveryDelay, Integer prRedundantCopies, Long prStartupRecoveryDelay,
-      Long prTotalMaxMemory, Integer prTotalNumBuckets, Integer evictionMax, String compressor,
-      Boolean offHeap, Boolean mcastEnabled, final String partitionResolver) {
+  private final String partitionResolver;
+  private final RegionAttributes<?, ?> regionAttributes;
+
+  /**
+   * Constructor with RegionShortcut instead of RegionAttributes.
+   *
+   * <p>
+   * NOTE: evictionMax and compressor used to be hardcoded to null but are now passed in.
+   * RegionAttributes is still null.
+   */
+  public RegionFunctionArgs(final String regionPath, final RegionShortcut regionShortcut,
+      final String useAttributesFrom, final boolean skipIfExists, final String keyConstraint,
+      final String valueConstraint, final Boolean statisticsEnabled,
+      final RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime,
+      final RegionFunctionArgs.ExpirationAttrs entryExpirationTTL,
+      final RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime,
+      final RegionFunctionArgs.ExpirationAttrs regionExpirationTTL, final String diskStore,
+      final Boolean diskSynchronous, final Boolean enableAsyncConflation,
+      final Boolean enableSubscriptionConflation, final String[] cacheListeners,
+      final String cacheLoader, final String cacheWriter, final String[] asyncEventQueueIds,
+      final String[] gatewaySenderIds, final Boolean concurrencyChecksEnabled,
+      final Boolean cloningEnabled, final Integer concurrencyLevel, final String prColocatedWith,
+      final Integer prLocalMaxMemory, final Long prRecoveryDelay, final Integer prRedundantCopies,
+      final Long prStartupRecoveryDelay, final Long prTotalMaxMemory,
+      final Integer prTotalNumBuckets, final Integer evictionMax, final String compressor,
+      final Boolean offHeap, final Boolean mcastEnabled, final String partitionResolver) {
+
+    this(regionPath, regionShortcut, useAttributesFrom, skipIfExists, keyConstraint,
+        valueConstraint, statisticsEnabled, entryExpirationIdleTime, entryExpirationTTL,
+        regionExpirationIdleTime, regionExpirationTTL, diskStore, diskSynchronous,
+        enableAsyncConflation, enableSubscriptionConflation, cacheListeners, cacheLoader,
+        cacheWriter, asyncEventQueueIds, gatewaySenderIds, concurrencyChecksEnabled, cloningEnabled,
+        concurrencyLevel, prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies,
+        prStartupRecoveryDelay, prTotalMaxMemory, prTotalNumBuckets, evictionMax, compressor,
+        offHeap, mcastEnabled, partitionResolver, null);
+  }
+
+  /**
+   * Constructor with RegionAttributes instead of RegionShortcut.
+   *
+   * <p>
+   * Note: regionShortcut, evictionMax and compressor are hardcoded to null.
+   */
+  public RegionFunctionArgs(final String regionPath, final String useAttributesFrom,
+      final boolean skipIfExists, final String keyConstraint, final String valueConstraint,
+      final Boolean statisticsEnabled,
+      final RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime,
+      final RegionFunctionArgs.ExpirationAttrs entryExpirationTTL,
+      final RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime,
+      final RegionFunctionArgs.ExpirationAttrs regionExpirationTTL, final String diskStore,
+      final Boolean diskSynchronous, final Boolean enableAsyncConflation,
+      final Boolean enableSubscriptionConflation, final String[] cacheListeners,
+      final String cacheLoader, final String cacheWriter, final String[] asyncEventQueueIds,
+      final String[] gatewaySenderIds, final Boolean concurrencyChecksEnabled,
+      final Boolean cloningEnabled, final Integer concurrencyLevel, final String prColocatedWith,
+      final Integer prLocalMaxMemory, final Long prRecoveryDelay, final Integer prRedundantCopies,
+      final Long prStartupRecoveryDelay, final Long prTotalMaxMemory,
+      final Integer prTotalNumBuckets, final Boolean offHeap, final Boolean mcastEnabled,
+      final String partitionResolver, final RegionAttributes<?, ?> regionAttributes) {
+
+    this(regionPath, null, useAttributesFrom, skipIfExists, keyConstraint, valueConstraint,
+        statisticsEnabled, entryExpirationIdleTime, entryExpirationTTL, regionExpirationIdleTime,
+        regionExpirationTTL, diskStore, diskSynchronous, enableAsyncConflation,
+        enableSubscriptionConflation, cacheListeners, cacheLoader, cacheWriter, asyncEventQueueIds,
+        gatewaySenderIds, concurrencyChecksEnabled, cloningEnabled, concurrencyLevel,
+        prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies,
+        prStartupRecoveryDelay, prTotalMaxMemory, prTotalNumBuckets, null, null, offHeap,
+        mcastEnabled, partitionResolver, regionAttributes);
+  }
+
+  /**
+   * Constructor with everything.
+   */
+  RegionFunctionArgs(final String regionPath, final RegionShortcut regionShortcut,
+      final String useAttributesFrom, final boolean skipIfExists, final String keyConstraint,
+      final String valueConstraint, final Boolean statisticsEnabled,
+      final RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime,
+      final RegionFunctionArgs.ExpirationAttrs entryExpirationTTL,
+      final RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime,
+      final RegionFunctionArgs.ExpirationAttrs regionExpirationTTL, final String diskStore,
+      final Boolean diskSynchronous, final Boolean enableAsyncConflation,
+      final Boolean enableSubscriptionConflation, final String[] cacheListeners,
+      final String cacheLoader, final String cacheWriter, final String[] asyncEventQueueIds,
+      final String[] gatewaySenderIds, final Boolean concurrencyChecksEnabled,
+      final Boolean cloningEnabled, final Integer concurrencyLevel, final String prColocatedWith,
+      final Integer prLocalMaxMemory, final Long prRecoveryDelay, final Integer prRedundantCopies,
+      final Long prStartupRecoveryDelay, final Long prTotalMaxMemory,
+      final Integer prTotalNumBuckets, final Integer evictionMax, final String compressor,
+      final Boolean offHeap, final Boolean mcastEnabled, final String partitionResolver,
+      final RegionAttributes<?, ?> regionAttributes) {
+
     this.regionPath = regionPath;
     this.regionShortcut = regionShortcut;
     this.useAttributesFrom = useAttributesFrom;
@@ -100,63 +175,93 @@ public class RegionFunctionArgs implements Serializable {
     this.keyConstraint = keyConstraint;
     this.valueConstraint = valueConstraint;
     this.evictionMax = evictionMax;
+
     this.isSetStatisticsEnabled = statisticsEnabled != null;
     if (this.isSetStatisticsEnabled) {
       this.statisticsEnabled = statisticsEnabled;
+    } else {
+      this.statisticsEnabled = null;
     }
+
     this.entryExpirationIdleTime = entryExpirationIdleTime;
     this.entryExpirationTTL = entryExpirationTTL;
     this.regionExpirationIdleTime = regionExpirationIdleTime;
     this.regionExpirationTTL = regionExpirationTTL;
     this.diskStore = diskStore;
+
     this.isSetDiskSynchronous = diskSynchronous != null;
     if (this.isSetDiskSynchronous) {
       this.diskSynchronous = diskSynchronous;
+    } else {
+      this.diskSynchronous = null;
     }
+
     this.isSetEnableAsyncConflation = enableAsyncConflation != null;
     if (this.isSetEnableAsyncConflation) {
       this.enableAsyncConflation = enableAsyncConflation;
+    } else {
+      this.enableAsyncConflation = null;
     }
+
     this.isSetEnableSubscriptionConflation = enableSubscriptionConflation != null;
     if (this.isSetEnableSubscriptionConflation) {
       this.enableSubscriptionConflation = enableSubscriptionConflation;
+    } else {
+      this.enableSubscriptionConflation = null;
     }
+
     if (cacheListeners != null) {
       this.cacheListeners = new LinkedHashSet<>();
       this.cacheListeners.addAll(Arrays.asList(cacheListeners));
     } else {
       this.cacheListeners = null;
     }
+
     this.cacheLoader = cacheLoader;
     this.cacheWriter = cacheWriter;
+
     if (asyncEventQueueIds != null) {
       this.asyncEventQueueIds = new LinkedHashSet<>();
       this.asyncEventQueueIds.addAll(Arrays.asList(asyncEventQueueIds));
     } else {
       this.asyncEventQueueIds = null;
     }
+
     if (gatewaySenderIds != null) {
       this.gatewaySenderIds = new LinkedHashSet<>();
       this.gatewaySenderIds.addAll(Arrays.asList(gatewaySenderIds));
     } else {
       this.gatewaySenderIds = null;
     }
+
     this.isSetConcurrencyChecksEnabled = concurrencyChecksEnabled != null;
     if (this.isSetConcurrencyChecksEnabled) {
       this.concurrencyChecksEnabled = concurrencyChecksEnabled;
+    } else {
+      this.concurrencyChecksEnabled = null;
     }
+
     this.isSetCloningEnabled = cloningEnabled != null;
     if (this.isSetCloningEnabled) {
       this.cloningEnabled = cloningEnabled;
+    } else {
+      this.cloningEnabled = null;
     }
+
     this.isSetMcastEnabled = mcastEnabled != null;
     if (isSetMcastEnabled) {
       this.mcastEnabled = mcastEnabled;
+    } else {
+      this.mcastEnabled = null;
     }
+
     this.isSetConcurrencyLevel = concurrencyLevel != null;
     if (this.isSetConcurrencyLevel) {
       this.concurrencyLevel = concurrencyLevel;
+    } else {
+      this.concurrencyLevel = null;
     }
+
     this.partitionArgs =
         new PartitionArgs(prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies,
             prStartupRecoveryDelay, prTotalMaxMemory, prTotalNumBuckets, partitionResolver);
@@ -164,59 +269,35 @@ public class RegionFunctionArgs implements Serializable {
     this.isSetCompressor = (compressor != null);
     if (this.isSetCompressor) {
       this.compressor = compressor;
+    } else {
+      this.compressor = null;
     }
+
     this.isSetOffHeap = (offHeap != null);
     if (this.isSetOffHeap) {
       this.offHeap = offHeap;
+    } else {
+      this.offHeap = null;
     }
+
     this.isPartitionResolver = (partitionResolver != null);
     if (this.isPartitionResolver) {
       this.partitionResolver = partitionResolver;
+    } else {
+      this.partitionResolver = null;
     }
-  }
 
-  // Constructor to be used for supplied region attributes
-  public RegionFunctionArgs(String regionPath, String useAttributesFrom, boolean skipIfExists,
-      String keyConstraint, String valueConstraint, Boolean statisticsEnabled,
-      RegionFunctionArgs.ExpirationAttrs entryExpirationIdleTime,
-      RegionFunctionArgs.ExpirationAttrs entryExpirationTTL,
-      RegionFunctionArgs.ExpirationAttrs regionExpirationIdleTime,
-      RegionFunctionArgs.ExpirationAttrs regionExpirationTTL, String diskStore,
-      Boolean diskSynchronous, Boolean enableAsyncConflation, Boolean enableSubscriptionConflation,
-      String[] cacheListeners, String cacheLoader, String cacheWriter, String[] asyncEventQueueIds,
-      String[] gatewaySenderIds, Boolean concurrencyChecksEnabled, Boolean cloningEnabled,
-      Integer concurrencyLevel, String prColocatedWith, Integer prLocalMaxMemory,
-      Long prRecoveryDelay, Integer prRedundantCopies, Long prStartupRecoveryDelay,
-      Long prTotalMaxMemory, Integer prTotalNumBuckets, Boolean offHeap, Boolean mcastEnabled,
-      RegionAttributes<?, ?> regionAttributes, final String partitionResolver) {
-    this(regionPath, null, useAttributesFrom, skipIfExists, keyConstraint, valueConstraint,
-        statisticsEnabled, entryExpirationIdleTime, entryExpirationTTL, regionExpirationIdleTime,
-        regionExpirationTTL, diskStore, diskSynchronous, enableAsyncConflation,
-        enableSubscriptionConflation, cacheListeners, cacheLoader, cacheWriter, asyncEventQueueIds,
-        gatewaySenderIds, concurrencyChecksEnabled, cloningEnabled, concurrencyLevel,
-        prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies,
-        prStartupRecoveryDelay, prTotalMaxMemory, prTotalNumBuckets, null, null, offHeap,
-        mcastEnabled, partitionResolver);
     this.regionAttributes = regionAttributes;
   }
 
-  /**
-   * @return the regionPath
-   */
   public String getRegionPath() {
     return this.regionPath;
   }
 
-  /**
-   * @return the regionShortcut
-   */
   public RegionShortcut getRegionShortcut() {
     return this.regionShortcut;
   }
 
-  /**
-   * @return the useAttributesFrom
-   */
   public String getUseAttributesFrom() {
     return this.useAttributesFrom;
   }
@@ -229,86 +310,50 @@ public class RegionFunctionArgs implements Serializable {
         && this.regionAttributes != null;
   }
 
-  /**
-   * @return the skipIfExists
-   */
   public Boolean isSkipIfExists() {
     return this.skipIfExists;
   }
 
-  /**
-   * @return the keyConstraint
-   */
   public String getKeyConstraint() {
     return this.keyConstraint;
   }
 
-  /**
-   * @return the valueConstraint
-   */
   public String getValueConstraint() {
     return this.valueConstraint;
   }
 
-  /**
-   * @return the statisticsEnabled
-   */
   public Boolean isStatisticsEnabled() {
     return this.statisticsEnabled;
   }
 
-  /**
-   * @return the isSetStatisticsEnabled
-   */
   public Boolean isSetStatisticsEnabled() {
     return this.isSetStatisticsEnabled;
   }
 
-  /**
-   * @return the entryExpirationIdleTime
-   */
   public RegionFunctionArgs.ExpirationAttrs getEntryExpirationIdleTime() {
     return this.entryExpirationIdleTime;
   }
 
-  /**
-   * @return the entryExpirationTTL
-   */
   public RegionFunctionArgs.ExpirationAttrs getEntryExpirationTTL() {
     return this.entryExpirationTTL;
   }
 
-  /**
-   * @return the regionExpirationIdleTime
-   */
   public RegionFunctionArgs.ExpirationAttrs getRegionExpirationIdleTime() {
     return this.regionExpirationIdleTime;
   }
 
-  /**
-   * @return the regionExpirationTTL
-   */
   public RegionFunctionArgs.ExpirationAttrs getRegionExpirationTTL() {
     return this.regionExpirationTTL;
   }
 
-  /**
-   * @return the diskStore
-   */
   public String getDiskStore() {
     return this.diskStore;
   }
 
-  /**
-   * @return the diskSynchronous
-   */
   public Boolean isDiskSynchronous() {
     return this.diskSynchronous;
   }
 
-  /**
-   * @return the isSetDiskSynchronous
-   */
   public Boolean isSetDiskSynchronous() {
     return this.isSetDiskSynchronous;
   }
@@ -321,37 +366,22 @@ public class RegionFunctionArgs implements Serializable {
     return this.isSetOffHeap;
   }
 
-  /**
-   * @return the enableAsyncConflation
-   */
   public Boolean isEnableAsyncConflation() {
     return this.enableAsyncConflation;
   }
 
-  /**
-   * @return the isSetEnableAsyncConflation
-   */
   public Boolean isSetEnableAsyncConflation() {
     return this.isSetEnableAsyncConflation;
   }
 
-  /**
-   * @return the enableSubscriptionConflation
-   */
   public Boolean isEnableSubscriptionConflation() {
     return this.enableSubscriptionConflation;
   }
 
-  /**
-   * @return the isSetEnableSubscriptionConflation
-   */
   public Boolean isSetEnableSubscriptionConflation() {
     return this.isSetEnableSubscriptionConflation;
   }
 
-  /**
-   * @return the cacheListeners
-   */
   public Set<String> getCacheListeners() {
     if (this.cacheListeners == null) {
       return null;
@@ -359,23 +389,14 @@ public class RegionFunctionArgs implements Serializable {
     return Collections.unmodifiableSet(this.cacheListeners);
   }
 
-  /**
-   * @return the cacheLoader
-   */
   public String getCacheLoader() {
     return this.cacheLoader;
   }
 
-  /**
-   * @return the cacheWriter
-   */
   public String getCacheWriter() {
     return this.cacheWriter;
   }
 
-  /**
-   * @return the asyncEventQueueIds
-   */
   public Set<String> getAsyncEventQueueIds() {
     if (this.asyncEventQueueIds == null) {
       return null;
@@ -383,9 +404,6 @@ public class RegionFunctionArgs implements Serializable {
     return Collections.unmodifiableSet(this.asyncEventQueueIds);
   }
 
-  /**
-   * @return the gatewaySenderIds
-   */
   public Set<String> getGatewaySenderIds() {
     if (this.gatewaySenderIds == null) {
       return null;
@@ -393,72 +411,42 @@ public class RegionFunctionArgs implements Serializable {
     return Collections.unmodifiableSet(this.gatewaySenderIds);
   }
 
-  /**
-   * @return the PartitionResolver
-   */
   public String getPartitionResolver() {
     return this.partitionResolver;
   }
 
-  /**
-   * @return True if Partition Resolver is set otherwise False
-   */
   public Boolean isPartitionResolverSet() {
     return this.isPartitionResolver;
   }
 
-  /**
-   * @return the concurrencyChecksEnabled
-   */
   public Boolean isConcurrencyChecksEnabled() {
     return this.concurrencyChecksEnabled;
   }
 
-  /**
-   * @return the isSetConcurrencyChecksEnabled
-   */
   public Boolean isSetConcurrencyChecksEnabled() {
     return this.isSetConcurrencyChecksEnabled;
   }
 
-  /**
-   * @return the cloningEnabled
-   */
   public Boolean isCloningEnabled() {
     return this.cloningEnabled;
   }
 
-  /**
-   * @return the isSetCloningEnabled
-   */
   public Boolean isSetCloningEnabled() {
     return this.isSetCloningEnabled;
   }
 
-  /**
-   * @return the mcastEnabled setting
-   */
   public Boolean isMcastEnabled() {
     return this.mcastEnabled;
   }
 
-  /**
-   * @return the isSetCloningEnabled
-   */
   public Boolean isSetMcastEnabled() {
     return this.isSetMcastEnabled;
   }
 
-  /**
-   * @return the concurrencyLevel
-   */
   public Integer getConcurrencyLevel() {
     return this.concurrencyLevel;
   }
 
-  /**
-   * @return the isSetConcurrencyLevel
-   */
   public Boolean isSetConcurrencyLevel() {
     return this.isSetConcurrencyLevel;
   }
@@ -468,45 +456,26 @@ public class RegionFunctionArgs implements Serializable {
         || (this.regionShortcut != null && this.regionShortcut.name().startsWith("PARTITION"));
   }
 
-  /**
-   * @return the partitionArgs
-   */
   public boolean hasPartitionAttributes() {
     return this.partitionArgs != null && this.partitionArgs.hasPartitionAttributes();
   }
 
-  /**
-   * @return the partitionArgs
-   */
   public PartitionArgs getPartitionArgs() {
     return this.partitionArgs;
   }
 
-  /**
-   * @return the evictionMax
-   */
   public Integer getEvictionMax() {
     return this.evictionMax;
   }
 
-  /**
-   * @return the compressor.
-   */
   public String getCompressor() {
     return this.compressor;
   }
 
-  /**
-   * @return the isSetCompressor.
-   */
   public boolean isSetCompressor() {
     return this.isSetCompressor;
   }
 
-  /**
-   * @return the regionAttributes
-   */
-  @SuppressWarnings("unchecked")
   public <K, V> RegionAttributes<K, V> getRegionAttributes() {
     return (RegionAttributes<K, V>) this.regionAttributes;
   }
@@ -514,14 +483,16 @@ public class RegionFunctionArgs implements Serializable {
   public static class ExpirationAttrs implements Serializable {
     private static final long serialVersionUID = 1474255033398008062L;
 
-    private ExpirationFor type;
-    private Integer time;
-    private ExpirationAction action;
+    private final ExpirationFor type;
+    private final Integer time;
+    private final ExpirationAction action;
 
-    public ExpirationAttrs(ExpirationFor type, Integer time, String action) {
+    public ExpirationAttrs(final ExpirationFor type, final Integer time, final String action) {
       this.type = type;
       this.time = time;
-      if (action != null) {
+      if (action == null) {
+        this.action = null;
+      } else {
         this.action = getExpirationAction(action);
       }
     }
@@ -536,23 +507,14 @@ public class RegionFunctionArgs implements Serializable {
       return expirationAttr;
     }
 
-    /**
-     * @return the type
-     */
     public ExpirationFor getType() {
       return type;
     }
 
-    /**
-     * @return the time
-     */
     public Integer getTime() {
       return time;
     }
 
-    /**
-     * @return the action
-     */
     public ExpirationAction getAction() {
       return action;
     }
@@ -595,6 +557,7 @@ public class RegionFunctionArgs implements Serializable {
     }
   }
 
+  // TODO: make PartitionArgs immutable
   public static class PartitionArgs implements Serializable {
     private static final long serialVersionUID = 5907052187323280919L;
 
@@ -617,9 +580,10 @@ public class RegionFunctionArgs implements Serializable {
     private boolean hasPartitionAttributes;
     private final Set<String> userSpecifiedPartitionAttributes = new HashSet<>();
 
-    public PartitionArgs(String prColocatedWith, Integer prLocalMaxMemory, Long prRecoveryDelay,
-        Integer prRedundantCopies, Long prStartupRecoveryDelay, Long prTotalMaxMemory,
-        Integer prTotalNumBuckets, String partitionResolver) {
+    public PartitionArgs(final String prColocatedWith, final Integer prLocalMaxMemory,
+        final Long prRecoveryDelay, final Integer prRedundantCopies,
+        final Long prStartupRecoveryDelay, final Long prTotalMaxMemory,
+        final Integer prTotalNumBuckets, final String partitionResolver) {
       this.prColocatedWith = prColocatedWith;
       if (this.prColocatedWith != null) {
         this.hasPartitionAttributes = true;
@@ -667,112 +631,67 @@ public class RegionFunctionArgs implements Serializable {
         this.hasPartitionAttributes = true;
         userSpecifiedPartitionAttributes.add(CliStrings.CREATE_REGION__PARTITION_RESOLVER);
       }
-
     }
 
-    /**
-     * @return the hasPartitionAttributes
-     */
     public Boolean hasPartitionAttributes() {
       return hasPartitionAttributes;
     }
 
-    /**
-     * @return the userSpecifiedPartitionAttributes
-     */
     public String getUserSpecifiedPartitionAttributes() {
       return CliUtil.collectionToString(userSpecifiedPartitionAttributes, -1);
     }
 
-    /**
-     * @return the prColocatedWith
-     */
     public String getPrColocatedWith() {
       return prColocatedWith;
     }
 
-    /**
-     * @return the prLocalMaxMemory
-     */
     public Integer getPrLocalMaxMemory() {
       return prLocalMaxMemory;
     }
 
-    /**
-     * @return the isSetPRLocalMaxMemory
-     */
     public Boolean isSetPRLocalMaxMemory() {
       return isSetPRLocalMaxMemory;
     }
 
-    /**
-     * @return the prRecoveryDelay
-     */
     public Long getPrRecoveryDelay() {
       return prRecoveryDelay;
     }
 
-    /**
-     * @return the isSetPRRecoveryDelay
-     */
     public Boolean isSetPRRecoveryDelay() {
       return isSetPRRecoveryDelay;
     }
 
-    /**
-     * @return the prRedundantCopies
-     */
     public Integer getPrRedundantCopies() {
       return prRedundantCopies;
     }
 
-    /**
-     * @return the isSetPRRedundantCopies
-     */
     public Boolean isSetPRRedundantCopies() {
       return isSetPRRedundantCopies;
     }
 
-    /**
-     * @return the prStartupRecoveryDelay
-     */
     public Long getPrStartupRecoveryDelay() {
       return prStartupRecoveryDelay;
     }
 
-    /**
-     * @return the isSetPRStartupRecoveryDelay
-     */
     public Boolean isSetPRStartupRecoveryDelay() {
       return isSetPRStartupRecoveryDelay;
     }
 
-    /**
-     * @return the prTotalMaxMemory
-     */
     public Long getPrTotalMaxMemory() {
       return prTotalMaxMemory;
     }
 
-    /**
-     * @return the isSetPRTotalMaxMemory
-     */
     public Boolean isSetPRTotalMaxMemory() {
       return isSetPRTotalMaxMemory;
     }
 
-    /**
-     * @return the prTotalNumBuckets
-     */
     public Integer getPrTotalNumBuckets() {
       return prTotalNumBuckets;
     }
 
-    /**
-     * @return the isSetPRTotalNumBuckets
-     */
     public Boolean isSetPRTotalNumBuckets() {
       return isSetPRTotalNumBuckets;
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunction.java
index 2a1b746..bbc5609 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunction.java
@@ -19,11 +19,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.InternalEntity;
-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.partitioned.ColocatedRegionDetails;
@@ -31,21 +30,22 @@ import org.apache.geode.internal.cache.persistence.PersistentMemberID;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
 
-public class ShowMissingDiskStoresFunction extends FunctionAdapter implements InternalEntity {
+public class ShowMissingDiskStoresFunction implements Function, InternalEntity {
 
   @Override
-  public void execute(FunctionContext context) {
-    final Set<PersistentMemberPattern> memberMissingIDs = new HashSet<PersistentMemberPattern>();
-    Set<ColocatedRegionDetails> missingColocatedRegions = new HashSet<ColocatedRegionDetails>();
-
+  public void execute(final FunctionContext context) {
     if (context == null) {
       throw new RuntimeException();
     }
+
+    Set<PersistentMemberPattern> memberMissingIDs = new HashSet<>();
+    Set<ColocatedRegionDetails> missingColocatedRegions = new HashSet<>();
+
     try {
-      final InternalCache cache = (InternalCache) context.getCache();
+      InternalCache cache = (InternalCache) context.getCache();
 
       if (cache != null && !cache.isClosed()) {
-        final DistributedMember member = cache.getMyId();
+        DistributedMember member = cache.getMyId();
 
         // Missing DiskStores
         PersistentMemberManager mm = cache.getPersistentMemberManager();
@@ -55,6 +55,7 @@ public class ShowMissingDiskStoresFunction extends FunctionAdapter implements In
             memberMissingIDs.add(new PersistentMemberPattern(id));
           }
         }
+
         // Missing colocated regions
         Set<PartitionedRegion> prs = cache.getPartitionedRegions();
         for (PartitionedRegion pr : prs) {
@@ -80,13 +81,10 @@ public class ShowMissingDiskStoresFunction extends FunctionAdapter implements In
           context.getResultSender().lastResult(missingColocatedRegions);
         }
       }
+
     } catch (Exception e) {
       context.getResultSender().sendException(e);
     }
   }
 
-  @Override
-  public String getId() {
-    return getClass().getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShutDownFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShutDownFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShutDownFunction.java
index 83d694f..d07c8a8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShutDownFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ShutDownFunction.java
@@ -14,62 +14,57 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.tcp.ConnectionTable;
-import org.apache.logging.log4j.Logger;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
 
 /**
- * 
  * Class for Shutdown function
- * 
- * 
- * 
  */
 public class ShutDownFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = ShutDownFunction.class.getName();
   private static final long serialVersionUID = 1L;
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     try {
-      final InternalDistributedSystem system = InternalDistributedSystem.getConnectedInstance();
-      if (system == null) {
-        return;
-      }
-      String memberName = system.getDistributedMember().getId();
+      Cache cache = context.getCache();
+      String memberName = cache.getDistributedSystem().getDistributedMember().getId();
+
       logger.info("Received GFSH shutdown. Shutting down member " + memberName);
 
-      disconnectInNonDaemonThread(system);
+      disconnectInNonDaemonThread(cache.getDistributedSystem());
 
       context.getResultSender().lastResult("SUCCESS: succeeded in shutting down " + memberName);
+
     } catch (Exception ex) {
       logger.warn("Error during shutdown", ex);
       context.getResultSender().lastResult("FAILURE: failed in shutting down " + ex.getMessage());
     }
   }
 
-  /*
+  /**
    * The shutdown is performed in a separate, non-daemon thread so that the JVM does not shut down
    * prematurely before the full process has completed.
    */
-  private void disconnectInNonDaemonThread(final InternalDistributedSystem ids)
+  private void disconnectInNonDaemonThread(final DistributedSystem system)
       throws InterruptedException, ExecutionException {
     ExecutorService exec = Executors.newSingleThreadExecutor();
     Future future = exec.submit(() -> {
       ConnectionTable.threadWantsSharedResources();
-      if (ids.isConnected()) {
-        ids.disconnect();
+      if (system.isConnected()) {
+        system.disconnect();
       }
     });
     try {
@@ -80,12 +75,6 @@ public class ShutDownFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ShutDownFunction.ID;
-
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/75b06ac0/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
index fbb60a0..5c54744 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
@@ -17,9 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.geode.management.ManagementException;
-import org.apache.geode.management.internal.cli.util.BytesToString;
-import org.apache.geode.management.internal.cli.util.LogExporter;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.execute.Function;
@@ -27,14 +24,16 @@ import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.management.ManagementException;
+import org.apache.geode.management.internal.cli.util.BytesToString;
+import org.apache.geode.management.internal.cli.util.LogExporter;
 import org.apache.geode.management.internal.cli.util.LogFilter;
 
 public class SizeExportLogsFunction extends ExportLogsFunction implements Function, InternalEntity {
-  private static final Logger LOGGER = LogService.getLogger();
   private static final long serialVersionUID = 1L;
+  private static final Logger logger = LogService.getLogger();
 
   @Override
   public void execute(final FunctionContext context) {
@@ -58,20 +57,19 @@ public class SizeExportLogsFunction extends ExportLogsFunction implements Functi
       }
 
     } catch (Exception e) {
-      e.printStackTrace();
-      LOGGER.error(e.getMessage());
+      logger.error(e);
       context.getResultSender().sendException(e);
     }
   }
 
-  long getDiskAvailable(DistributionConfig config) {
+  long getDiskAvailable(final DistributionConfig config) {
     return config.getLogFile().getUsableSpace();
   }
 
   long estimateLogFileSize(final DistributedMember member, final File logFile,
       final File statArchive, final Args args) throws IOException {
-    if (LOGGER.isDebugEnabled()) {
-      LOGGER.debug("SizeExportLogsFunction started for member {}", member);
+    if (logger.isDebugEnabled()) {
+      logger.debug("SizeExportLogsFunction started for member {}", member);
     }
 
     File baseLogFile = null;
@@ -90,8 +88,9 @@ public class SizeExportLogsFunction extends ExportLogsFunction implements Functi
     long estimatedSize =
         new LogExporter(logFilter, baseLogFile, baseStatsFile).estimateFilteredSize();
 
-    LOGGER.info("Estimated log file size: " + estimatedSize);
+    logger.info("Estimated log file size: " + estimatedSize);
 
     return estimatedSize;
   }
+
 }


Mime
View raw message