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/08/01 20:59:52 UTC

[1/4] geode git commit: Convert to use FunctionContext.getCache() [Forced Update!]

Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-3299 7c6c0b941 -> b49367e70 (forced update)


http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
index 031c855..c3563c7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
@@ -16,46 +16,37 @@ package org.apache.geode.management.internal.cli.functions;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.StringTokenizer;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.geode.internal.ClassPathLoader;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
+import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 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.ClassPathLoader;
 import org.apache.geode.internal.DeployedJar;
+import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.JarDeployer;
-import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 
 public class UndeployFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = UndeployFunction.class.getName();
-
   private static final long serialVersionUID = 1L;
-
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
-      final Object[] args = (Object[]) context.getArguments();
-      final String[] jarFilenameList = (String[]) args[0]; // Comma separated
-      InternalCache cache = getCache();
+      Object[] args = (Object[]) context.getArguments();
+      String[] jarFilenameList = (String[]) args[0]; // Comma separated
+      Cache cache = context.getCache();
 
-      final JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
+      JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -67,8 +58,9 @@ public class UndeployFunction implements Function, InternalEntity {
 
       String[] undeployedJars = new String[0];
       if (ArrayUtils.isEmpty(jarFilenameList)) {
-        final List<DeployedJar> jarClassLoaders = jarDeployer.findDeployedJars();
+        List<DeployedJar> jarClassLoaders = jarDeployer.findDeployedJars();
         undeployedJars = new String[jarClassLoaders.size() * 2];
+
         int index = 0;
         for (DeployedJar jarClassLoader : jarClassLoaders) {
           undeployedJars[index++] = jarClassLoader.getJarName();
@@ -80,8 +72,9 @@ public class UndeployFunction implements Function, InternalEntity {
             undeployedJars[index++] = iaex.getMessage();
           }
         }
+
       } else {
-        List<String> undeployedList = new ArrayList<String>();
+        List<String> undeployedList = new ArrayList<>();
         for (String jarFilename : jarFilenameList) {
           try {
             undeployedList.add(jarFilename);
@@ -114,11 +107,6 @@ public class UndeployFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }
@@ -132,4 +120,5 @@ public class UndeployFunction implements Function, InternalEntity {
   public boolean isHA() {
     return false;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UnregisterFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UnregisterFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UnregisterFunction.java
index 18e16ac..80c670d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UnregisterFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UnregisterFunction.java
@@ -14,44 +14,29 @@
  */
 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.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.admin.remote.ShutdownAllRequest;
 
 /**
- * 
  * Class for Unregister function
- * 
- * 
- * 
  */
-
-
 public class UnregisterFunction implements Function, InternalEntity {
-  public static final String ID = UnregisterFunction.class.getName();
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     Object[] args = (Object[]) context.getArguments();
     String functionId = (String) args[0];
+
     try {
       FunctionService.unregisterFunction(functionId);
+      context.getResultSender().lastResult("Succeeded in unregistering");
+
     } catch (Exception e) {
       context.getResultSender().lastResult("Failed in unregistering " + e.getMessage());
     }
-    context.getResultSender().lastResult("Succeeded in unregistering");
-  }
-
-  @Override
-  public String getId() {
-    return UnregisterFunction.ID;
-
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
index 1f9a607..e95a16f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
@@ -19,7 +19,6 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.execute.Execution;
 import org.apache.geode.cache.execute.Function;
@@ -33,20 +32,18 @@ import org.apache.geode.management.internal.cli.GfshParser;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
 /**
- * 
  * @since GemFire 7.0
  */
 public class UserFunctionExecution implements Function, InternalEntity {
-  public static final String ID = UserFunctionExecution.class.getName();
-
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
       String[] functionArgs = null;
+
       Object[] args = (Object[]) context.getArguments();
       if (args != null) {
         String functionId = ((String) args[0]);
@@ -115,6 +112,7 @@ public class UserFunctionExecution implements Function, InternalEntity {
                 }
               }
               context.getResultSender().lastResult(resultMessage);
+
             } else {
               context.getResultSender()
                   .lastResult(CliStrings.format(
@@ -129,12 +127,14 @@ public class UserFunctionExecution implements Function, InternalEntity {
               .lastResult(CliStrings.format(
                   CliStrings.EXECUTE_FUNCTION__MSG__RESULT_COLLECTOR_0_NOT_FOUND_ERROR_1,
                   resultCollectorName, e.getMessage()));
+
         } catch (Exception e) {
           context.getResultSender()
               .lastResult(CliStrings.format(
                   CliStrings.EXECUTE_FUNCTION__MSG__ERROR_IN_EXECUTING_ON_MEMBER_1_DETAILS_2,
                   functionId, member.getId(), e.getMessage()));
         }
+
       } else {
         context.getResultSender()
             .lastResult(CliStrings.EXECUTE_FUNCTION__MSG__COULD_NOT_RETRIEVE_ARGUMENTS);
@@ -146,11 +146,6 @@ public class UserFunctionExecution implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return UserFunctionExecution.ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/TimeParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/TimeParser.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/TimeParser.java
new file mode 100644
index 0000000..a6603fd
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/TimeParser.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+
+import org.apache.geode.management.internal.cli.commands.ExportLogsCommand;
+
+/**
+ * Extracted from {@link org.apache.geode.management.internal.cli.functions.ExportLogsFunction}.
+ */
+public class TimeParser {
+
+  public static LocalDateTime parseTime(String dateString) {
+    if (dateString == null) {
+      return null;
+    }
+
+    try {
+      SimpleDateFormat df = new SimpleDateFormat(ExportLogsCommand.FORMAT);
+      return df.parse(dateString).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+    } catch (ParseException e) {
+      try {
+        SimpleDateFormat df = new SimpleDateFormat(ExportLogsCommand.ONLY_DATE_FORMAT);
+        return df.parse(dateString).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+      } catch (ParseException e1) {
+        return null;
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
index 4c1f2cb..9d6ff52 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
@@ -48,7 +48,6 @@ import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.cache.server.ClientSubscriptionConfig;
 import org.apache.geode.cache.wan.GatewaySender;
-import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.lang.Filter;
@@ -204,8 +203,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
     return cacheServerDetails;
   }
 
-  private DescribeDiskStoreFunction createDescribeDiskStoreFunction(final Cache cache) {
-    return new TestDescribeDiskStoreFunction(cache);
+  private DescribeDiskStoreFunction createDescribeDiskStoreFunction() {
+    return new DescribeDiskStoreFunction();
   }
 
   private File[] createFileArray(final String... locations) {
@@ -520,6 +519,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
         will(returnValue(diskStoreName));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
@@ -535,7 +536,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
     final Set<DiskStoreDetails.AsyncEventQueueDetails> expectedAsyncEventQueueDetails =
         setupAsyncEventQueuesForTestExecute(mockCache, diskStoreName);
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.execute(mockFunctionContext);
 
@@ -585,32 +586,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
   }
 
   @Test
-  public void testExecuteOnMemberHavingANonGemFireCache() throws Throwable {
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
-    final FunctionContext mockFunctionContext =
-        mockContext.mock(FunctionContext.class, "FunctionContext");
-
-    final TestResultSender testResultSender = new TestResultSender();
-
-    mockContext.checking(new Expectations() {
-      {
-        exactly(0).of(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
-
-    function.execute(mockFunctionContext);
-
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertTrue(results.isEmpty());
-  }
-
-  @Test
   public void testExecuteThrowingDiskStoreNotFoundException() throws Exception {
     final String diskStoreName = "testDiskStore";
     final String memberId = "mockMemberId";
@@ -640,10 +615,12 @@ public class DescribeDiskStoreFunctionJUnitTest {
         will(returnValue(diskStoreName));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.execute(mockFunctionContext);
 
@@ -683,10 +660,12 @@ public class DescribeDiskStoreFunctionJUnitTest {
         will(returnValue(diskStoreName));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.execute(mockFunctionContext);
 
@@ -740,10 +719,12 @@ public class DescribeDiskStoreFunctionJUnitTest {
         will(returnValue(diskStoreName));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.execute(mockFunctionContext);
 
@@ -769,7 +750,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockRegion));
   }
@@ -789,7 +770,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME, function.getDiskStoreName(mockRegion));
   }
@@ -813,7 +794,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isOverflowToDisk(mockRegion));
   }
@@ -837,7 +818,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isOverflowToDisk(mockRegion));
   }
@@ -857,7 +838,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isOverflowToDisk(mockRegion));
   }
@@ -877,7 +858,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isPersistent(mockRegion));
   }
@@ -897,7 +878,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isPersistent(mockRegion));
   }
@@ -917,7 +898,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isPersistent(mockRegion));
   }
@@ -937,7 +918,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isPersistent(mockRegion));
   }
@@ -957,7 +938,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isPersistent(mockRegion));
   }
@@ -977,7 +958,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isPersistent(mockRegion));
   }
@@ -1002,7 +983,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockRegion, mockDiskStore));
   }
@@ -1029,7 +1010,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockRegion, mockDiskStore));
   }
@@ -1062,7 +1043,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockRegion, mockDiskStore));
   }
@@ -1087,7 +1068,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isUsingDiskStore(mockRegion, mockDiskStore));
   }
@@ -1237,7 +1218,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.setRegionDetails(mockCache, mockDiskStore, diskStoreDetails);
 
@@ -1261,7 +1242,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockCacheServer));
   }
@@ -1281,7 +1262,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME,
         function.getDiskStoreName(mockCacheServer));
@@ -1298,7 +1279,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertNull(function.getDiskStoreName(mockCacheServer));
   }
@@ -1323,7 +1304,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
   }
@@ -1346,7 +1327,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
   }
@@ -1369,7 +1350,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
   }
@@ -1421,7 +1402,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.setCacheServerDetails(mockCache, mockDiskStore, diskStoreDetails);
 
@@ -1441,7 +1422,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockGatewaySender));
   }
@@ -1457,7 +1438,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME,
         function.getDiskStoreName(mockGatewaySender));
@@ -1474,7 +1455,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isPersistent(mockGatewaySender));
   }
@@ -1490,7 +1471,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isPersistent(mockGatewaySender));
   }
@@ -1512,7 +1493,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
   }
@@ -1532,7 +1513,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
   }
@@ -1552,7 +1533,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
   }
@@ -1578,7 +1559,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails);
 
@@ -1604,7 +1585,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     final DiskStoreDetails diskStoreDetails = new DiskStoreDetails("testDiskStore", "memberOne");
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails);
 
@@ -1626,7 +1607,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     final DiskStoreDetails diskStoreDetails = new DiskStoreDetails("testDiskStore", "memberOne");
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails);
 
@@ -1646,7 +1627,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockQueue));
   }
@@ -1662,7 +1643,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME, function.getDiskStoreName(mockQueue));
   }
@@ -1686,7 +1667,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockQueue, mockDiskStore));
   }
@@ -1708,7 +1689,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isUsingDiskStore(mockQueue, mockDiskStore));
   }
@@ -1728,7 +1709,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertFalse(function.isUsingDiskStore(mockQueue, mockDiskStore));
   }
@@ -1750,7 +1731,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
       }
     });
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     assertTrue(function.isUsingDiskStore(mockQueue, mockDiskStore));
   }
@@ -1793,27 +1774,13 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
 
-    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
+    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction();
 
     function.setAsyncEventQueueDetails(mockCache, mockDiskStore, diskStoreDetails);
 
     assertAsyncEventQueueDetails(expectedAsyncEventQueueDetails, diskStoreDetails);
   }
 
-  private static class TestDescribeDiskStoreFunction extends DescribeDiskStoreFunction {
-
-    private final Cache cache;
-
-    public TestDescribeDiskStoreFunction(final Cache cache) {
-      this.cache = cache;
-    }
-
-    @Override
-    protected Cache getCache() {
-      return this.cache;
-    }
-  }
-
   private static class TestResultSender implements ResultSender {
 
     private final List<Object> results = new LinkedList<>();

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunctionJUnitTest.java
index a8b9193..67c9503 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunctionJUnitTest.java
@@ -34,11 +34,9 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.ResultSender;
-import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.internal.cache.InternalCache;
@@ -85,8 +83,8 @@ public class ListDiskStoresFunctionJUnitTest {
     return new DiskStoreDetails(id, name, memberId, memberName);
   }
 
-  private ListDiskStoresFunction createListDiskStoresFunction(final Cache cache) {
-    return new TestListDiskStoresFunction(cache);
+  private ListDiskStoresFunction createListDiskStoresFunction() {
+    return new ListDiskStoresFunction();
   }
 
   @Test
@@ -144,10 +142,12 @@ public class ListDiskStoresFunctionJUnitTest {
         will(returnValue("ds-persistence"));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final ListDiskStoresFunction function = createListDiskStoresFunction(mockCache);
+    final ListDiskStoresFunction function = createListDiskStoresFunction();
 
     function.execute(mockFunctionContext);
 
@@ -171,13 +171,7 @@ public class ListDiskStoresFunctionJUnitTest {
     final FunctionContext mockFunctionContext =
         mockContext.mock(FunctionContext.class, "MockFunctionContext");
 
-    final ListDiskStoresFunction testListDiskStoresFunction =
-        new TestListDiskStoresFunction(mockContext.mock(Cache.class, "MockCache")) {
-          @Override
-          protected Cache getCache() {
-            throw new CacheClosedException("Expected");
-          }
-        };
+    final ListDiskStoresFunction testListDiskStoresFunction = new ListDiskStoresFunction();
 
     final TestResultSender testResultSender = new TestResultSender();
 
@@ -185,6 +179,9 @@ public class ListDiskStoresFunctionJUnitTest {
       {
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+
+        allowing(mockFunctionContext).getCache();
+        will(throwException(new CacheClosedException("Expected")));
       }
     });
 
@@ -219,10 +216,12 @@ public class ListDiskStoresFunctionJUnitTest {
         will(returnValue(Collections.emptyList()));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final ListDiskStoresFunction function = createListDiskStoresFunction(mockCache);
+    final ListDiskStoresFunction function = createListDiskStoresFunction();
 
     function.execute(mockFunctionContext);
 
@@ -240,7 +239,7 @@ public class ListDiskStoresFunctionJUnitTest {
   @Test
   @SuppressWarnings("unchecked")
   public void testExecuteOnMemberWithANonGemFireCache() throws Throwable {
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
 
     final FunctionContext mockFunctionContext =
         mockContext.mock(FunctionContext.class, "FunctionContext");
@@ -251,10 +250,14 @@ public class ListDiskStoresFunctionJUnitTest {
       {
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
+        allowing(mockCache).getMyId();
+        allowing(mockCache).listDiskStoresIncludingRegionOwned();
       }
     });
 
-    final ListDiskStoresFunction function = createListDiskStoresFunction(mockCache);
+    final ListDiskStoresFunction function = createListDiskStoresFunction();
 
     function.execute(mockFunctionContext);
 
@@ -289,10 +292,12 @@ public class ListDiskStoresFunctionJUnitTest {
         will(throwException(new RuntimeException("expected")));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final ListDiskStoresFunction function = createListDiskStoresFunction(mockCache);
+    final ListDiskStoresFunction function = createListDiskStoresFunction();
 
     function.execute(mockFunctionContext);
 
@@ -305,21 +310,6 @@ public class ListDiskStoresFunctionJUnitTest {
     }
   }
 
-  private static class TestListDiskStoresFunction extends ListDiskStoresFunction {
-
-    private final Cache cache;
-
-    public TestListDiskStoresFunction(final Cache cache) {
-      assert cache != null : "The Cache cannot be null!";
-      this.cache = cache;
-    }
-
-    @Override
-    protected Cache getCache() {
-      return cache;
-    }
-  }
-
   private static class TestResultSender implements ResultSender {
 
     private final List<Object> results = new LinkedList<Object>();

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListIndexFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListIndexFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListIndexFunctionJUnitTest.java
index 583aa56..335598c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListIndexFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ListIndexFunctionJUnitTest.java
@@ -155,8 +155,8 @@ public class ListIndexFunctionJUnitTest {
     return indexStatisticsDetails;
   }
 
-  private ListIndexFunction createListIndexFunction(final Cache cache) {
-    return new TestListIndexFunction(cache);
+  private ListIndexFunction createListIndexFunction() {
+    return new ListIndexFunction();
   }
 
   private Index createMockIndex(final IndexDetails indexDetails) {
@@ -297,10 +297,12 @@ public class ListIndexFunctionJUnitTest {
                 createMockIndex(indexDetailsThree), createMockIndex(indexDetailsFour))));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final ListIndexFunction function = createListIndexFunction(mockCache);
+    final ListIndexFunction function = createListIndexFunction();
 
     function.execute(mockFunctionContext);
 
@@ -357,10 +359,12 @@ public class ListIndexFunctionJUnitTest {
         will(returnValue(Collections.emptyList()));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final ListIndexFunction function = createListIndexFunction(mockCache);
+    final ListIndexFunction function = createListIndexFunction();
 
     function.execute(mockFunctionContext);
 
@@ -403,10 +407,12 @@ public class ListIndexFunctionJUnitTest {
         will(throwException(new RuntimeException("expected")));
         oneOf(mockFunctionContext).getResultSender();
         will(returnValue(testResultSender));
+        allowing(mockFunctionContext).getCache();
+        will(returnValue(mockCache));
       }
     });
 
-    final ListIndexFunction function = createListIndexFunction(mockCache);
+    final ListIndexFunction function = createListIndexFunction();
 
     function.execute(mockFunctionContext);
 
@@ -419,21 +425,6 @@ public class ListIndexFunctionJUnitTest {
     }
   }
 
-  private static class TestListIndexFunction extends ListIndexFunction {
-
-    private final Cache cache;
-
-    protected TestListIndexFunction(final Cache cache) {
-      assert cache != null : "The Cache cannot be null!";
-      this.cache = cache;
-    }
-
-    @Override
-    protected Cache getCache() {
-      return this.cache;
-    }
-  }
-
   private static class TestResultSender implements ResultSender {
 
     private final List<Object> results = new LinkedList<Object>();

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
index e5a111c..2e62d74 100755
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
@@ -248,7 +248,6 @@ org/apache/geode/internal/SystemAdmin$CombinedResources,false
 org/apache/geode/internal/admin/CompoundEntrySnapshot,true,5776382582897895718,allUserAttributes:java/util/Set,allValues:java/util/Set,hitRatio:float,hitRatioSum:double,hitResponders:long,lastAccessTime:long,lastModifiedTime:long,name:java/lang/Object,numHits:long,numMisses:long
 org/apache/geode/internal/admin/CompoundRegionSnapshot,true,6295026394298398004,allCacheLoaders:java/util/Set,allCacheWriters:java/util/Set,allCapControllers:java/util/Set,allConcLevels:java/util/Set,allCustomIdle:java/util/HashSet,allCustomTtl:java/util/HashSet,allDataPolicies:java/util/Set,allEntryIdleTimeout:java/util/Set,allEntryTtl:java/util/Set,allInitialCaps:java/util/Set,allKeyConstraints:java/util/Set,allListeners:java/util/Set,allLoadFactors:java/util/Set,allRegionIdleTimeout:java/util/Set,allRegionTtl:java/util/Set,allScopes:java/util/Set,allStatsEnabled:java/util/Set,allUserAttributes:java/util/Set,allValueConstraints:java/util/Set,hitRatio:float,hitRatioSum:double,hitResponders:long,lastAccessTime:long,lastModifiedTime:long,name:java/lang/String,numHits:long,numMisses:long
 org/apache/geode/internal/admin/StatAlert,true,5725457607122449170,definitionId:int,time:java/util/Date,values:java/lang/Number[]
-org/apache/geode/internal/admin/remote/DistributionLocatorId,true,6587390186971937865,bindAddress:java/lang/String,host:java/net/InetAddress,hostnameForClients:java/lang/String,peerLocator:boolean,port:int,serverLocator:boolean
 org/apache/geode/internal/admin/remote/EntryValueNodeImpl,false,fields:org/apache/geode/internal/admin/remote/EntryValueNodeImpl[],name:java/lang/String,primitive:boolean,primitiveVal:java/lang/Object,type:java/lang/String
 org/apache/geode/internal/cache/BackupLock,false,backupDone:java/util/concurrent/locks/Condition,backupThread:java/lang/Thread,isBackingUp:boolean
 org/apache/geode/internal/cache/BucketAdvisor$SetFromMap,true,2454657854757543876,m:java/util/Map
@@ -448,7 +447,6 @@ org/apache/geode/internal/process/PidUnavailableException,true,-1660269538268828
 org/apache/geode/internal/process/signal/Signal,false,description:java/lang/String,name:java/lang/String,number:int,type:org/apache/geode/internal/process/signal/SignalType
 org/apache/geode/internal/process/signal/SignalEvent,false,signal:org/apache/geode/internal/process/signal/Signal
 org/apache/geode/internal/process/signal/SignalType,false,description:java/lang/String
-org/apache/geode/internal/security/SecurityServiceType,false
 org/apache/geode/internal/sequencelog/GraphType,false
 org/apache/geode/internal/sequencelog/model/GraphID,false,graphName:java/lang/String,type:org/apache/geode/internal/sequencelog/GraphType
 org/apache/geode/internal/size/ReflectionObjectSizer,false
@@ -541,9 +539,6 @@ org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction,
 org/apache/geode/management/internal/cli/functions/CreateDiskStoreFunction,true,1
 org/apache/geode/management/internal/cli/functions/CreateIndexFunction,true,1
 org/apache/geode/management/internal/cli/functions/DataCommandFunction,true,1,optimizeForWrite:boolean
-org/apache/geode/management/internal/cli/functions/DataCommandFunction$SelectExecStep,true,1
-org/apache/geode/management/internal/cli/functions/DataCommandFunction$SelectMoveStep,true,1
-org/apache/geode/management/internal/cli/functions/DataCommandFunction$SelectQuitStep,true,1
 org/apache/geode/management/internal/cli/functions/DeployFunction,true,1
 org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction,false
 org/apache/geode/management/internal/cli/functions/DestroyDiskStoreFunction,true,1
@@ -575,10 +570,9 @@ org/apache/geode/management/internal/cli/functions/ListDiskStoresFunction,false
 org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction,true,1
 org/apache/geode/management/internal/cli/functions/ListFunctionFunction,true,1
 org/apache/geode/management/internal/cli/functions/ListIndexFunction,false
-org/apache/geode/management/internal/cli/functions/MemberRegionFunction,true,1
 org/apache/geode/management/internal/cli/functions/MembersForRegionFunction,true,8746830191680509335
 org/apache/geode/management/internal/cli/functions/NetstatFunction,true,1
-org/apache/geode/management/internal/cli/functions/NetstatFunction$NetstatFunctionArgument,true,1,lineSeparator:java/lang/String,withlsof:boolean
+org/apache/geode/management/internal/cli/functions/NetstatFunction$NetstatFunctionArgument,true,1,lineSeparator:java/lang/String,withLsof:boolean
 org/apache/geode/management/internal/cli/functions/NetstatFunction$NetstatFunctionResult,true,1,compressedBytes:org/apache/geode/management/internal/cli/CliUtil$DeflaterInflaterData,headerInfo:java/lang/String,host:java/lang/String
 org/apache/geode/management/internal/cli/functions/RebalanceFunction,true,1
 org/apache/geode/management/internal/cli/functions/RegionAlterFunction,true,-4846425364943216425
@@ -595,9 +589,6 @@ org/apache/geode/management/internal/cli/functions/UndeployFunction,true,1
 org/apache/geode/management/internal/cli/functions/UnregisterFunction,true,1
 org/apache/geode/management/internal/cli/functions/UserFunctionExecution,true,1
 org/apache/geode/management/internal/cli/json/GfJsonException,true,36449998984143318
-org/apache/geode/management/internal/cli/multistep/CLIMultiStepHelper$RemoteStep,false,commandArguments:java/lang/Object[],name:java/lang/String
-org/apache/geode/management/internal/cli/multistep/CLIMultiStepHelper$StepExecutionException,true,1,message:java/lang/String
-org/apache/geode/management/internal/cli/multistep/CLIStepExecption,false,result:org/apache/geode/management/cli/Result
 org/apache/geode/management/internal/cli/result/CommandResultException,true,1,result:org/apache/geode/management/cli/Result
 org/apache/geode/management/internal/cli/result/ResultDataException,true,3851919811942980944
 org/apache/geode/management/internal/cli/result/TableBuilder$Align,false


[4/4] geode git commit: Convert to use FunctionContext.getCache()

Posted by kl...@apache.org.
Convert to use FunctionContext.getCache()


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

Branch: refs/heads/feature/GEODE-3299
Commit: b49367e703c5064e22f830b3c79a2434bd21ceb1
Parents: 0675317
Author: Kirk Lund <kl...@apache.org>
Authored: Mon Jul 24 12:44:37 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Tue Aug 1 13:59:41 2017 -0700

----------------------------------------------------------------------
 .../geode/cache/execute/FunctionContext.java    |  17 +-
 .../CreateAlterDestroyRegionCommands.java       |  20 +-
 .../cli/commands/ExportLogsInterceptor.java     |   8 +-
 .../cli/commands/MiscellaneousCommands.java     |   2 +-
 .../internal/cli/commands/WanCommands.java      |   8 +-
 .../functions/AlterRuntimeConfigFunction.java   |  32 +-
 .../functions/AsyncEventQueueFunctionArgs.java  |  48 +--
 .../cli/functions/ChangeLogLevelFunction.java   |  42 +-
 .../cli/functions/CliFunctionResult.java        |  41 +-
 .../functions/CloseDurableClientFunction.java   |  22 +-
 .../cli/functions/CloseDurableCqFunction.java   |  24 +-
 .../cli/functions/ContinuousQueryFunction.java  |  43 ++-
 .../CreateAsyncEventQueueFunction.java          |  27 +-
 .../functions/CreateDefinedIndexesFunction.java |  35 +-
 .../cli/functions/CreateDiskStoreFunction.java  |  38 +-
 .../cli/functions/CreateIndexFunction.java      |  35 +-
 .../internal/cli/functions/DeployFunction.java  |  27 +-
 .../functions/DescribeDiskStoreFunction.java    | 150 +++-----
 .../cli/functions/DestroyDiskStoreFunction.java |  24 +-
 .../cli/functions/DestroyIndexFunction.java     |  26 +-
 .../cli/functions/ExportConfigFunction.java     |  22 +-
 .../cli/functions/ExportDataFunction.java       |  29 +-
 .../cli/functions/ExportLogsFunction.java       |  72 ++--
 .../FetchRegionAttributesFunction.java          |  60 +--
 .../FetchSharedConfigurationStatusFunction.java |  19 +-
 .../functions/GarbageCollectionFunction.java    |  19 +-
 .../GatewayReceiverCreateFunction.java          |  55 ++-
 .../functions/GatewayReceiverFunctionArgs.java  |  13 +-
 .../functions/GatewaySenderCreateFunction.java  |  49 +--
 .../functions/GatewaySenderDestroyFunction.java |  25 +-
 .../GatewaySenderDestroyFunctionArgs.java       |   6 +-
 .../functions/GatewaySenderFunctionArgs.java    |  18 +-
 .../GetMemberConfigInformationFunction.java     |  99 ++---
 .../functions/GetMemberInformationFunction.java | 100 ++---
 .../functions/GetRegionDescriptionFunction.java |  21 +-
 .../cli/functions/GetRegionsFunction.java       |  11 +-
 .../cli/functions/GetStackTracesFunction.java   |  17 +-
 .../GetSubscriptionQueueSizeFunction.java       |  21 +-
 .../cli/functions/ImportDataFunction.java       |  30 +-
 .../functions/ListAsyncEventQueuesFunction.java |  24 +-
 .../cli/functions/ListDeployedFunction.java     |  33 +-
 .../cli/functions/ListDiskStoresFunction.java   |  40 +-
 .../functions/ListDurableCqNamesFunction.java   |  26 +-
 .../cli/functions/ListFunctionFunction.java     |  25 +-
 .../cli/functions/ListIndexFunction.java        |  25 +-
 .../cli/functions/MemberRegionFunction.java     |  83 ----
 .../cli/functions/MembersForRegionFunction.java |  31 +-
 .../internal/cli/functions/NetstatFunction.java | 115 +++---
 .../cli/functions/RebalanceFunction.java        |  55 ++-
 .../cli/functions/RegionAlterFunction.java      |  80 ++--
 .../cli/functions/RegionCreateFunction.java     | 129 ++++---
 .../cli/functions/RegionDestroyFunction.java    |  26 +-
 .../cli/functions/RegionFunctionArgs.java       | 385 ++++++++-----------
 .../ShowMissingDiskStoresFunction.java          |  24 +-
 .../cli/functions/ShutDownFunction.java         |  51 +--
 .../cli/functions/SizeExportLogsFunction.java   |  21 +-
 .../cli/functions/UndeployFunction.java         |  39 +-
 .../cli/functions/UnregisterFunction.java       |  23 +-
 .../cli/functions/UserFunctionExecution.java    |  17 +-
 .../internal/cli/util/TimeParser.java           |  47 +++
 .../DescribeDiskStoreFunctionJUnitTest.java     | 141 +++----
 .../ListDiskStoresFunctionJUnitTest.java        |  52 +--
 .../functions/ListIndexFunctionJUnitTest.java   |  31 +-
 .../codeAnalysis/sanctionedSerializables.txt    |  11 +-
 64 files changed, 1178 insertions(+), 1711 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
index 0b4e7f9..00c877b 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
@@ -19,20 +19,21 @@ import org.apache.geode.cache.Cache;
 /**
  * Defines the execution context of a {@link Function}. It is required by the
  * {@link Function#execute(FunctionContext)} to execute a {@link Function} on a particular member.
+ *
  * <p>
  * A context can be data dependent or data independent. For data dependent functions refer to
  * {@link RegionFunctionContext}
- * </p>
+ *
  * <p>
  * This interface is implemented by GemFire. Instances of it will be passed in to
  * {@link Function#execute(FunctionContext)}.
- * 
- * @param T1 object type of Arguments
+ *
+ * <p>
+ * T1 object type of Arguments
  *
  * @since GemFire 6.0
  *
  * @see RegionFunctionContext
- *
  */
 public interface FunctionContext<T1> {
   /**
@@ -64,7 +65,6 @@ public interface FunctionContext<T1> {
    * @return ResultSender
    * @since GemFire 6.0
    */
-
   public <T2> ResultSender<T2> getResultSender();
 
   /**
@@ -78,5 +78,12 @@ public interface FunctionContext<T1> {
    */
   public boolean isPossibleDuplicate();
 
+  /**
+   * Returns a reference to the Cache.
+   *
+   * @return a reference to the Cache
+   *
+   * @since Geode 1.2
+   */
   public Cache getCache();
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
index 2c61b73..4d6e0c7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
@@ -259,6 +259,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
         String cacheWriterClass =
             cacheWriter != null ? cacheWriter : regionAttributesResult.getCacheWriterClass();
 
+        // use constructor with RegionAttributes (NOTE: evictionMax and compressor are null)
         regionFunctionArgs = new RegionFunctionArgs(regionPath, useAttributesFrom, skipIfExists,
             keyConstraint, valueConstraint, statisticsEnabled, entryIdle, entryTTL, regionIdle,
             regionTTL, diskStore, diskSynchronous, enableAsyncConflation,
@@ -266,7 +267,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
             asyncEventQueueIds, gatewaySenderIds, concurrencyChecksEnabled, cloningEnabled,
             concurrencyLevel, prColocatedWith, prLocalMaxMemory, prRecoveryDelay, prRedundantCopies,
             prStartupRecoveryDelay, prTotalMaxMemory, prTotalNumBuckets, offHeap, mcastEnabled,
-            regionAttributes, partitionResolver);
+            partitionResolver, regionAttributes);
 
         if (regionAttributes.getPartitionAttributes() == null
             && regionFunctionArgs.hasPartitionAttributes()) {
@@ -277,6 +278,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
                   useAttributesFrom));
         }
       } else {
+        // use constructor with RegionShortcut (NOTE: evictionMax is null)
         regionFunctionArgs = new RegionFunctionArgs(regionPath, regionShortcut, useAttributesFrom,
             skipIfExists, keyConstraint, valueConstraint, statisticsEnabled, entryIdle, entryTTL,
             regionIdle, regionTTL, diskStore, diskSynchronous, enableAsyncConflation,
@@ -318,7 +320,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
         return ResultBuilder.createUserErrorResult(CliStrings.NO_CACHING_MEMBERS_FOUND_MESSAGE);
       }
 
-      ResultCollector<?, ?> resultCollector = CliUtil.executeFunction(RegionCreateFunction.INSTANCE,
+      ResultCollector<?, ?> resultCollector = CliUtil.executeFunction(new RegionCreateFunction(),
           regionFunctionArgs, membersToCreateRegionOn);
       @SuppressWarnings("unchecked")
       List<CliFunctionResult> regionCreateResults =
@@ -559,7 +561,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
     return result;
   }
 
-  private static boolean regionExists(InternalCache cache, String regionPath) {
+  private boolean regionExists(InternalCache cache, String regionPath) {
     boolean regionFound = false;
     if (regionPath != null && !Region.SEPARATOR.equals(regionPath)) {
       ManagementService managementService = ManagementService.getExistingManagementService(cache);
@@ -866,8 +868,8 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
     return false;
   }
 
-  private static <K, V> FetchRegionAttributesFunctionResult<K, V> getRegionAttributes(
-      InternalCache cache, String regionPath) {
+  private <K, V> FetchRegionAttributesFunctionResult<K, V> getRegionAttributes(InternalCache cache,
+      String regionPath) {
     if (!isClusterWideSameConfig(cache, regionPath)) {
       throw new IllegalStateException(CliStrings.format(
           CliStrings.CREATE_REGION__MSG__USE_ATTRIBUTES_FORM_REGIONS_EXISTS_BUT_DIFFERENT_SCOPE_OR_DATAPOLICY_USE_DESCRIBE_REGION_FOR_0,
@@ -878,7 +880,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
     // First check whether the region exists on a this manager, if yes then no
     // need to use FetchRegionAttributesFunction to fetch RegionAttributes
     try {
-      attributes = FetchRegionAttributesFunction.getRegionAttributes(regionPath);
+      attributes = FetchRegionAttributesFunction.getRegionAttributes(cache, regionPath);
     } catch (IllegalArgumentException e) {
       /* region doesn't exist on the manager */
     }
@@ -890,7 +892,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
       if (regionAssociatedMembers != null && !regionAssociatedMembers.isEmpty()) {
         DistributedMember distributedMember = regionAssociatedMembers.iterator().next();
         ResultCollector<?, ?> resultCollector = CliUtil
-            .executeFunction(FetchRegionAttributesFunction.INSTANCE, regionPath, distributedMember);
+            .executeFunction(new FetchRegionAttributesFunction(), regionPath, distributedMember);
         List<?> resultsList = (List<?>) resultCollector.getResult();
 
         if (resultsList != null && !resultsList.isEmpty()) {
@@ -920,7 +922,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
     return attributes;
   }
 
-  private static boolean isClusterWideSameConfig(InternalCache cache, String regionPath) {
+  private boolean isClusterWideSameConfig(InternalCache cache, String regionPath) {
     ManagementService managementService = ManagementService.getExistingManagementService(cache);
 
     DistributedSystemMXBean dsMXBean = managementService.getDistributedSystemMXBean();
@@ -1002,7 +1004,7 @@ public class CreateAlterDestroyRegionCommands implements GfshCommand {
       CliFunctionResult destroyRegionResult;
 
       ResultCollector<?, ?> resultCollector =
-          CliUtil.executeFunction(RegionDestroyFunction.INSTANCE, regionPath, regionMembersList);
+          CliUtil.executeFunction(new RegionDestroyFunction(), regionPath, regionMembersList);
       List<CliFunctionResult> resultsList = (List<CliFunctionResult>) resultCollector.getResult();
       String message =
           CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED, regionPath, "");

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
index 5f21848..c5ac227 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
@@ -21,9 +21,9 @@ import org.apache.geode.internal.logging.log4j.LogLevel;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
 import org.apache.geode.management.internal.cli.GfshParseResult;
-import org.apache.geode.management.internal.cli.functions.ExportLogsFunction;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.logging.log4j.Level;
+import org.apache.geode.management.internal.cli.util.TimeParser;
+
 import org.apache.logging.log4j.Logger;
 
 import java.io.File;
@@ -61,8 +61,8 @@ public class ExportLogsInterceptor extends AbstractCliAroundInterceptor {
     String end = arguments.get("end-time");
     if (start != null && end != null) {
       // need to make sure end is later than start
-      LocalDateTime startTime = ExportLogsFunction.parseTime(start);
-      LocalDateTime endTime = ExportLogsFunction.parseTime(end);
+      LocalDateTime startTime = TimeParser.parseTime(start);
+      LocalDateTime endTime = TimeParser.parseTime(end);
       if (startTime.isAfter(endTime)) {
         return ResultBuilder.createUserErrorResult("start-time has to be earlier than end-time.");
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
index 1415bc6..f7e65b4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
@@ -456,7 +456,7 @@ public class MiscellaneousCommands implements GfshCommand {
       if (!hostMemberMap.isEmpty()) {
         Set<DistributedMember> membersToExecuteOn = new HashSet<>(hostMemberMap.values());
         ResultCollector<?, ?> netstatResult =
-            CliUtil.executeFunction(NetstatFunction.INSTANCE, nfa, membersToExecuteOn);
+            CliUtil.executeFunction(new NetstatFunction(), nfa, membersToExecuteOn);
         List<?> resultList = (List<?>) netstatResult.getResult();
         for (Object aResultList : resultList) {
           NetstatFunctionResult netstatFunctionResult = (NetstatFunctionResult) aResultList;

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
index c6fb709..5590289 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
@@ -152,7 +152,7 @@ public class WanCommands implements GfshCommand {
       }
 
       ResultCollector<?, ?> resultCollector =
-          CliUtil.executeFunction(GatewaySenderCreateFunction.INSTANCE, gatewaySenderFunctionArgs,
+          CliUtil.executeFunction(new GatewaySenderCreateFunction(), gatewaySenderFunctionArgs,
               membersToCreateGatewaySenderOn);
       @SuppressWarnings("unchecked")
       List<CliFunctionResult> gatewaySenderCreateResults =
@@ -562,8 +562,8 @@ public class WanCommands implements GfshCommand {
       }
 
       ResultCollector<?, ?> resultCollector =
-          CliUtil.executeFunction(GatewayReceiverCreateFunction.INSTANCE,
-              gatewayReceiverFunctionArgs, membersToCreateGatewayReceiverOn);
+          CliUtil.executeFunction(new GatewayReceiverCreateFunction(), gatewayReceiverFunctionArgs,
+              membersToCreateGatewayReceiverOn);
       @SuppressWarnings("unchecked")
       List<CliFunctionResult> gatewayReceiverCreateResults =
           (List<CliFunctionResult>) resultCollector.getResult();
@@ -1011,7 +1011,7 @@ public class WanCommands implements GfshCommand {
       }
 
       ResultCollector<?, ?> resultCollector =
-          CliUtil.executeFunction(GatewaySenderDestroyFunction.INSTANCE,
+          CliUtil.executeFunction(new GatewaySenderDestroyFunction(),
               gatewaySenderDestroyFunctionArgs, membersToDestroyGatewaySenderOn);
       @SuppressWarnings("unchecked")
       List<CliFunctionResult> gatewaySenderDestroyResults =

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AlterRuntimeConfigFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AlterRuntimeConfigFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AlterRuntimeConfigFunction.java
index 53d3ab7..2505516 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AlterRuntimeConfigFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AlterRuntimeConfigFunction.java
@@ -14,9 +14,14 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
-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.internal.DistributionConfig;
 import org.apache.geode.internal.ConfigSource;
@@ -25,29 +30,18 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.logging.log4j.Logger;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-public class AlterRuntimeConfigFunction extends FunctionAdapter implements InternalEntity {
 
+public class AlterRuntimeConfigFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
-
   private static Logger logger = LogService.getLogger();
 
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
-
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     String memberId = "";
 
     try {
       Object arg = context.getArguments();
-      InternalCache cache = getCache();
+      InternalCache cache = (InternalCache) context.getCache();
       DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
       memberId = cache.getDistributedSystem().getDistributedMember().getId();
 
@@ -82,15 +76,11 @@ public class AlterRuntimeConfigFunction extends FunctionAdapter implements Inter
       context.getResultSender().lastResult(result);
 
     } catch (Exception e) {
-      logger.error("Exception happened on : " + memberId, e);
+      logger.error("Exception happened on : {}", memberId, e);
       CliFunctionResult cliFuncResult =
           new CliFunctionResult(memberId, e, CliUtil.stackTraceAsString(e));
       context.getResultSender().lastResult(cliFuncResult);
     }
   }
 
-  @Override
-  public String getId() {
-    return AlterRuntimeConfigFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
index 2e297bf..aaeb9ed 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
@@ -21,31 +21,32 @@ import java.util.Properties;
  * This class stores the arguments provided for create async event queue command.
  */
 public class AsyncEventQueueFunctionArgs implements Serializable {
-
   private static final long serialVersionUID = -6524494645663740872L;
 
-  private String asyncEventQueueId;
-  private boolean isParallel;
-  private boolean enableBatchConflation;
-  private int batchSize;
-  private int batchTimeInterval;
-  private boolean persistent;
-  private String diskStoreName;
-  private boolean diskSynchronous;
-  private int maxQueueMemory;
-  private int dispatcherThreads;
-  private String orderPolicy;
-  private String[] gatewayEventFilters;
-  private String gatewaySubstitutionFilter;
-  private String listenerClassName;
-  private Properties listenerProperties;
-  private boolean forwardExpirationDestroy;
-
-  public AsyncEventQueueFunctionArgs(String asyncEventQueueId, boolean isParallel,
-      boolean enableBatchConflation, int batchSize, int batchTimeInterval, boolean persistent,
-      String diskStoreName, boolean diskSynchronous, int maxQueueMemory, int dispatcherThreads,
-      String orderPolicy, String[] gatewayEventFilters, String gatewaySubstitutionFilter,
-      String listenerClassName, Properties listenerProperties, boolean forwardExpirationDestroy) {
+  private final String asyncEventQueueId;
+  private final boolean isParallel;
+  private final boolean enableBatchConflation;
+  private final int batchSize;
+  private final int batchTimeInterval;
+  private final boolean persistent;
+  private final String diskStoreName;
+  private final boolean diskSynchronous;
+  private final int maxQueueMemory;
+  private final int dispatcherThreads;
+  private final String orderPolicy;
+  private final String[] gatewayEventFilters;
+  private final String gatewaySubstitutionFilter;
+  private final String listenerClassName;
+  private final Properties listenerProperties;
+  private final boolean forwardExpirationDestroy;
+
+  public AsyncEventQueueFunctionArgs(final String asyncEventQueueId, final boolean isParallel,
+      final boolean enableBatchConflation, final int batchSize, final int batchTimeInterval,
+      final boolean persistent, final String diskStoreName, final boolean diskSynchronous,
+      final int maxQueueMemory, final int dispatcherThreads, final String orderPolicy,
+      final String[] gatewayEventFilters, final String gatewaySubstitutionFilter,
+      final String listenerClassName, final Properties listenerProperties,
+      final boolean forwardExpirationDestroy) {
     this.asyncEventQueueId = asyncEventQueueId;
     this.isParallel = isParallel;
     this.enableBatchConflation = enableBatchConflation;
@@ -127,4 +128,5 @@ public class AsyncEventQueueFunctionArgs implements Serializable {
   public boolean isForwardExpirationDestroy() {
     return forwardExpirationDestroy;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ChangeLogLevelFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ChangeLogLevelFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ChangeLogLevelFunction.java
index 91aabe4..fe9a515 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ChangeLogLevelFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ChangeLogLevelFunction.java
@@ -14,47 +14,42 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.LogLevel;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.logging.log4j.LogWriterLogger;
-import org.apache.geode.internal.logging.log4j.LogLevel;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Logger;
-
-import java.util.HashMap;
-import java.util.Map;
-
 
 /**
- * 
  * Class for change log level function
  * 
- * since 8.0
- * 
+ * @since GemFire 8.0
  */
-
 public class ChangeLogLevelFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = ChangeLogLevelFunction.class.getName();
   private static final long serialVersionUID = 1L;
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
-    Cache cache = CacheFactory.getAnyInstance();
-    Map<String, String> result = new HashMap<String, String>();
+  public void execute(final FunctionContext context) {
+    Cache cache = context.getCache();
+    Map<String, String> result = new HashMap<>();
+
     try {
       LogWriterLogger logwriterLogger = (LogWriterLogger) cache.getLogger();
       Object[] args = (Object[]) context.getArguments();
-      final String logLevel = (String) args[0];
+      String logLevel = (String) args[0];
       Level log4jLevel = LogLevel.getLevel(logLevel);
       logwriterLogger.setLevel(log4jLevel);
       System.setProperty(DistributionConfig.GEMFIRE_PREFIX + LOG_LEVEL, logLevel);
@@ -63,6 +58,7 @@ public class ChangeLogLevelFunction implements Function, InternalEntity {
       result.put(cache.getDistributedSystem().getDistributedMember().getId(),
           "New log level is " + log4jLevel);
       context.getResultSender().lastResult(result);
+
     } catch (Exception ex) {
       // LOG:CONFIG:
       logger.info(LogMarker.CONFIG, "GFSH Changing log level exception {}", ex.getMessage(), ex);
@@ -73,12 +69,6 @@ public class ChangeLogLevelFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ChangeLogLevelFunction.ID;
-
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
index 401c1a8..914f092 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
@@ -14,11 +14,6 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import org.apache.geode.DataSerializer;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.Version;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
@@ -28,7 +23,14 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.geode.DataSerializer;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.Version;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+
+// TODO: make CliFunctionResult immutable
 public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSerializableFixedID {
+
   private String memberIdOrName;
   private Serializable[] serializables = new String[0];
   private Throwable throwable;
@@ -36,7 +38,9 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
   private XmlEntity xmlEntity;
   private byte[] byteData = new byte[0];
 
-  public CliFunctionResult() {}
+  public CliFunctionResult() {
+    // nothing
+  }
 
   public CliFunctionResult(final String memberIdOrName) {
     this.memberIdOrName = memberIdOrName;
@@ -65,7 +69,6 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
     this.successful = true;
   }
 
-
   public CliFunctionResult(final String memberIdOrName, final XmlEntity xmlEntity,
       final Serializable[] serializables) {
     this.memberIdOrName = memberIdOrName;
@@ -131,7 +134,7 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
   }
 
   @Override
-  public void toData(DataOutput out) throws IOException {
+  public void toData(final DataOutput out) throws IOException {
     DataSerializer.writeString(this.memberIdOrName, out);
     DataSerializer.writePrimitiveBoolean(this.successful, out);
     DataSerializer.writeObject(this.xmlEntity, out);
@@ -140,14 +143,14 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
     DataSerializer.writeByteArray(this.byteData, out);
   }
 
-  public void toDataPre_GFE_8_0_0_0(DataOutput out) throws IOException {
+  public void toDataPre_GFE_8_0_0_0(final DataOutput out) throws IOException {
     DataSerializer.writeString(this.memberIdOrName, out);
     DataSerializer.writeObjectArray(this.serializables, out);
     DataSerializer.writeObject(this.throwable, out);
   }
 
   @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+  public void fromData(final DataInput in) throws IOException, ClassNotFoundException {
     this.memberIdOrName = DataSerializer.readString(in);
     this.successful = DataSerializer.readPrimitiveBoolean(in);
     this.xmlEntity = DataSerializer.readObject(in);
@@ -156,7 +159,8 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
     this.byteData = DataSerializer.readByteArray(in);
   }
 
-  public void fromDataPre_GFE_8_0_0_0(DataInput in) throws IOException, ClassNotFoundException {
+  public void fromDataPre_GFE_8_0_0_0(final DataInput in)
+      throws IOException, ClassNotFoundException {
     this.memberIdOrName = DataSerializer.readString(in);
     this.throwable = DataSerializer.readObject(in);
     this.serializables = (Serializable[]) DataSerializer.readObjectArray(in);
@@ -170,12 +174,8 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
     return this.xmlEntity;
   }
 
-  public byte[] getByteData() {
-    return this.byteData;
-  }
-
   @Override
-  public int compareTo(CliFunctionResult o) {
+  public int compareTo(final CliFunctionResult o) {
     if (this.memberIdOrName == null && o.memberIdOrName == null) {
       return 0;
     }
@@ -190,14 +190,14 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
 
   @Override
   public int hashCode() {
-    final int prime = 31;
+    int prime = 31;
     int result = 1;
     result = prime * result + ((this.memberIdOrName == null) ? 0 : this.memberIdOrName.hashCode());
     return result;
   }
 
   @Override
-  public boolean equals(Object obj) {
+  public boolean equals(final Object obj) {
     if (this == obj)
       return true;
     if (obj == null)
@@ -227,8 +227,8 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
    * @param results The results to clean.
    * @return The cleaned results.
    */
-  public static List<CliFunctionResult> cleanResults(List<?> results) {
-    List<CliFunctionResult> returnResults = new ArrayList<CliFunctionResult>(results.size());
+  public static List<CliFunctionResult> cleanResults(final List<?> results) {
+    List<CliFunctionResult> returnResults = new ArrayList<>(results.size());
     for (Object result : results) {
       if (result instanceof CliFunctionResult) {
         returnResults.add((CliFunctionResult) result);
@@ -243,4 +243,5 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
   public Version[] getSerializationVersions() {
     return new Version[] {Version.GFE_80};
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableClientFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableClientFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableClientFunction.java
index 73761c4..3decf83 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableClientFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableClientFunction.java
@@ -15,9 +15,8 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import org.apache.geode.cache.Cache;
-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.internal.InternalDistributedSystem;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
@@ -25,19 +24,17 @@ import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.domain.MemberResult;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-/***
+/**
  * Function to close a durable client
- *
  */
-public class CloseDurableClientFunction extends FunctionAdapter implements InternalEntity {
-
+public class CloseDurableClientFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     String durableClientId = (String) context.getArguments();
-    final Cache cache = CliUtil.getCacheIfExists();
-    final String memberNameOrId =
+    Cache cache = context.getCache();
+    String memberNameOrId =
         CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
     MemberResult memberResult = new MemberResult(memberNameOrId);
 
@@ -62,16 +59,13 @@ public class CloseDurableClientFunction extends FunctionAdapter implements Inter
       } else {
         memberResult.setErrorMessage(CliStrings.NO_CLIENT_FOUND);
       }
+
     } catch (Exception e) {
       memberResult.setExceptionMessage(e.getMessage());
+
     } finally {
       context.getResultSender().lastResult(memberResult);
     }
   }
 
-  @Override
-  public String getId() {
-    return CloseDurableClientFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableCqFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableCqFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableCqFunction.java
index e526409..c9d7728 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableCqFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CloseDurableCqFunction.java
@@ -15,29 +15,25 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import org.apache.geode.cache.Cache;
-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.internal.InternalEntity;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
-import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.domain.MemberResult;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-/***
+/**
  * Function to close a durable cq
- *
  */
-public class CloseDurableCqFunction extends FunctionAdapter implements InternalEntity {
-
+public class CloseDurableCqFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
-
-    final Cache cache = CliUtil.getCacheIfExists();
-    final String memberNameOrId =
+  public void execute(final FunctionContext context) {
+    Cache cache = context.getCache();
+    String memberNameOrId =
         CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
     CacheClientNotifier cacheClientNotifier = CacheClientNotifier.getInstance();
     String[] args = (String[]) context.getArguments();
@@ -45,6 +41,7 @@ public class CloseDurableCqFunction extends FunctionAdapter implements InternalE
     String cqName = args[1];
 
     MemberResult memberResult = new MemberResult(memberNameOrId);
+
     try {
       if (cacheClientNotifier != null) {
         CacheClientProxy cacheClientProxy = cacheClientNotifier.getClientProxy(durableClientId);
@@ -64,16 +61,13 @@ public class CloseDurableCqFunction extends FunctionAdapter implements InternalE
       } else {
         memberResult.setErrorMessage(CliStrings.NO_CLIENT_FOUND);
       }
+
     } catch (Exception e) {
       memberResult.setExceptionMessage(e.getMessage());
+
     } finally {
       context.getResultSender().lastResult(memberResult);
     }
   }
 
-  @Override
-  public String getId() {
-    return CloseDurableCqFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ContinuousQueryFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ContinuousQueryFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ContinuousQueryFunction.java
index 1f06a41..15ba98b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ContinuousQueryFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ContinuousQueryFunction.java
@@ -17,12 +17,12 @@ package org.apache.geode.management.internal.cli.functions;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Iterator;
-import org.apache.geode.cache.CacheFactory;
+
+import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.CacheServerImpl;
-import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.tier.sockets.AcceptorImpl;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
@@ -35,31 +35,29 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
 public class ContinuousQueryFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
-  public static final String ID = ContinuousQueryFunction.class.getName();
-
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
-
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     try {
       String clientID = (String) context.getArguments();
-      InternalCache cache = getCache();
+      Cache cache = context.getCache();
+
       if (cache.getCacheServers().size() > 0) {
         CacheServerImpl server = (CacheServerImpl) cache.getCacheServers().iterator().next();
+
         if (server != null) {
           AcceptorImpl acceptorImpl = server.getAcceptor();
+
           if (acceptorImpl != null) {
             CacheClientNotifier cacheClientNotifier = acceptorImpl.getCacheClientNotifier();
+
             if (cacheClientNotifier != null) {
               Collection<CacheClientProxy> cacheClientProxySet =
                   cacheClientNotifier.getClientProxies();
               ClientInfo clientInfo = null;
               boolean foundClientinCCP = false;
+
               Iterator<CacheClientProxy> it = cacheClientProxySet.iterator();
               while (it.hasNext()) {
-
                 CacheClientProxy ccp = it.next();
                 if (ccp != null) {
                   String clientIdFromProxy = ccp.getProxyID().getDSMembership();
@@ -100,16 +98,13 @@ public class ContinuousQueryFunction implements Function, InternalEntity {
           }
         }
       }
+
     } catch (Exception e) {
       context.getResultSender()
           .lastResult("Exception in ContinuousQueryFunction =" + e.getMessage());
     }
-    context.getResultSender().lastResult(null);
-  }
 
-  @Override
-  public String getId() {
-    return ContinuousQueryFunction.ID;
+    context.getResultSender().lastResult(null);
   }
 
   @Override
@@ -127,14 +122,19 @@ public class ContinuousQueryFunction implements Function, InternalEntity {
     return false;
   }
 
+  /**
+   * Info details about cache client.
+   */
   public class ClientInfo implements Serializable {
     private static final long serialVersionUID = 1L;
-    public String isDurable;
-    public String primaryServer;
-    public String secondaryServer;
 
-    public ClientInfo(String IsClientDurable, String primaryServerId, String secondaryServerId) {
-      isDurable = IsClientDurable;
+    public final String isDurable;
+    public final String primaryServer;
+    public final String secondaryServer;
+
+    public ClientInfo(final String isClientDurable, final String primaryServerId,
+        final String secondaryServerId) {
+      isDurable = isClientDurable;
       primaryServer = primaryServerId;
       secondaryServer = secondaryServerId;
     }
@@ -145,4 +145,5 @@ public class ContinuousQueryFunction implements Function, InternalEntity {
           + ", secondaryServer=" + secondaryServer + "]";
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateAsyncEventQueueFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
index 5696696..9f35538 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
@@ -23,11 +23,10 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Declarable;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory;
-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.wan.GatewayEventFilter;
 import org.apache.geode.cache.wan.GatewayEventSubstitutionFilter;
@@ -48,25 +47,19 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
  *
  * @since GemFire 8.0
  */
-public class CreateAsyncEventQueueFunction extends FunctionAdapter implements InternalEntity {
+public class CreateAsyncEventQueueFunction implements Function, InternalEntity {
   private static final Logger logger = LogService.getLogger();
-
   private static final long serialVersionUID = 1L;
 
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
-
-  @SuppressWarnings("deprecation")
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
       AsyncEventQueueFunctionArgs aeqArgs = (AsyncEventQueueFunctionArgs) context.getArguments();
 
-      InternalCache cache = getCache();
+      InternalCache cache = (InternalCache) context.getCache();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -147,17 +140,19 @@ public class CreateAsyncEventQueueFunction extends FunctionAdapter implements In
     }
   }
 
-  private Class<?> forName(String className, String neededFor) {
+  private Class<?> forName(final String className, final String neededFor) {
     if (Strings.isNullOrEmpty(className)) {
       return null;
     }
 
     try {
       return ClassPathLoader.getLatest().forName(className);
+
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_ASYNC_EVENT_QUEUE__MSG__COULD_NOT_FIND_CLASS_0_SPECIFIED_FOR_1,
           className, neededFor), e);
+
     } catch (ClassCastException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_ASYNC_EVENT_QUEUE__MSG__CLASS_0_SPECIFIED_FOR_1_IS_NOT_OF_EXPECTED_TYPE,
@@ -165,13 +160,15 @@ public class CreateAsyncEventQueueFunction extends FunctionAdapter implements In
     }
   }
 
-  private static Object newInstance(Class<?> klass, String neededFor) {
+  private static Object newInstance(final Class<?> klass, final String neededFor) {
     try {
       return klass.newInstance();
+
     } catch (InstantiationException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_ASYNC_EVENT_QUEUE__MSG__COULD_NOT_INSTANTIATE_CLASS_0_SPECIFIED_FOR_1,
           klass, neededFor), e);
+
     } catch (IllegalAccessException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_ASYNC_EVENT_QUEUE__MSG__COULD_NOT_ACCESS_CLASS_0_SPECIFIED_FOR_1, klass,
@@ -179,8 +176,4 @@ public class CreateAsyncEventQueueFunction extends FunctionAdapter implements In
     }
   }
 
-  @Override
-  public String getId() {
-    return CreateDiskStoreFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
index 742840c..18eb0b9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
@@ -14,35 +14,30 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-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.query.Index;
 import org.apache.geode.cache.query.MultiIndexCreationException;
 import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.management.internal.cli.domain.IndexInfo;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-public class CreateDefinedIndexesFunction extends FunctionAdapter implements InternalEntity {
-
+public class CreateDefinedIndexesFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     String memberId = null;
-    List<Index> indexes = null;
-    Cache cache = null;
+
     try {
-      cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       memberId = cache.getDistributedSystem().getDistributedMember().getId();
       QueryService queryService = cache.getQueryService();
+
       Set<IndexInfo> indexDefinitions = (Set<IndexInfo>) context.getArguments();
       for (IndexInfo indexDefinition : indexDefinitions) {
         String indexName = indexDefinition.getIndexName();
@@ -56,16 +51,20 @@ public class CreateDefinedIndexesFunction extends FunctionAdapter implements Int
           queryService.defineIndex(indexName, indexedExpression, regionPath);
         }
       }
-      indexes = queryService.createDefinedIndexes();
+
+      queryService.createDefinedIndexes();
+
       context.getResultSender().lastResult(new CliFunctionResult(memberId));
+
     } catch (MultiIndexCreationException e) {
-      StringBuffer sb = new StringBuffer();
+      StringBuilder sb = new StringBuilder();
       sb.append("Index creation failed for indexes: ").append("\n");
       for (Map.Entry<String, Exception> failedIndex : e.getExceptionsMap().entrySet()) {
         sb.append(failedIndex.getKey()).append(" : ").append(failedIndex.getValue().getMessage())
             .append("\n");
       }
       context.getResultSender().lastResult(new CliFunctionResult(memberId, e, sb.toString()));
+
     } catch (Exception e) {
       String exceptionMessage = CliStrings.format(CliStrings.EXCEPTION_CLASS_AND_MESSAGE,
           e.getClass().getName(), e.getMessage());
@@ -73,14 +72,4 @@ public class CreateDefinedIndexesFunction extends FunctionAdapter implements Int
     }
   }
 
-  public void createCommandObject(IndexInfo info) {
-    Cache cache = CacheFactory.getAnyInstance();
-    QueryService queryService = cache.getQueryService();
-  }
-
-  @Override
-  public String getId() {
-    return CreateDefinedIndexesFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDiskStoreFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDiskStoreFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDiskStoreFunction.java
index 3b4679c..6ccd67d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDiskStoreFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDiskStoreFunction.java
@@ -14,19 +14,12 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-/**
- * Function used by the 'create disk-store' gfsh command to create a disk store on each member.
- * 
- * @since GemFire 8.0
- */
-
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.DiskStoreFactory;
-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;
@@ -36,25 +29,26 @@ import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
-public class CreateDiskStoreFunction extends FunctionAdapter implements InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
+/**
+ * Function used by the 'create disk-store' gfsh command to create a disk store on each member.
+ *
+ * @since GemFire 8.0
+ */
+public class CreateDiskStoreFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
-
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
+
     try {
-      final Object[] args = (Object[]) context.getArguments();
-      final String diskStoreName = (String) args[0];
-      final DiskStoreAttributes diskStoreAttrs = (DiskStoreAttributes) args[01];
+      Object[] args = (Object[]) context.getArguments();
+      String diskStoreName = (String) args[0];
+      DiskStoreAttributes diskStoreAttrs = (DiskStoreAttributes) args[01];
 
-      InternalCache cache = getCache();
+      InternalCache cache = (InternalCache) context.getCache();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -84,8 +78,4 @@ public class CreateDiskStoreFunction extends FunctionAdapter implements Internal
     }
   }
 
-  @Override
-  public String getId() {
-    return CreateDiskStoreFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
index 8a65f7a..1c332ee 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
@@ -15,8 +15,7 @@
 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.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.query.IndexExistsException;
 import org.apache.geode.cache.query.IndexInvalidException;
@@ -29,28 +28,28 @@ import org.apache.geode.management.internal.cli.domain.IndexInfo;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
-/***
+/**
  * Function to create index in a member, based on different arguments passed to it
- *
  */
-public class CreateIndexFunction extends FunctionAdapter implements InternalEntity {
-
-
+public class CreateIndexFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
-    final IndexInfo indexInfo = (IndexInfo) context.getArguments();
+  public void execute(final FunctionContext context) {
+    IndexInfo indexInfo = (IndexInfo) context.getArguments();
     String memberId = null;
+
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       memberId = cache.getDistributedSystem().getDistributedMember().getId();
       QueryService queryService = cache.getQueryService();
       String indexName = indexInfo.getIndexName();
       String indexedExpression = indexInfo.getIndexedExpression();
       String fromClause = indexInfo.getRegionPath();
+
       // Check to see if the region path contains an alias e.g "/region1 r1"
       // Then the first string will be the regionPath
+
       String[] regionPathTokens = fromClause.trim().split(" ");
       String regionPath = regionPathTokens[0];
 
@@ -70,20 +69,25 @@ public class CreateIndexFunction extends FunctionAdapter implements InternalEnti
 
       regionPath = getValidRegionName(cache, regionPath);
       setResultInSender(context, indexInfo, memberId, cache, regionPath);
+
     } catch (IndexExistsException e) {
       String message =
           CliStrings.format(CliStrings.CREATE_INDEX__INDEX__EXISTS, indexInfo.getIndexName());
       context.getResultSender().lastResult(new CliFunctionResult(memberId, false, message));
+
     } catch (IndexNameConflictException e) {
       String message =
           CliStrings.format(CliStrings.CREATE_INDEX__NAME__CONFLICT, indexInfo.getIndexName());
       context.getResultSender().lastResult(new CliFunctionResult(memberId, false, message));
+
     } catch (RegionNotFoundException e) {
       String message = CliStrings.format(CliStrings.CREATE_INDEX__INVALID__REGIONPATH,
           indexInfo.getRegionPath());
       context.getResultSender().lastResult(new CliFunctionResult(memberId, false, message));
+
     } catch (IndexInvalidException e) {
       context.getResultSender().lastResult(new CliFunctionResult(memberId, e, e.getMessage()));
+
     } catch (Exception e) {
       String exceptionMessage = CliStrings.format(CliStrings.EXCEPTION_CLASS_AND_MESSAGE,
           e.getClass().getName(), e.getMessage());
@@ -91,12 +95,13 @@ public class CreateIndexFunction extends FunctionAdapter implements InternalEnti
     }
   }
 
-  private void setResultInSender(FunctionContext context, IndexInfo indexInfo, String memberId,
-      Cache cache, String regionPath) {
+  private void setResultInSender(final FunctionContext context, final IndexInfo indexInfo,
+      final String memberId, final Cache cache, final String regionPath) {
     if (regionPath == null) {
       String message = CliStrings.format(CliStrings.CREATE_INDEX__INVALID__REGIONPATH,
           indexInfo.getRegionPath());
       context.getResultSender().lastResult(new CliFunctionResult(memberId, false, message));
+
     } else {
       XmlEntity xmlEntity =
           new XmlEntity(CacheXml.REGION, "name", cache.getRegion(regionPath).getName());
@@ -104,7 +109,7 @@ public class CreateIndexFunction extends FunctionAdapter implements InternalEnti
     }
   }
 
-  private String getValidRegionName(Cache cache, String regionPath) {
+  private String getValidRegionName(final Cache cache, String regionPath) {
     while (regionPath != null && cache.getRegion(regionPath) == null) {
       int dotPosition;
       if (regionPath.contains(".") && ((dotPosition = regionPath.lastIndexOf('.')) != -1)) {
@@ -116,8 +121,4 @@ public class CreateIndexFunction extends FunctionAdapter implements InternalEnti
     return regionPath;
   }
 
-  @Override
-  public String getId() {
-    return CreateIndexFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
index 401a368..e283ace 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
@@ -21,38 +21,29 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 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.ClassPathLoader;
 import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 
 public class DeployFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = DeployFunction.class.getName();
-
   private static final long serialVersionUID = 1L;
-
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
-      final Object[] args = (Object[]) context.getArguments();
-      final String[] jarFilenames = (String[]) args[0];
-      final byte[][] jarBytes = (byte[][]) args[1];
-      InternalCache cache = getCache();
+      Object[] args = (Object[]) context.getArguments();
+      String[] jarFilenames = (String[]) args[0];
+      byte[][] jarBytes = (byte[][]) args[1];
+      InternalCache cache = (InternalCache) context.getCache();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -96,11 +87,6 @@ public class DeployFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }
@@ -114,4 +100,5 @@ public class DeployFunction implements Function, InternalEntity {
   public boolean isHA() {
     return false;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
index 68cc2e0..3b26ed9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
@@ -12,18 +12,18 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.management.internal.cli.functions;
 
+import java.io.File;
+
 import org.apache.commons.lang.StringUtils;
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.DataPolicy;
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.cache.DiskStore;
 import org.apache.geode.cache.EvictionAction;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
-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.server.CacheServer;
 import org.apache.geode.cache.wan.GatewaySender;
@@ -35,12 +35,6 @@ import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.ArrayUtils;
 import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
 import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
 
 /**
  * The DescribeDiskStoreFunction class is an implementation of a GemFire Function used to collect
@@ -53,82 +47,54 @@ import java.util.Set;
  * @see org.apache.geode.cache.execute.FunctionContext
  * @see org.apache.geode.internal.InternalEntity
  * @see org.apache.geode.management.internal.cli.domain.DiskStoreDetails
+ *
  * @since GemFire 7.0
  */
-public class DescribeDiskStoreFunction extends FunctionAdapter implements InternalEntity {
-
+public class DescribeDiskStoreFunction implements Function, InternalEntity {
   private static final Logger logger = LogService.getLogger();
 
-  private static final Set<DataPolicy> PERSISTENT_DATA_POLICIES = new HashSet<>(2);
-
-  static {
-    PERSISTENT_DATA_POLICIES.add(DataPolicy.PERSISTENT_PARTITION);
-    PERSISTENT_DATA_POLICIES.add(DataPolicy.PERSISTENT_REPLICATE);
-  }
-
-  protected static void assertState(final boolean condition, final String message,
-      final Object... args) {
-    if (!condition) {
-      throw new IllegalStateException(String.format(message, args));
-    }
-  }
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return getClass().getName();
-  }
-
-  @SuppressWarnings("unused")
-  public void init(final Properties props) {}
-
   public void execute(final FunctionContext context) {
-    Cache cache = getCache();
+    InternalCache cache = (InternalCache) context.getCache();
 
     try {
-      if (cache instanceof InternalCache) {
-        InternalCache gemfireCache = (InternalCache) cache;
-
-        DistributedMember member = gemfireCache.getMyId();
-
-        String diskStoreName = (String) context.getArguments();
-        String memberId = member.getId();
-        String memberName = member.getName();
-
-        DiskStore diskStore = gemfireCache.findDiskStore(diskStoreName);
-
-        if (diskStore != null) {
-          DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStore.getDiskStoreUUID(),
-              diskStore.getName(), memberId, memberName);
-
-          diskStoreDetails.setAllowForceCompaction(diskStore.getAllowForceCompaction());
-          diskStoreDetails.setAutoCompact(diskStore.getAutoCompact());
-          diskStoreDetails.setCompactionThreshold(diskStore.getCompactionThreshold());
-          diskStoreDetails.setMaxOplogSize(diskStore.getMaxOplogSize());
-          diskStoreDetails.setQueueSize(diskStore.getQueueSize());
-          diskStoreDetails.setTimeInterval(diskStore.getTimeInterval());
-          diskStoreDetails.setWriteBufferSize(diskStore.getWriteBufferSize());
-          diskStoreDetails.setDiskUsageWarningPercentage(diskStore.getDiskUsageWarningPercentage());
-          diskStoreDetails
-              .setDiskUsageCriticalPercentage(diskStore.getDiskUsageCriticalPercentage());
-
-          setDiskDirDetails(diskStore, diskStoreDetails);
-          setRegionDetails(gemfireCache, diskStore, diskStoreDetails);
-          setCacheServerDetails(gemfireCache, diskStore, diskStoreDetails);
-          setGatewayDetails(gemfireCache, diskStore, diskStoreDetails);
-          setPdxSerializationDetails(gemfireCache, diskStore, diskStoreDetails);
-          setAsyncEventQueueDetails(gemfireCache, diskStore, diskStoreDetails);
-
-          context.getResultSender().lastResult(diskStoreDetails);
-        } else {
-          context.getResultSender()
-              .sendException(new DiskStoreNotFoundException(
-                  String.format("A disk store with name (%1$s) was not found on member (%2$s).",
-                      diskStoreName, memberName)));
-        }
+      DistributedMember member = cache.getMyId();
+
+      String diskStoreName = (String) context.getArguments();
+      String memberId = member.getId();
+      String memberName = member.getName();
+
+      DiskStore diskStore = cache.findDiskStore(diskStoreName);
+
+      if (diskStore != null) {
+        DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStore.getDiskStoreUUID(),
+            diskStore.getName(), memberId, memberName);
+
+        diskStoreDetails.setAllowForceCompaction(diskStore.getAllowForceCompaction());
+        diskStoreDetails.setAutoCompact(diskStore.getAutoCompact());
+        diskStoreDetails.setCompactionThreshold(diskStore.getCompactionThreshold());
+        diskStoreDetails.setMaxOplogSize(diskStore.getMaxOplogSize());
+        diskStoreDetails.setQueueSize(diskStore.getQueueSize());
+        diskStoreDetails.setTimeInterval(diskStore.getTimeInterval());
+        diskStoreDetails.setWriteBufferSize(diskStore.getWriteBufferSize());
+        diskStoreDetails.setDiskUsageWarningPercentage(diskStore.getDiskUsageWarningPercentage());
+        diskStoreDetails.setDiskUsageCriticalPercentage(diskStore.getDiskUsageCriticalPercentage());
+
+        setDiskDirDetails(diskStore, diskStoreDetails);
+        setRegionDetails(cache, diskStore, diskStoreDetails);
+        setCacheServerDetails(cache, diskStore, diskStoreDetails);
+        setGatewayDetails(cache, diskStore, diskStoreDetails);
+        setPdxSerializationDetails(cache, diskStore, diskStoreDetails);
+        setAsyncEventQueueDetails(cache, diskStore, diskStoreDetails);
+
+        context.getResultSender().lastResult(diskStoreDetails);
+
+      } else {
+        context.getResultSender()
+            .sendException(new DiskStoreNotFoundException(
+                String.format("A disk store with name (%1$s) was not found on member (%2$s).",
+                    diskStoreName, memberName)));
       }
+
     } catch (Exception e) {
       logger.error("Error occurred while executing 'describe disk-store': {}!", e.getMessage(), e);
       context.getResultSender().sendException(e);
@@ -165,12 +131,12 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
     return region.getAttributes().getDataPolicy().withPersistence();
   }
 
-  protected boolean isUsingDiskStore(final Region region, final DiskStore diskStore) {
+  boolean isUsingDiskStore(final Region region, final DiskStore diskStore) {
     return ((isPersistent(region) || isOverflowToDisk(region))
         && ObjectUtils.equals(getDiskStoreName(region), diskStore.getName()));
   }
 
-  protected void setRegionDetails(final InternalCache cache, final DiskStore diskStore,
+  void setRegionDetails(final InternalCache cache, final DiskStore diskStore,
       final DiskStoreDetails diskStoreDetails) {
     for (Region<?, ?> region : cache.rootRegions()) {
       setRegionDetails(region, diskStore, diskStoreDetails);
@@ -199,11 +165,11 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
             DiskStoreDetails.DEFAULT_DISK_STORE_NAME));
   }
 
-  protected boolean isUsingDiskStore(final CacheServer cacheServer, final DiskStore diskStore) {
+  boolean isUsingDiskStore(final CacheServer cacheServer, final DiskStore diskStore) {
     return ObjectUtils.equals(getDiskStoreName(cacheServer), diskStore.getName());
   }
 
-  protected void setCacheServerDetails(final InternalCache cache, final DiskStore diskStore,
+  void setCacheServerDetails(final InternalCache cache, final DiskStore diskStore,
       final DiskStoreDetails diskStoreDetails) {
     for (CacheServer cacheServer : cache.getCacheServers()) {
       if (isUsingDiskStore(cacheServer, diskStore)) {
@@ -225,11 +191,11 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
     return gateway.isPersistenceEnabled();
   }
 
-  protected boolean isUsingDiskStore(final GatewaySender gateway, final DiskStore diskStore) {
+  boolean isUsingDiskStore(final GatewaySender gateway, final DiskStore diskStore) {
     return ObjectUtils.equals(getDiskStoreName(gateway), diskStore.getName());
   }
 
-  protected void setGatewayDetails(final InternalCache cache, final DiskStore diskStore,
+  private void setGatewayDetails(final InternalCache cache, final DiskStore diskStore,
       final DiskStoreDetails diskStoreDetails) {
     for (GatewaySender gatewaySender : cache.getGatewaySenders()) {
       if (isUsingDiskStore(gatewaySender, diskStore)) {
@@ -241,7 +207,7 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
     }
   }
 
-  protected void setPdxSerializationDetails(final InternalCache cache, final DiskStore diskStore,
+  void setPdxSerializationDetails(final InternalCache cache, final DiskStore diskStore,
       final DiskStoreDetails diskStoreDetails) {
     if (cache.getPdxPersistent()) {
       String diskStoreName = StringUtils.defaultIfBlank(cache.getPdxDiskStore(),
@@ -256,12 +222,12 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
         DiskStoreDetails.DEFAULT_DISK_STORE_NAME);
   }
 
-  protected boolean isUsingDiskStore(final AsyncEventQueue queue, final DiskStore diskStore) {
+  boolean isUsingDiskStore(final AsyncEventQueue queue, final DiskStore diskStore) {
     return (queue.isPersistent()
         && ObjectUtils.equals(getDiskStoreName(queue), diskStore.getName()));
   }
 
-  protected void setAsyncEventQueueDetails(final InternalCache cache, final DiskStore diskStore,
+  void setAsyncEventQueueDetails(final InternalCache cache, final DiskStore diskStore,
       final DiskStoreDetails diskStoreDetails) {
     for (AsyncEventQueue queue : cache.getAsyncEventQueues()) {
       if (isUsingDiskStore(queue, diskStore)) {
@@ -270,4 +236,12 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
     }
   }
 
+  // TODO: delete assertState
+  protected static void assertState(final boolean condition, final String message,
+      final Object... args) {
+    if (!condition) {
+      throw new IllegalStateException(String.format(message, args));
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyDiskStoreFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyDiskStoreFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyDiskStoreFunction.java
index c25a534..baaf973 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyDiskStoreFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyDiskStoreFunction.java
@@ -18,9 +18,8 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.DiskStore;
-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;
@@ -34,25 +33,20 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
  * 
  * @since GemFire 8.0
  */
-public class DestroyDiskStoreFunction extends FunctionAdapter implements InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
+public class DestroyDiskStoreFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
-
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
-      final Object[] args = (Object[]) context.getArguments();
-      final String diskStoreName = (String) args[0];
+      Object[] args = (Object[]) context.getArguments();
+      String diskStoreName = (String) args[0];
 
-      InternalCache cache = getCache();
+      InternalCache cache = (InternalCache) context.getCache();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -95,8 +89,4 @@ public class DestroyDiskStoreFunction extends FunctionAdapter implements Interna
     }
   }
 
-  @Override
-  public String getId() {
-    return CreateDiskStoreFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyIndexFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyIndexFunction.java
index 24322bc..915cb60 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyIndexFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyIndexFunction.java
@@ -18,9 +18,8 @@ import java.util.List;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 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.query.Index;
 import org.apache.geode.cache.query.QueryService;
@@ -30,19 +29,16 @@ import org.apache.geode.management.internal.cli.domain.IndexInfo;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
-
-
-public class DestroyIndexFunction extends FunctionAdapter implements InternalEntity {
-
+public class DestroyIndexFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     IndexInfo indexInfo = (IndexInfo) context.getArguments();
     String memberId = null;
 
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       memberId = cache.getDistributedSystem().getDistributedMember().getId();
       QueryService queryService = cache.getQueryService();
       String indexName = indexInfo.getIndexName();
@@ -87,20 +83,19 @@ public class DestroyIndexFunction extends FunctionAdapter implements InternalEnt
           }
         }
       }
+
     } catch (CacheClosedException e) {
       context.getResultSender().lastResult(new CliFunctionResult(memberId, e, e.getMessage()));
+
     } catch (Exception e) {
       context.getResultSender().lastResult(new CliFunctionResult(memberId, e, e.getMessage()));
     }
   }
 
-  /***
-   * 
-   * @param name
-   * @param queryService
+  /**
    * @return true if the index was found and removed/false if the index was not found.
    */
-  private boolean removeIndexByName(String name, QueryService queryService) {
+  private boolean removeIndexByName(final String name, final QueryService queryService) {
     List<Index> indexes = (List<Index>) queryService.getIndexes();
     boolean removed = false;
 
@@ -115,9 +110,4 @@ public class DestroyIndexFunction extends FunctionAdapter implements InternalEnt
     return removed;
   }
 
-  @Override
-  public String getId() {
-    return DestroyIndexFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportConfigFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportConfigFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportConfigFunction.java
index 49e27b0..1086ec1 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportConfigFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportConfigFunction.java
@@ -23,7 +23,6 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
@@ -35,19 +34,16 @@ import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
 import org.apache.geode.internal.logging.LogService;
 
 public class ExportConfigFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = ExportConfigFunction.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) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
       memberId = member.getId();
@@ -66,26 +62,30 @@ public class ExportConfigFunction implements Function, InternalEntity {
       DistributionConfigImpl config =
           (DistributionConfigImpl) ((InternalDistributedSystem) cache.getDistributedSystem())
               .getConfig();
-      StringBuffer propStringBuf = new StringBuffer();
+      StringBuilder propStringBuf = new StringBuilder();
       String lineSeparator = System.getProperty("line.separator");
+
       for (Map.Entry entry : config.getConfigPropsFromSource(ConfigSource.runtime()).entrySet()) {
         if (entry.getValue() != null && !entry.getValue().equals("")) {
           propStringBuf.append(entry.getKey()).append("=").append(entry.getValue())
               .append(lineSeparator);
         }
       }
+
       for (Map.Entry entry : config.getConfigPropsFromSource(ConfigSource.api()).entrySet()) {
         if (entry.getValue() != null && !entry.getValue().equals("")) {
           propStringBuf.append(entry.getKey()).append("=").append(entry.getValue())
               .append(lineSeparator);
         }
       }
+
       for (Map.Entry entry : config.getConfigPropsDefinedUsingFiles().entrySet()) {
         if (entry.getValue() != null && !entry.getValue().equals("")) {
           propStringBuf.append(entry.getKey()).append("=").append(entry.getValue())
               .append(lineSeparator);
         }
       }
+
       // fix for bug 46653
       for (Map.Entry entry : config.getConfigPropsFromSource(ConfigSource.launcher()).entrySet()) {
         if (entry.getValue() != null && !entry.getValue().equals("")) {
@@ -116,11 +116,6 @@ public class ExportConfigFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }
@@ -134,4 +129,5 @@ public class ExportConfigFunction implements Function, InternalEntity {
   public boolean isHA() {
     return false;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
index 537678f..e0876d5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
@@ -17,37 +17,31 @@ package org.apache.geode.management.internal.cli.functions;
 import java.io.File;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 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.snapshot.RegionSnapshotService;
 import org.apache.geode.cache.snapshot.SnapshotOptions.SnapshotFormat;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-/***
+/**
  * Function which carries out the export of a region to a file on a member. Uses the
  * RegionSnapshotService to export the data
- * 
- *
  */
-public class ExportDataFunction extends FunctionAdapter implements InternalEntity {
-
-  /**
-   * 
-   */
+public class ExportDataFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
-  public void execute(FunctionContext context) {
-    final String[] args = (String[]) context.getArguments();
-    final String regionName = args[0];
-    final String fileName = args[1];
+  public void execute(final FunctionContext context) {
+    String[] args = (String[]) context.getArguments();
+    String regionName = args[0];
+    String fileName = args[1];
 
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       Region<?, ?> region = cache.getRegion(regionName);
       String hostName = cache.getDistributedSystem().getDistributedMember().getHost();
+
       if (region != null) {
         RegionSnapshotService<?, ?> snapshotService = region.getSnapshotService();
         final File exportFile = new File(fileName);
@@ -55,6 +49,7 @@ public class ExportDataFunction extends FunctionAdapter implements InternalEntit
         String successMessage = CliStrings.format(CliStrings.EXPORT_DATA__SUCCESS__MESSAGE,
             regionName, exportFile.getCanonicalPath(), hostName);
         context.getResultSender().lastResult(successMessage);
+
       } else {
         throw new IllegalArgumentException(
             CliStrings.format(CliStrings.REGION_NOT_FOUND, regionName));
@@ -65,8 +60,4 @@ public class ExportDataFunction extends FunctionAdapter implements InternalEntit
     }
   }
 
-  public String getId() {
-    return ExportDataFunction.class.getName();
-  }
-
 }


[2/4] geode git commit: Convert to use FunctionContext.getCache()

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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/b49367e7/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;
   }
+
 }


[3/4] geode git commit: Convert to use FunctionContext.getCache()

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
index b2a7e7e..f1a3d57 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
@@ -20,10 +20,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.Serializable;
 import java.nio.file.Path;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
-import java.time.ZoneId;
 import java.util.Arrays;
 
 import org.apache.commons.lang.StringUtils;
@@ -38,7 +35,6 @@ import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 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.cache.InternalRegionArguments;
 import org.apache.geode.internal.logging.LogService;
@@ -47,21 +43,22 @@ import org.apache.geode.management.internal.cli.commands.ExportLogsCommand;
 import org.apache.geode.management.internal.cli.util.ExportLogsCacheWriter;
 import org.apache.geode.management.internal.cli.util.LogExporter;
 import org.apache.geode.management.internal.cli.util.LogFilter;
+import org.apache.geode.management.internal.cli.util.TimeParser;
 import org.apache.geode.management.internal.configuration.domain.Configuration;
 
 /**
- * this function extracts the logs using a LogExporter which creates a zip file, and then writes the
- * zip file bytes into a replicated region, this in effect, "stream" the zip file bytes to the
- * locator
+ * Extracts the logs using a LogExporter which creates a zip file, and then writes the zip file
+ * bytes into a replicated region, this in effect, "stream" the zip file bytes to the locator
  *
+ * <p>
  * The function only extracts .log and .gfs files under server's working directory
  */
 public class ExportLogsFunction implements Function, InternalEntity {
+  private static final long serialVersionUID = 1L;
   private static final Logger logger = LogService.getLogger();
 
   public static final String EXPORT_LOGS_REGION = "__exportLogsRegion";
 
-  private static final long serialVersionUID = 1L;
   private static final int BUFFER_SIZE = 1024;
 
   @Override
@@ -114,15 +111,18 @@ public class ExportLogsFunction implements Function, InternalEntity {
       context.getResultSender().lastResult(null);
 
     } catch (Exception e) {
-      e.printStackTrace();
       logger.error(e);
       context.getResultSender().sendException(e);
     }
   }
 
-  public static Region createOrGetExistingExportLogsRegion(boolean isInitiatingMember,
-      InternalCache cache) throws IOException, ClassNotFoundException {
+  @Override
+  public boolean isHA() {
+    return false;
+  }
 
+  public static Region createOrGetExistingExportLogsRegion(final boolean isInitiatingMember,
+      final InternalCache cache) throws IOException, ClassNotFoundException {
     Region exportLogsRegion = cache.getRegion(EXPORT_LOGS_REGION);
     if (exportLogsRegion == null) {
       AttributesFactory<String, Configuration> regionAttrsFactory = new AttributesFactory<>();
@@ -141,7 +141,7 @@ public class ExportLogsFunction implements Function, InternalEntity {
     return exportLogsRegion;
   }
 
-  public static void destroyExportLogsRegion(InternalCache cache) {
+  public static void destroyExportLogsRegion(final InternalCache cache) {
     Region exportLogsRegion = cache.getRegion(EXPORT_LOGS_REGION);
     if (exportLogsRegion == null) {
       return;
@@ -149,23 +149,22 @@ public class ExportLogsFunction implements Function, InternalEntity {
     exportLogsRegion.destroyRegion();
   }
 
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-
+  /**
+   * Arguments for ExportLogsFunction.
+   */
   public static class Args implements Serializable {
-    private LocalDateTime startTime;
-    private LocalDateTime endTime;
-    private Level logLevel;
-    private boolean thisLogLevelOnly;
-    private boolean includeLogs;
-    private boolean includeStats;
-
-    public Args(String startTime, String endTime, String logLevel, boolean logLevelOnly,
-        boolean logsOnly, boolean statsOnly) {
-      this.startTime = parseTime(startTime);
-      this.endTime = parseTime(endTime);
+
+    private final LocalDateTime startTime;
+    private final LocalDateTime endTime;
+    private final Level logLevel;
+    private final boolean thisLogLevelOnly;
+    private final boolean includeLogs;
+    private final boolean includeStats;
+
+    public Args(final String startTime, final String endTime, final String logLevel,
+        final boolean logLevelOnly, final boolean logsOnly, final boolean statsOnly) {
+      this.startTime = TimeParser.parseTime(startTime);
+      this.endTime = TimeParser.parseTime(endTime);
 
       if (StringUtils.isBlank(logLevel)) {
         this.logLevel = LogLevel.getLevel(ExportLogsCommand.DEFAULT_EXPORT_LOG_LEVEL);
@@ -203,21 +202,4 @@ public class ExportLogsFunction implements Function, InternalEntity {
     }
   }
 
-  public static LocalDateTime parseTime(String dateString) {
-    if (dateString == null) {
-      return null;
-    }
-
-    try {
-      SimpleDateFormat df = new SimpleDateFormat(ExportLogsCommand.FORMAT);
-      return df.parse(dateString).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-    } catch (ParseException e) {
-      try {
-        SimpleDateFormat df = new SimpleDateFormat(ExportLogsCommand.ONLY_DATE_FORMAT);
-        return df.parse(dateString).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-      } catch (ParseException e1) {
-        return null;
-      }
-    }
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchRegionAttributesFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchRegionAttributesFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchRegionAttributesFunction.java
index 1173568..ba7fc54 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchRegionAttributesFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchRegionAttributesFunction.java
@@ -20,29 +20,23 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.AttributesFactory;
 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.Region;
 import org.apache.geode.cache.RegionAttributes;
-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.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
 /**
- * 
  * @since GemFire 7.0
  */
-public class FetchRegionAttributesFunction extends FunctionAdapter {
-  private static final Logger logger = LogService.getLogger();
-
+public class FetchRegionAttributesFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 4366812590788342070L;
-
-  private static final String ID = FetchRegionAttributesFunction.class.getName();
-
-  public static FetchRegionAttributesFunction INSTANCE = new FetchRegionAttributesFunction();
+  private static final Logger logger = LogService.getLogger();
 
   @Override
   public boolean isHA() {
@@ -50,15 +44,17 @@ public class FetchRegionAttributesFunction extends FunctionAdapter {
   }
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     try {
       String regionPath = (String) context.getArguments();
       if (regionPath == null) {
         throw new IllegalArgumentException(
             CliStrings.CREATE_REGION__MSG__SPECIFY_VALID_REGION_PATH);
       }
-      FetchRegionAttributesFunctionResult<?, ?> result = getRegionAttributes(regionPath);
+      FetchRegionAttributesFunctionResult<?, ?> result =
+          getRegionAttributes(context.getCache(), regionPath);
       context.getResultSender().lastResult(result);
+
     } catch (IllegalArgumentException e) {
       if (logger.isDebugEnabled()) {
         logger.debug(e.getMessage(), e);
@@ -67,10 +63,8 @@ public class FetchRegionAttributesFunction extends FunctionAdapter {
     }
   }
 
-  @SuppressWarnings("deprecation")
   public static <K, V> FetchRegionAttributesFunctionResult<K, V> getRegionAttributes(
-      String regionPath) {
-    Cache cache = CacheFactory.getAnyInstance();
+      final Cache cache, final String regionPath) {
     Region<K, V> foundRegion = cache.getRegion(regionPath);
 
     if (foundRegion == null) {
@@ -87,40 +81,45 @@ public class FetchRegionAttributesFunction extends FunctionAdapter {
     return result;
   }
 
-  @Override
-  public String getId() {
-    return ID;
-  }
-
+  /**
+   * Result of executing FetchRegionAttributesFunction.
+   */
   public static class FetchRegionAttributesFunctionResult<K, V> implements Serializable {
     private static final long serialVersionUID = -3970828263897978845L;
 
-    private RegionAttributes<K, V> regionAttributes;
-    private String[] cacheListenerClasses;
-    private String cacheLoaderClass;
-    private String cacheWriterClass;
+    private final RegionAttributes<K, V> regionAttributes;
+    private final String[] cacheListenerClasses;
+    private final String cacheLoaderClass;
+    private final String cacheWriterClass;
 
-    @SuppressWarnings("deprecation")
-    public FetchRegionAttributesFunctionResult(AttributesFactory<K, V> afactory) {
-      this.regionAttributes = afactory.create();
+    public FetchRegionAttributesFunctionResult(final AttributesFactory<K, V> afactory) {
+      RegionAttributes<K, V> regionAttributes = afactory.create();
 
-      CacheListener<K, V>[] cacheListeners = this.regionAttributes.getCacheListeners();
+      CacheListener<K, V>[] cacheListeners = regionAttributes.getCacheListeners();
       if (cacheListeners != null && cacheListeners.length != 0) {
         cacheListenerClasses = new String[cacheListeners.length];
         for (int i = 0; i < cacheListeners.length; i++) {
           cacheListenerClasses[i] = cacheListeners[i].getClass().getName();
         }
         afactory.initCacheListeners(null);
+      } else {
+        cacheListenerClasses = null;
       }
-      CacheLoader<K, V> cacheLoader = this.regionAttributes.getCacheLoader();
+
+      CacheLoader<K, V> cacheLoader = regionAttributes.getCacheLoader();
       if (cacheLoader != null) {
         cacheLoaderClass = cacheLoader.getClass().getName();
         afactory.setCacheLoader(null);
+      } else {
+        cacheLoaderClass = null;
       }
-      CacheWriter<K, V> cacheWriter = this.regionAttributes.getCacheWriter();
+
+      CacheWriter<K, V> cacheWriter = regionAttributes.getCacheWriter();
       if (cacheWriter != null) {
         cacheWriterClass = cacheWriter.getClass().getName();
         afactory.setCacheWriter(null);
+      } else {
+        cacheWriterClass = null;
       }
 
       // recreate attributes
@@ -143,4 +142,5 @@ public class FetchRegionAttributesFunction extends FunctionAdapter {
       return cacheWriterClass;
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
index c688d7a..a7204d3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
@@ -15,24 +15,22 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.geode.cache.execute.FunctionAdapter;
+
+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.DistributedMember;
 import org.apache.geode.distributed.internal.InternalLocator;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
 
-public class FetchSharedConfigurationStatusFunction extends FunctionAdapter
-    implements InternalEntity {
-
+public class FetchSharedConfigurationStatusFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     InternalLocator locator = InternalLocator.getLocator();
-    InternalCache cache = GemFireCacheImpl.getInstance();
+    Cache cache = context.getCache();
     DistributedMember member = cache.getDistributedSystem().getDistributedMember();
     SharedConfigurationStatus status = locator.getSharedConfigurationStatus().getStatus();
 
@@ -45,9 +43,4 @@ public class FetchSharedConfigurationStatusFunction extends FunctionAdapter
     context.getResultSender().lastResult(result);
   }
 
-  @Override
-  public String getId() {
-    return FetchSharedConfigurationStatusFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
index 46588eb..60a165c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
@@ -16,8 +16,8 @@ package org.apache.geode.management.internal.cli.functions;
 
 import java.util.HashMap;
 import java.util.Map;
+
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
@@ -26,24 +26,18 @@ import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.util.BytesToString;
 
 /**
- * 
  * Class for Garbage collection function
- * 
- * 
- * 
  */
 public class GarbageCollectionFunction implements Function, InternalEntity {
-  public static final String ID = GarbageCollectionFunction.class.getName();
-
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     BytesToString bytesToString = new BytesToString();
 
     Map<String, String> resultMap = null;
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
       long freeMemoryBeforeGC = Runtime.getRuntime().freeMemory();
       long totalMemoryBeforeGC = Runtime.getRuntime().totalMemory();
@@ -59,6 +53,7 @@ public class GarbageCollectionFunction implements Function, InternalEntity {
       resultMap.put("HeapSizeBeforeGC", bytesToString.of(totalMemoryBeforeGC - freeMemoryBeforeGC));
       resultMap.put("HeapSizeAfterGC", bytesToString.of(totalMemoryAfterGC - freeMemoryAfterGC));
       resultMap.put("TimeSpentInGC", String.valueOf(timeAfterGC - timeBeforeGC));
+
     } catch (Exception ex) {
       String message = "Exception in GC:" + ex.getMessage() + CliUtil.stackTraceAsString(ex);
 
@@ -68,14 +63,10 @@ public class GarbageCollectionFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return GarbageCollectionFunction.ID;
-  }
-
-  @Override
   public boolean isHA() {
     return false;
   }
+
 }
 
 

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
index a7dc7ea..2d27569 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
@@ -20,8 +20,7 @@ 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.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.cache.wan.GatewayReceiver;
@@ -38,21 +37,15 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 /**
  * The function to a create GatewayReceiver using given configuration parameters.
  */
-public class GatewayReceiverCreateFunction extends FunctionAdapter implements InternalEntity {
-
-  private static final Logger logger = LogService.getLogger();
-
+public class GatewayReceiverCreateFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 8746830191680509335L;
-
-  private static final String ID = GatewayReceiverCreateFunction.class.getName();
-
-  public static GatewayReceiverCreateFunction INSTANCE = new GatewayReceiverCreateFunction();
+  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());
 
@@ -63,26 +56,30 @@ public class GatewayReceiverCreateFunction extends FunctionAdapter implements In
       GatewayReceiver createdGatewayReceiver =
           createGatewayReceiver(cache, gatewayReceiverCreateArgs);
 
-      Map<String, String> attributes = new HashMap<String, String>();
+      Map<String, String> attributes = new HashMap<>();
+
       if (gatewayReceiverCreateArgs.getStartPort() != null) {
         attributes.put("start-port", gatewayReceiverCreateArgs.getStartPort().toString());
       }
+
       if (gatewayReceiverCreateArgs.getEndPort() != null) {
         attributes.put("end-port", gatewayReceiverCreateArgs.getEndPort().toString());
       }
+
       if (gatewayReceiverCreateArgs.getBindAddress() != null) {
         attributes.put("bind-address", gatewayReceiverCreateArgs.getBindAddress());
       }
+
       XmlEntity xmlEntity = XmlEntity.builder().withType(CacheXml.GATEWAY_RECEIVER)
           .withAttributes(attributes).build();
       resultSender.lastResult(new CliFunctionResult(memberNameOrId, xmlEntity,
           CliStrings.format(
               CliStrings.CREATE_GATEWAYRECEIVER__MSG__GATEWAYRECEIVER_CREATED_ON_0_ONPORT_1,
-              new Object[] {memberNameOrId, createdGatewayReceiver.getPort()})));
-
+              memberNameOrId, createdGatewayReceiver.getPort())));
 
     } catch (IllegalStateException e) {
       resultSender.lastResult(handleException(memberNameOrId, e.getMessage(), e));
+
     } catch (Exception e) {
       String exceptionMsg = e.getMessage();
       if (exceptionMsg == null) {
@@ -90,7 +87,6 @@ public class GatewayReceiverCreateFunction extends FunctionAdapter implements In
       }
       resultSender.lastResult(handleException(memberNameOrId, exceptionMsg, e));
     }
-
   }
 
   private CliFunctionResult handleException(final String memberNameOrId, final String exceptionMsg,
@@ -107,13 +103,9 @@ public class GatewayReceiverCreateFunction extends FunctionAdapter implements In
 
   /**
    * GatewayReceiver creation happens here.
-   * 
-   * @param cache
-   * @param gatewayReceiverCreateArgs
-   * @return GatewayReceiver
    */
-  private static GatewayReceiver createGatewayReceiver(Cache cache,
-      GatewayReceiverFunctionArgs gatewayReceiverCreateArgs) {
+  private static GatewayReceiver createGatewayReceiver(final Cache cache,
+      final GatewayReceiverFunctionArgs gatewayReceiverCreateArgs) {
 
     GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
 
@@ -160,20 +152,22 @@ public class GatewayReceiverCreateFunction extends FunctionAdapter implements In
     return gatewayReceiverFactory.create();
   }
 
-  @SuppressWarnings("unchecked")
-  private static Class forName(String classToLoadName, String neededFor) {
+  private static Class forName(final String classToLoadName, final String neededFor) {
     Class loadedClass = null;
+
     try {
       // Set Constraints
       ClassPathLoader classPathLoader = ClassPathLoader.getLatest();
       if (classToLoadName != null && !classToLoadName.isEmpty()) {
         loadedClass = classPathLoader.forName(classToLoadName);
       }
+
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(
           CliStrings.format(CliStrings.CREATE_REGION__MSG__COULD_NOT_FIND_CLASS_0_SPECIFIED_FOR_1,
               classToLoadName, neededFor),
           e);
+
     } catch (ClassCastException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_REGION__MSG__CLASS_SPECIFIED_FOR_0_SPECIFIED_FOR_1_IS_NOT_OF_EXPECTED_TYPE,
@@ -183,25 +177,24 @@ public class GatewayReceiverCreateFunction extends FunctionAdapter implements In
     return loadedClass;
   }
 
-  private static Object newInstance(Class klass, String neededFor) {
-    Object instance = null;
+  private static Object newInstance(final Class klass, final String neededFor) {
+    Object instance;
+
     try {
       instance = klass.newInstance();
+
     } catch (InstantiationException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_GATEWAYSENDER__MSG__COULD_NOT_INSTANTIATE_CLASS_0_SPECIFIED_FOR_1,
           klass, neededFor), e);
+
     } catch (IllegalAccessException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_GATEWAYSENDER__MSG__COULD_NOT_ACCESS_CLASS_0_SPECIFIED_FOR_1, klass,
           neededFor), e);
     }
-    return instance;
-  }
 
-  @Override
-  public String getId() {
-    return ID;
+    return instance;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverFunctionArgs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverFunctionArgs.java
index 2084af9..615c683 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverFunctionArgs.java
@@ -23,22 +23,16 @@ public class GatewayReceiverFunctionArgs implements Serializable {
   private static final long serialVersionUID = -5158224572470173267L;
 
   private final Boolean manualStart;
-
   private final Integer startPort;
-
   private final Integer endPort;
-
   private final String bindAddress;
-
   private final Integer socketBufferSize;
-
   private final Integer maximumTimeBetweenPings;
-
   private final String[] gatewayTransportFilters;
 
-  public GatewayReceiverFunctionArgs(Boolean manualStart, Integer startPort, Integer endPort,
-      String bindAddress, Integer socketBufferSize, Integer maximumTimeBetweenPings,
-      String[] gatewayTransportFilters) {
+  public GatewayReceiverFunctionArgs(final Boolean manualStart, final Integer startPort,
+      final Integer endPort, final String bindAddress, final Integer socketBufferSize,
+      final Integer maximumTimeBetweenPings, final String[] gatewayTransportFilters) {
     this.manualStart = manualStart;
     this.startPort = startPort;
     this.endPort = endPort;
@@ -75,4 +69,5 @@ public class GatewayReceiverFunctionArgs implements Serializable {
   public String[] getGatewayTransportFilters() {
     return this.gatewayTransportFilters;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
index 33bffd8..cb9d02d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
@@ -17,8 +17,7 @@ package org.apache.geode.management.internal.cli.functions;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-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.cache.wan.GatewayEventFilter;
@@ -35,22 +34,15 @@ import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
-public class GatewaySenderCreateFunction extends FunctionAdapter implements InternalEntity {
-
-  private static final Logger logger = LogService.getLogger();
-
+public class GatewaySenderCreateFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 8746830191680509335L;
-
-  private static final String ID = GatewaySenderCreateFunction.class.getName();
-
-  public static GatewaySenderCreateFunction INSTANCE = new GatewaySenderCreateFunction();
-
+  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());
 
@@ -63,9 +55,11 @@ public class GatewaySenderCreateFunction extends FunctionAdapter implements Inte
           new XmlEntity(CacheXml.GATEWAY_SENDER, "id", gatewaySenderCreateArgs.getId());
       resultSender.lastResult(new CliFunctionResult(memberNameOrId, xmlEntity,
           CliStrings.format(CliStrings.CREATE_GATEWAYSENDER__MSG__GATEWAYSENDER_0_CREATED_ON_1,
-              new Object[] {createdGatewaySender.getId(), memberNameOrId})));
+              createdGatewaySender.getId(), memberNameOrId)));
+
     } catch (GatewaySenderException e) {
       resultSender.lastResult(handleException(memberNameOrId, e.getMessage(), e));
+
     } catch (Exception e) {
       String exceptionMsg = e.getMessage();
       if (exceptionMsg == null) {
@@ -89,13 +83,9 @@ public class GatewaySenderCreateFunction extends FunctionAdapter implements Inte
 
   /**
    * Creates the GatewaySender with given configuration.
-   * 
-   * @param cache
-   * @param gatewaySenderCreateArgs
-   * @return GatewaySender
    */
-  private static GatewaySender createGatewaySender(Cache cache,
-      GatewaySenderFunctionArgs gatewaySenderCreateArgs) {
+  private static GatewaySender createGatewaySender(final Cache cache,
+      final GatewaySenderFunctionArgs gatewaySenderCreateArgs) {
     GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
 
     Boolean isParallel = gatewaySenderCreateArgs.isParallel();
@@ -189,20 +179,22 @@ public class GatewaySenderCreateFunction extends FunctionAdapter implements Inte
         gatewaySenderCreateArgs.getRemoteDistributedSystemId());
   }
 
-  @SuppressWarnings("unchecked")
-  private static Class forName(String classToLoadName, String neededFor) {
+  private static Class forName(final String classToLoadName, final String neededFor) {
     Class loadedClass = null;
+
     try {
       // Set Constraints
       ClassPathLoader classPathLoader = ClassPathLoader.getLatest();
       if (classToLoadName != null && !classToLoadName.isEmpty()) {
         loadedClass = classPathLoader.forName(classToLoadName);
       }
+
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(
           CliStrings.format(CliStrings.CREATE_REGION__MSG__COULD_NOT_FIND_CLASS_0_SPECIFIED_FOR_1,
               classToLoadName, neededFor),
           e);
+
     } catch (ClassCastException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_REGION__MSG__CLASS_SPECIFIED_FOR_0_SPECIFIED_FOR_1_IS_NOT_OF_EXPECTED_TYPE,
@@ -212,25 +204,24 @@ public class GatewaySenderCreateFunction extends FunctionAdapter implements Inte
     return loadedClass;
   }
 
-  private static Object newInstance(Class klass, String neededFor) {
-    Object instance = null;
+  private static Object newInstance(final Class klass, final String neededFor) {
+    Object instance;
+
     try {
       instance = klass.newInstance();
+
     } catch (InstantiationException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_GATEWAYSENDER__MSG__COULD_NOT_INSTANTIATE_CLASS_0_SPECIFIED_FOR_1,
           klass, neededFor), e);
+
     } catch (IllegalAccessException e) {
       throw new RuntimeException(CliStrings.format(
           CliStrings.CREATE_GATEWAYSENDER__MSG__COULD_NOT_ACCESS_CLASS_0_SPECIFIED_FOR_1, klass,
           neededFor), e);
     }
-    return instance;
-  }
 
-  @Override
-  public String getId() {
-    return ID;
+    return instance;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
index 2873633..6ac5387 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
@@ -14,9 +14,10 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-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.cache.wan.GatewaySender;
@@ -25,20 +26,16 @@ import org.apache.geode.internal.cache.wan.GatewaySenderException;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.logging.log4j.Logger;
 
-public class GatewaySenderDestroyFunction extends FunctionAdapter implements InternalEntity {
+public class GatewaySenderDestroyFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
-
   private static final Logger logger = LogService.getLogger();
-  private static final String ID = GatewaySenderDestroyFunction.class.getName();
-  public static GatewaySenderDestroyFunction INSTANCE = new GatewaySenderDestroyFunction();
 
   @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());
 
@@ -53,14 +50,15 @@ public class GatewaySenderDestroyFunction extends FunctionAdapter implements Int
         gatewaySender.destroy();
       } else {
         throw new GatewaySenderException(
-            "GateWaySender with Id  " + gatewaySenderDestroyFunctionArgs.getId() + " not found");
+            "GatewaySender with id " + gatewaySenderDestroyFunctionArgs.getId() + " not found");
       }
       resultSender.lastResult(new CliFunctionResult(memberNameOrId, true,
           CliStrings.format(CliStrings.DESTROY_GATEWAYSENDER__MSG__GATEWAYSENDER_0_DESTROYED_ON_1,
-              new Object[] {gatewaySenderDestroyFunctionArgs.getId(), memberNameOrId})));
+              gatewaySenderDestroyFunctionArgs.getId(), memberNameOrId)));
 
     } catch (GatewaySenderException gse) {
       resultSender.lastResult(handleException(memberNameOrId, gse.getMessage(), gse));
+
     } catch (Exception e) {
       String exceptionMsg = e.getMessage();
       if (exceptionMsg == null) {
@@ -82,9 +80,4 @@ public class GatewaySenderDestroyFunction extends FunctionAdapter implements Int
     return new CliFunctionResult(memberNameOrId);
   }
 
-  @Override
-  public String getId() {
-    return ID;
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
index cf3fa24..440acbb 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
@@ -17,17 +17,17 @@ package org.apache.geode.management.internal.cli.functions;
 import java.io.Serializable;
 
 public class GatewaySenderDestroyFunctionArgs implements Serializable {
-
   private static final long serialVersionUID = 3848480256348119530L;
-  private String id;
 
+  private final String id;
 
-  public GatewaySenderDestroyFunctionArgs(String id) {
+  public GatewaySenderDestroyFunctionArgs(final String id) {
     this.id = id;
   }
 
   public String getId() {
     return id;
   }
+
 }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderFunctionArgs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderFunctionArgs.java
index 0e4f635..8dbda6e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderFunctionArgs.java
@@ -16,7 +16,6 @@ package org.apache.geode.management.internal.cli.functions;
 
 import java.io.Serializable;
 
-
 public class GatewaySenderFunctionArgs implements Serializable {
   private static final long serialVersionUID = -5158224572470173267L;
 
@@ -36,16 +35,18 @@ public class GatewaySenderFunctionArgs implements Serializable {
   private final Integer alertThreshold;
   private final Integer dispatcherThreads;
   private final String orderPolicy;
-  // array of fully qualified class names of the filters
+
+  /** array of fully qualified class names of the filters */
   private final String[] gatewayEventFilters;
   private final String[] gatewayTransportFilters;
 
-  public GatewaySenderFunctionArgs(String id, Integer remoteDSId, Boolean parallel,
-      Boolean manualStart, Integer socketBufferSize, Integer socketReadTimeout,
-      Boolean enableBatchConflation, Integer batchSize, Integer batchTimeInterval,
-      Boolean enablePersistence, String diskStoreName, Boolean diskSynchronous,
-      Integer maxQueueMemory, Integer alertThreshold, Integer dispatcherThreads, String orderPolicy,
-      String[] gatewayEventFilters, String[] gatewayTransportFilters) {
+  public GatewaySenderFunctionArgs(final String id, final Integer remoteDSId,
+      final Boolean parallel, final Boolean manualStart, final Integer socketBufferSize,
+      final Integer socketReadTimeout, final Boolean enableBatchConflation, final Integer batchSize,
+      final Integer batchTimeInterval, final Boolean enablePersistence, final String diskStoreName,
+      final Boolean diskSynchronous, final Integer maxQueueMemory, final Integer alertThreshold,
+      final Integer dispatcherThreads, final String orderPolicy, final String[] gatewayEventFilters,
+      final String[] gatewayTransportFilters) {
 
     this.id = id;
     this.remoteDSId = remoteDSId;
@@ -138,4 +139,5 @@ public class GatewaySenderFunctionArgs implements Serializable {
   public String[] getGatewayTransportFilter() {
     return this.gatewayTransportFilters;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
index 56ba115..cd9eb4c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
@@ -14,9 +14,18 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
+import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE;
+
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-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.server.CacheServer;
 import org.apache.geode.distributed.internal.DistributionConfig;
@@ -29,30 +38,15 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.ha.HARegionQueue;
 import org.apache.geode.management.internal.cli.domain.MemberConfigurationInfo;
 
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.util.*;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-/****
- * 
- *
- */
-public class GetMemberConfigInformationFunction extends FunctionAdapter implements InternalEntity {
-
-  /**
-   * 
-   */
+public class GetMemberConfigInformationFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
-
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     Object argsObject = context.getArguments();
-    boolean hideDefaults = ((Boolean) argsObject).booleanValue();
+    boolean hideDefaults = (Boolean) argsObject;
 
-    Cache cache = CacheFactory.getAnyInstance();
+    Cache cache = context.getCache();
     InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
     DistributionConfig config = system.getConfig();
 
@@ -70,7 +64,7 @@ public class GetMemberConfigInformationFunction extends FunctionAdapter implemen
     memberConfigInfo.setGfePropsSetFromFile(distConfigImpl.getConfigPropsDefinedUsingFiles());
 
     // CacheAttributes
-    Map<String, String> cacheAttributes = new HashMap<String, String>();
+    Map<String, String> cacheAttributes = new HashMap<>();
 
     cacheAttributes.put("copy-on-read", Boolean.toString(cache.getCopyOnRead()));
     cacheAttributes.put("is-server", Boolean.toString(cache.isServer()));
@@ -96,12 +90,12 @@ public class GetMemberConfigInformationFunction extends FunctionAdapter implemen
 
     memberConfigInfo.setCacheAttributes(cacheAttributes);
 
-    List<Map<String, String>> cacheServerAttributesList = new ArrayList<Map<String, String>>();
+    List<Map<String, String>> cacheServerAttributesList = new ArrayList<>();
     List<CacheServer> cacheServers = cache.getCacheServers();
 
     if (cacheServers != null)
       for (CacheServer cacheServer : cacheServers) {
-        Map<String, String> cacheServerAttributes = new HashMap<String, String>();
+        Map<String, String> cacheServerAttributes = new HashMap<>();
 
         cacheServerAttributes.put("bind-address", cacheServer.getBindAddress());
         cacheServerAttributes.put("hostname-for-clients", cacheServer.getHostnameForClients());
@@ -134,14 +128,13 @@ public class GetMemberConfigInformationFunction extends FunctionAdapter implemen
     context.getResultSender().lastResult(memberConfigInfo);
   }
 
-  /****
+  /**
    * Gets the default values for the cache attributes
    * 
    * @return a map containing the cache attributes - default values
    */
   private Map<String, String> getCacheAttributesDefaultValues() {
-    String d = CacheConfig.DEFAULT_PDX_DISK_STORE;
-    Map<String, String> cacheAttributesDefault = new HashMap<String, String>();
+    Map<String, String> cacheAttributesDefault = new HashMap<>();
     cacheAttributesDefault.put("pdx-disk-store", "");
     cacheAttributesDefault.put("pdx-read-serialized",
         Boolean.toString(CacheConfig.DEFAULT_PDX_READ_SERIALIZED));
@@ -163,13 +156,13 @@ public class GetMemberConfigInformationFunction extends FunctionAdapter implemen
     return cacheAttributesDefault;
   }
 
-  /***
+  /**
    * Gets the default values for the cache attributes
    * 
    * @return a map containing the cache server attributes - default values
    */
   private Map<String, String> getCacheServerAttributesDefaultValues() {
-    Map<String, String> csAttributesDefault = new HashMap<String, String>();
+    Map<String, String> csAttributesDefault = new HashMap<>();
     csAttributesDefault.put("bind-address", CacheServer.DEFAULT_BIND_ADDRESS);
     csAttributesDefault.put("hostname-for-clients", CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS);
     csAttributesDefault.put("max-connections",
@@ -189,46 +182,34 @@ public class GetMemberConfigInformationFunction extends FunctionAdapter implemen
     csAttributesDefault.put("load-poll-interval",
         Long.toString(CacheServer.DEFAULT_LOAD_POLL_INTERVAL));
     return csAttributesDefault;
-
   }
 
-  /****
+  /**
    * Removes the default values from the attributesMap based on defaultAttributesMap
-   * 
-   * @param attributesMap
-   * @param defaultAttributesMap
    */
-  private void removeDefaults(Map<String, String> attributesMap,
-      Map<String, String> defaultAttributesMap) {
+  private void removeDefaults(final Map<String, String> attributesMap,
+      final Map<String, String> defaultAttributesMap) {
     // Make a copy to avoid the CME's
-    Set<String> attributesSet = new HashSet<String>(attributesMap.keySet());
-
-    if (attributesSet != null) {
-      for (String attribute : attributesSet) {
-        String attributeValue = attributesMap.get(attribute);
-        String defaultValue = defaultAttributesMap.get(attribute);
-
-        if (attributeValue != null) {
-          if (attributeValue.equals(defaultValue)) {
-            attributesMap.remove(attribute);
-          }
-        } else {
-          if (defaultValue == null || defaultValue.equals("")) {
-            attributesMap.remove(attribute);
-          }
+    Set<String> attributesSet = new HashSet<>(attributesMap.keySet());
+
+    for (String attribute : attributesSet) {
+      String attributeValue = attributesMap.get(attribute);
+      String defaultValue = defaultAttributesMap.get(attribute);
+
+      if (attributeValue != null) {
+        if (attributeValue.equals(defaultValue)) {
+          attributesMap.remove(attribute);
+        }
+      } else {
+        if (defaultValue == null || defaultValue.equals("")) {
+          attributesMap.remove(attribute);
         }
       }
     }
   }
 
-  @Override
-  public String getId() {
-    // TODO Auto-generated method stub
-    return GetMemberConfigInformationFunction.class.toString();
-  }
-
   private List<String> getJvmInputArguments() {
-    RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
-    return runtimeBean.getInputArguments();
+    return ManagementFactory.getRuntimeMXBean().getInputArguments();
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
index 70fa68b..f8abc2e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
@@ -14,75 +14,41 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import org.apache.geode.cache.Cache;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryUsage;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
-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.server.CacheServer;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.CacheClientStatus;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.tier.InternalClientMembership;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.domain.CacheServerInfo;
 import org.apache.geode.management.internal.cli.domain.MemberInformation;
 
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryUsage;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/***
- * 
- * since 7.0
+/**
+ * @since GemFire 7.0
  */
-
-public class GetMemberInformationFunction extends FunctionAdapter implements InternalEntity {
-  /**
-   * 
-   */
+public class GetMemberInformationFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public String getId() {
-    return GetMemberInformationFunction.class.getName();
-  }
-
-  @Override
-
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-
-  public boolean isHA() {
-    return true;
-  }
-
-  @Override
-  /**
-   * Read only function
-   */
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public void execute(FunctionContext functionContext) {
+  public void execute(final FunctionContext functionContext) {
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      InternalCache cache = (InternalCache) functionContext.getCache();
 
-      /*
-       * TODO: 1) Get the CPU usage%
-       */
+      // TODO: 1) Get the CPU usage%
 
-      InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
+      InternalDistributedSystem system = cache.getInternalDistributedSystem();
       DistributionConfig config = system.getConfig();
       String serverBindAddress = config.getServerBindAddress();
       MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
@@ -108,10 +74,7 @@ public class GetMemberInformationFunction extends FunctionAdapter implements Int
       // A member is a server only if it has a cacheserver
       if (csList != null) {
         memberInfo.setServer(true);
-        Iterator<CacheServer> iters = csList.iterator();
-        while (iters.hasNext()) {
-          CacheServer cs = iters.next();
-
+        for (CacheServer cs : csList) {
           String bindAddress = cs.getBindAddress();
           int port = cs.getPort();
           boolean isRunning = cs.isRunning();
@@ -119,28 +82,49 @@ public class GetMemberInformationFunction extends FunctionAdapter implements Int
           CacheServerInfo cacheServerInfo = new CacheServerInfo(bindAddress, port, isRunning);
           memberInfo.addCacheServerInfo(cacheServerInfo);
         }
+
         Map<ClientProxyMembershipID, CacheClientStatus> allConnectedClients =
             InternalClientMembership.getStatusForAllClientsIgnoreSubscriptionStatus();
-        Iterator<ClientProxyMembershipID> it = allConnectedClients.keySet().iterator();
-        int numConnections = 0;
 
-        while (it.hasNext()) {
-          CacheClientStatus status = allConnectedClients.get(it.next());
+        int numConnections = 0;
+        for (ClientProxyMembershipID clientProxyMembershipID : allConnectedClients.keySet()) {
+          CacheClientStatus status = allConnectedClients.get(clientProxyMembershipID);
           numConnections = numConnections + status.getNumberOfConnections();
         }
+
         memberInfo.setClientCount(numConnections);
+
       } else {
         memberInfo.setServer(false);
       }
+
       functionContext.getResultSender().lastResult(memberInfo);
+
     } catch (CacheClosedException e) {
       functionContext.getResultSender().sendException(e);
+
     } catch (Exception e) {
       functionContext.getResultSender().sendException(e);
     }
   }
 
-  private long bytesToMeg(long bytes) {
+  @Override
+  public boolean hasResult() {
+    return true;
+  }
+
+  @Override
+  public boolean isHA() {
+    return true;
+  }
+
+  @Override
+  public boolean optimizeForWrite() {
+    return false;
+  }
+
+  private long bytesToMeg(final long bytes) {
     return bytes / (1024L * 1024L);
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionDescriptionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionDescriptionFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionDescriptionFunction.java
index cbf70ac..657d4a8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionDescriptionFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionDescriptionFunction.java
@@ -14,26 +14,23 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 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.internal.InternalEntity;
 import org.apache.geode.management.internal.cli.domain.RegionDescriptionPerMember;
 
-public class GetRegionDescriptionFunction extends FunctionAdapter implements InternalEntity {
-
-
+public class GetRegionDescriptionFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     String regionPath = (String) context.getArguments();
+
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       Region<?, ?> region = cache.getRegion(regionPath);
 
       if (region != null) {
@@ -44,17 +41,13 @@ public class GetRegionDescriptionFunction extends FunctionAdapter implements Int
       } else {
         context.getResultSender().lastResult(null);
       }
+
     } catch (CacheClosedException e) {
       context.getResultSender().sendException(e);
+
     } catch (Exception e) {
       context.getResultSender().sendException(e);
     }
   }
 
-  @Override
-  public String getId() {
-    // TODO Auto-generated method stub
-    return GetRegionDescriptionFunction.class.toString();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionsFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionsFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionsFunction.java
index 6571dca..e6a6173 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionsFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetRegionsFunction.java
@@ -28,17 +28,10 @@ import org.apache.geode.management.internal.cli.domain.RegionInformation;
  * Function that retrieves regions hosted on every member
  */
 public class GetRegionsFunction implements Function, InternalEntity {
-
   private static final long serialVersionUID = 1L;
 
   @Override
-  public String getId() {
-    // TODO Auto-generated method stub
-    return GetRegionsFunction.class.toString();
-  }
-
-  @Override
-  public void execute(FunctionContext functionContext) {
+  public void execute(final FunctionContext functionContext) {
     try {
       Cache cache = functionContext.getCache();
       Set<Region<?, ?>> regions = cache.rootRegions(); // should never return a null
@@ -52,8 +45,10 @@ public class GetRegionsFunction implements Function, InternalEntity {
           RegionInformation regInfo = new RegionInformation(region, true);
           regionInformationSet.add(regInfo);
         }
+
         functionContext.getResultSender().lastResult(regionInformationSet.toArray());
       }
+
     } catch (Exception e) {
       functionContext.getResultSender().sendException(e);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetStackTracesFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetStackTracesFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetStackTracesFunction.java
index 4e9f9d6..2714537 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetStackTracesFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetStackTracesFunction.java
@@ -14,23 +14,20 @@
  */
 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.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.OSProcess;
 import org.apache.geode.management.internal.cli.domain.StackTracesPerMember;
 
-public class GetStackTracesFunction extends FunctionAdapter implements InternalEntity {
-
+public class GetStackTracesFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       String memberNameOrId = cache.getDistributedSystem().getDistributedMember().getName();
 
       if (memberNameOrId == null) {
@@ -39,14 +36,10 @@ public class GetStackTracesFunction extends FunctionAdapter implements InternalE
       StackTracesPerMember stackTracePerMember =
           new StackTracesPerMember(memberNameOrId, OSProcess.zipStacks());
       context.getResultSender().lastResult(stackTracePerMember);
+
     } catch (Exception e) {
       context.getResultSender().sendException(e);
     }
   }
 
-  @Override
-  public String getId() {
-    // TODO Auto-generated method stub
-    return GetStackTracesFunction.class.getName();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetSubscriptionQueueSizeFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetSubscriptionQueueSizeFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetSubscriptionQueueSizeFunction.java
index 70b649c..3e5b556 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetSubscriptionQueueSizeFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetSubscriptionQueueSizeFunction.java
@@ -15,7 +15,7 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import org.apache.geode.cache.Cache;
-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.query.CqQuery;
 import org.apache.geode.cache.query.internal.CqQueryVsdStats;
@@ -28,18 +28,16 @@ import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.domain.SubscriptionQueueSizeResult;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-/***
+/**
  * Function to get subscription-queue-size
- *
  */
-public class GetSubscriptionQueueSizeFunction extends FunctionAdapter implements InternalEntity {
-
+public class GetSubscriptionQueueSizeFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
   @Override
-  public void execute(FunctionContext context) {
-    final Cache cache = CliUtil.getCacheIfExists();
-    final String memberNameOrId =
+  public void execute(final FunctionContext context) {
+    Cache cache = context.getCache();
+    String memberNameOrId =
         CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
     String args[] = (String[]) context.getArguments();
     String durableClientId = null, cqName = null;
@@ -90,16 +88,13 @@ public class GetSubscriptionQueueSizeFunction extends FunctionAdapter implements
       } else {
         result.setErrorMessage(CliStrings.NO_CLIENT_FOUND);
       }
+
     } catch (Exception e) {
       result.setExceptionMessage(e.getMessage());
+
     } finally {
       context.getResultSender().lastResult(result);
     }
   }
 
-  @Override
-  public String getId() {
-    return GetSubscriptionQueueSizeFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ImportDataFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ImportDataFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ImportDataFunction.java
index 13949c8..68ed7cf 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ImportDataFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ImportDataFunction.java
@@ -17,9 +17,8 @@ package org.apache.geode.management.internal.cli.functions;
 import java.io.File;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 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.snapshot.RegionSnapshotService;
 import org.apache.geode.cache.snapshot.SnapshotOptions;
@@ -27,28 +26,28 @@ import org.apache.geode.cache.snapshot.SnapshotOptions.SnapshotFormat;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-/****
+/**
  * Function which carries out the import of a region to a file on a member. Uses the
  * RegionSnapshotService to import the data
- *
  */
-public class ImportDataFunction extends FunctionAdapter implements InternalEntity {
-
+public class ImportDataFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
-  public void execute(FunctionContext context) {
-    final Object[] args = (Object[]) context.getArguments();
-    final String regionName = (String) args[0];
-    final String importFileName = (String) args[1];
+  public void execute(final FunctionContext context) {
+    Object[] args = (Object[]) context.getArguments();
+    String regionName = (String) args[0];
+    String importFileName = (String) args[1];
+
     boolean invokeCallbacks = false;
     if (args.length > 2) {
       invokeCallbacks = (boolean) args[2];
     }
 
     try {
-      final Cache cache = CacheFactory.getAnyInstance();
-      final Region<?, ?> region = cache.getRegion(regionName);
-      final String hostName = cache.getDistributedSystem().getDistributedMember().getHost();
+      Cache cache = context.getCache();
+      Region<?, ?> region = cache.getRegion(regionName);
+      String hostName = cache.getDistributedSystem().getDistributedMember().getHost();
+
       if (region != null) {
         RegionSnapshotService<?, ?> snapshotService = region.getSnapshotService();
         SnapshotOptions options = snapshotService.createOptions();
@@ -58,6 +57,7 @@ public class ImportDataFunction extends FunctionAdapter implements InternalEntit
         String successMessage = CliStrings.format(CliStrings.IMPORT_DATA__SUCCESS__MESSAGE,
             importFile.getCanonicalPath(), hostName, regionName);
         context.getResultSender().lastResult(successMessage);
+
       } else {
         throw new IllegalArgumentException(
             CliStrings.format(CliStrings.REGION_NOT_FOUND, regionName));
@@ -68,8 +68,4 @@ public class ImportDataFunction extends FunctionAdapter implements InternalEntit
     }
   }
 
-  public String getId() {
-    return ImportDataFunction.class.getName();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListAsyncEventQueuesFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListAsyncEventQueuesFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListAsyncEventQueuesFunction.java
index 507e9f8..e9bcc17 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListAsyncEventQueuesFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListAsyncEventQueuesFunction.java
@@ -19,14 +19,12 @@ import java.util.Set;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.LogWriter;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
-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;
@@ -37,23 +35,12 @@ import org.apache.geode.management.internal.cli.domain.AsyncEventQueueDetails;
 /**
  * An implementation of GemFire Function interface used to determine all the async event queues that
  * exist for the entire cache, distributed across the GemFire distributed system.
- * </p>
- * 
+ *
  * @since GemFire 8.0
  */
-public class ListAsyncEventQueuesFunction extends FunctionAdapter implements InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
+public class ListAsyncEventQueuesFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
-
-  @Override
-  public String getId() {
-    return getClass().getName();
-  }
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
   public void execute(final FunctionContext context) {
@@ -61,7 +48,7 @@ public class ListAsyncEventQueuesFunction extends FunctionAdapter implements Int
     String memberId = "";
 
     try {
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -105,4 +92,5 @@ public class ListAsyncEventQueuesFunction extends FunctionAdapter implements Int
       context.getResultSender().lastResult(result);
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
index 88a77be..5633946 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
@@ -16,40 +16,32 @@ package org.apache.geode.management.internal.cli.functions;
 
 import java.util.List;
 
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.DeployedJar;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
+import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 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.ClassPathLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.JarDeployer;
-import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 
 public class ListDeployedFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = ListDeployedFunction.class.getName();
-
   private static final long serialVersionUID = 1L;
-
-  private InternalCache getCache() {
-    return (InternalCache) CacheFactory.getAnyInstance();
-  }
+  private static final Logger logger = LogService.getLogger();
 
   @Override
-  public void execute(FunctionContext context) {
+  public void execute(final FunctionContext context) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
-      InternalCache cache = getCache();
-      final JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
+      Cache cache = context.getCache();
+      JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -59,8 +51,9 @@ public class ListDeployedFunction implements Function, InternalEntity {
         memberId = member.getName();
       }
 
-      final List<DeployedJar> jarClassLoaders = jarDeployer.findDeployedJars();
-      final String[] jars = new String[jarClassLoaders.size() * 2];
+      List<DeployedJar> jarClassLoaders = jarDeployer.findDeployedJars();
+      String[] jars = new String[jarClassLoaders.size() * 2];
+
       int index = 0;
       for (DeployedJar jarClassLoader : jarClassLoaders) {
         jars[index++] = jarClassLoader.getJarName();
@@ -87,11 +80,6 @@ public class ListDeployedFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }
@@ -105,4 +93,5 @@ public class ListDeployedFunction implements Function, InternalEntity {
   public boolean isHA() {
     return false;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunction.java
index 80c84b5..0b5f1a6 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDiskStoresFunction.java
@@ -16,13 +16,10 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import java.util.HashSet;
-import java.util.Properties;
 import java.util.Set;
 
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.DiskStore;
-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;
@@ -33,47 +30,34 @@ import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
  * The ListDiskStoresFunction class is an implementation of GemFire Function interface used to
  * determine all the disk stores that exist for the entire cache, distributed across the GemFire
  * distributed system.
- * </p>
- * 
+ *
  * @see org.apache.geode.cache.DiskStore
  * @see org.apache.geode.cache.execute.Function
  * @see org.apache.geode.cache.execute.FunctionAdapter
  * @see org.apache.geode.cache.execute.FunctionContext
  * @see org.apache.geode.internal.InternalEntity
  * @see org.apache.geode.management.internal.cli.domain.DiskStoreDetails
+ *
  * @since GemFire 7.0
  */
-public class ListDiskStoresFunction extends FunctionAdapter implements InternalEntity {
-
-  @SuppressWarnings("unused")
-  public void init(final Properties props) {}
-
-  public String getId() {
-    return getClass().getName();
-  }
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
+public class ListDiskStoresFunction implements Function, InternalEntity {
 
+  @Override
   public void execute(final FunctionContext context) {
-    final Set<DiskStoreDetails> memberDiskStores = new HashSet<DiskStoreDetails>();
+    Set<DiskStoreDetails> memberDiskStores = new HashSet<>();
 
     try {
-      final Cache cache = getCache();
+      InternalCache cache = (InternalCache) context.getCache();
 
-      if (cache instanceof InternalCache) {
-        final InternalCache gemfireCache = (InternalCache) cache;
+      DistributedMember member = cache.getMyId();
 
-        final DistributedMember member = gemfireCache.getMyId();
-
-        for (final DiskStore memberDiskStore : gemfireCache.listDiskStoresIncludingRegionOwned()) {
-          memberDiskStores.add(new DiskStoreDetails(memberDiskStore.getDiskStoreUUID(),
-              memberDiskStore.getName(), member.getId(), member.getName()));
-        }
+      for (DiskStore memberDiskStore : cache.listDiskStoresIncludingRegionOwned()) {
+        memberDiskStores.add(new DiskStoreDetails(memberDiskStore.getDiskStoreUUID(),
+            memberDiskStore.getName(), member.getId(), member.getName()));
       }
 
       context.getResultSender().lastResult(memberDiskStores);
+
     } catch (Exception e) {
       context.getResultSender().sendException(e);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction.java
index 434c619..d9db328 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDurableCqNamesFunction.java
@@ -16,12 +16,10 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-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.query.internal.cq.CqService;
 import org.apache.geode.distributed.DistributedMember;
@@ -35,31 +33,22 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
 /**
  * The ListDurableCqs class is a GemFire function used to collect all the durable client names on
  * the server
- * </p>
- * 
+ *
  * @see org.apache.geode.cache.Cache
  * @see org.apache.geode.cache.execute.Function
  * @see org.apache.geode.cache.execute.FunctionAdapter
  * @see org.apache.geode.cache.execute.FunctionContext
  * @see org.apache.geode.internal.InternalEntity
  * @see org.apache.geode.management.internal.cli.domain.IndexDetails
+ *
  * @since GemFire 7.0.1
  */
-@SuppressWarnings("unused")
-public class ListDurableCqNamesFunction extends FunctionAdapter implements InternalEntity {
+public class ListDurableCqNamesFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
 
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return ListDurableCqNamesFunction.class.getName();
-  }
-
   public void execute(final FunctionContext context) {
-    final Cache cache = getCache();
-    final DistributedMember member = cache.getDistributedSystem().getDistributedMember();
+    Cache cache = context.getCache();
+    DistributedMember member = cache.getDistributedSystem().getDistributedMember();
     String memberNameOrId = CliUtil.getMemberNameOrId(member);
     DurableCqNamesResult result = new DurableCqNamesResult(memberNameOrId);
 
@@ -89,10 +78,13 @@ public class ListDurableCqNamesFunction extends FunctionAdapter implements Inter
       } else {
         result.setErrorMessage(CliStrings.NO_CLIENT_FOUND);
       }
+
     } catch (Exception e) {
       result.setExceptionMessage(e.getMessage());
+
     } finally {
       context.getResultSender().lastResult(result);
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListFunctionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListFunctionFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListFunctionFunction.java
index a45ed0b..d078a5b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListFunctionFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListFunctionFunction.java
@@ -25,7 +25,6 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.FunctionService;
@@ -34,22 +33,19 @@ import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.logging.LogService;
 
 public class ListFunctionFunction implements Function, InternalEntity {
-  private static final Logger logger = LogService.getLogger();
-
-  public static final String ID = ListFunctionFunction.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) {
     // Declared here so that it's available when returning a Throwable
     String memberId = "";
 
     try {
-      final Object[] args = (Object[]) context.getArguments();
-      final String stringPattern = (String) args[0];
+      Object[] args = (Object[]) context.getArguments();
+      String stringPattern = (String) args[0];
 
-      Cache cache = CacheFactory.getAnyInstance();
+      Cache cache = context.getCache();
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
       memberId = member.getId();
@@ -58,10 +54,12 @@ public class ListFunctionFunction implements Function, InternalEntity {
         memberId = member.getName();
       }
 
-      final Map<String, Function> functions = FunctionService.getRegisteredFunctions();
+      Map<String, Function> functions = FunctionService.getRegisteredFunctions();
       CliFunctionResult result;
+
       if (stringPattern == null || stringPattern.isEmpty()) {
         result = new CliFunctionResult(memberId, functions.keySet().toArray(new String[0]));
+
       } else {
         Pattern pattern = Pattern.compile(stringPattern);
         List<String> resultList = new LinkedList<String>();
@@ -73,6 +71,7 @@ public class ListFunctionFunction implements Function, InternalEntity {
         }
         result = new CliFunctionResult(memberId, resultList.toArray(new String[0]));
       }
+
       context.getResultSender().lastResult(result);
 
     } catch (CacheClosedException cce) {
@@ -92,11 +91,6 @@ public class ListFunctionFunction implements Function, InternalEntity {
   }
 
   @Override
-  public String getId() {
-    return ID;
-  }
-
-  @Override
   public boolean hasResult() {
     return true;
   }
@@ -110,4 +104,5 @@ public class ListFunctionFunction implements Function, InternalEntity {
   public boolean isHA() {
     return false;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListIndexFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListIndexFunction.java
index f8d302c..163f7b3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListIndexFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListIndexFunction.java
@@ -19,8 +19,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-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.query.Index;
 import org.apache.geode.distributed.DistributedMember;
@@ -30,39 +29,31 @@ import org.apache.geode.management.internal.cli.domain.IndexDetails;
 /**
  * The ListIndexFunction class is a GemFire function used to collect all the index information on
  * all Regions across the entire GemFire Cache (distributed system).
- * </p>
- * 
+ *
  * @see org.apache.geode.cache.Cache
  * @see org.apache.geode.cache.execute.Function
  * @see org.apache.geode.cache.execute.FunctionAdapter
  * @see org.apache.geode.cache.execute.FunctionContext
  * @see org.apache.geode.internal.InternalEntity
  * @see org.apache.geode.management.internal.cli.domain.IndexDetails
+ *
  * @since GemFire 7.0
  */
-@SuppressWarnings("unused")
-public class ListIndexFunction extends FunctionAdapter implements InternalEntity {
-
-  protected Cache getCache() {
-    return CacheFactory.getAnyInstance();
-  }
-
-  public String getId() {
-    return ListIndexFunction.class.getName();
-  }
+public class ListIndexFunction implements Function, InternalEntity {
 
   public void execute(final FunctionContext context) {
     try {
-      final Set<IndexDetails> indexDetailsSet = new HashSet<IndexDetails>();
+      Set<IndexDetails> indexDetailsSet = new HashSet<>();
 
-      final Cache cache = getCache();
-      final DistributedMember member = cache.getDistributedSystem().getDistributedMember();
+      Cache cache = context.getCache();
+      DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
       for (final Index index : cache.getQueryService().getIndexes()) {
         indexDetailsSet.add(new IndexDetails(member, index));
       }
 
       context.getResultSender().lastResult(indexDetailsSet);
+
     } catch (Exception e) {
       context.getResultSender().sendException(e);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/b49367e7/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MemberRegionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MemberRegionFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MemberRegionFunction.java
deleted file mode 100644
index c23bcbe..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/MemberRegionFunction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.functions;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.cache.execute.FunctionException;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.internal.InternalEntity;
-
-
-public class MemberRegionFunction implements Function, InternalEntity {
-  public static final String ID = MemberRegionFunction.class.getName();
-  private static final long serialVersionUID = 1L;
-
-  @Override
-  public void execute(FunctionContext context) {
-    Object[] args = (Object[]) context.getArguments();
-    String region = (String) args[0];
-    String functionId = (String) args[1];
-    Cache cache = CacheFactory.getAnyInstance();
-
-    try {
-      Function function = FunctionService.getFunction(functionId);
-      if (function == null) {
-        context.getResultSender()
-            .lastResult("For region on a member did not get function " + functionId);
-      }
-      Execution execution = FunctionService.onRegion(cache.getRegion(region));
-      if (execution == null) {
-        context.getResultSender().lastResult("For region on a member could not execute");
-      } else {
-        execution.execute(function);
-        context.getResultSender().lastResult("succeeded in executing on region " + region);
-      }
-
-    } catch (FunctionException e) {
-      context.getResultSender()
-          .lastResult("FunctionException in MemberRegionFunction =" + e.getMessage());
-    } catch (Exception e) {
-      context.getResultSender().lastResult("Exception in MemberRegionFunction =" + e.getMessage());
-    }
-
-  }
-
-  @Override
-  public String getId() {
-    return MemberRegionFunction.ID;
-
-  }
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    // no need of optimization since read-only.
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-
-}