geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [26/27] geode git commit: Convert to use FunctionContext.getCache()
Date Fri, 04 Aug 2017 23:25:54 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/634cbb34/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();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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/634cbb34/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);
     }


Mime
View raw message