geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [33/53] [partial] incubator-geode git commit: Initial import of geode-1.0.0.0-SNAPSHOT-2. All the new sub-project directories (like jvsd) were not imported. A diff was done to confirm that this commit is exactly the same as the open directory the snapsho
Date Mon, 06 Jul 2015 18:15:40 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/LimitIterator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/LimitIterator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/LimitIterator.java
new file mode 100644
index 0000000..cb5d3de
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/LimitIterator.java
@@ -0,0 +1,47 @@
+package com.gemstone.gemfire.cache.query.internal.utils;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * Utility Iterator which provides limit functionality on a given iterator
+ * @author asif
+ *
+ * @param <E>
+ */
+public class LimitIterator<E> implements Iterator<E> {
+
+  private final Iterator<E> rootIter;
+  private final int limit;
+  private int numIterated = 0;
+
+  public LimitIterator(Iterator<E> rootIter, int limit) {
+    this.rootIter = rootIter;
+    this.limit = limit;
+  }
+
+  @Override
+  public boolean hasNext() {
+    if (this.numIterated < this.limit) {
+      return this.rootIter.hasNext();
+    } else {
+      return false;
+    }
+  }
+
+  @Override
+  public E next() {
+    if (this.numIterated < this.limit) {
+      ++this.numIterated;
+      return this.rootIter.next();
+    } else {
+      throw new NoSuchElementException();
+    }
+  }
+
+  @Override
+  public void remove() {
+    throw new UnsupportedOperationException("Removal from limit based collection not supported");
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/PDXUtils.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/PDXUtils.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/PDXUtils.java
new file mode 100644
index 0000000..d7299a3
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/utils/PDXUtils.java
@@ -0,0 +1,79 @@
+package com.gemstone.gemfire.cache.query.internal.utils;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.query.internal.StructImpl;
+import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
+import com.gemstone.gemfire.pdx.PdxInstance;
+import com.gemstone.gemfire.pdx.internal.PdxString;
+
+public class PDXUtils {
+
+  public static Object convertPDX(Object obj, boolean isStruct,
+      boolean getDomainObjectForPdx, boolean getDeserializedObject,
+      boolean localResults, boolean[] objectChangedMarker, boolean isDistinct) {
+    objectChangedMarker[0] = false;
+    if (isStruct) {
+      StructImpl simpl = (StructImpl) obj;
+      if (getDomainObjectForPdx) {
+        try {
+          if (simpl.isHasPdx()) {
+            obj = simpl.getPdxFieldValues();
+            objectChangedMarker[0] = true;
+          } else {
+            obj = simpl.getFieldValues();
+          }
+        } catch (Exception ex) {
+          throw new CacheException(
+              "Unable to retrieve domain object from PdxInstance while building the ResultSet. "
+                  + ex.getMessage()) {
+          };
+        }
+      } else {
+        Object[] values = simpl.getFieldValues();
+        if (getDeserializedObject) {
+          for (int i = 0; i < values.length; i++) {
+            if (values[i] instanceof VMCachedDeserializable) {
+              values[i] = ((VMCachedDeserializable) values[i])
+                  .getDeserializedForReading();
+            }
+          }
+        }
+        /* This is to convert PdxString to String */
+        if (simpl.isHasPdx() && isDistinct && localResults) {
+          for (int i = 0; i < values.length; i++) {
+            if (values[i] instanceof PdxString) {
+              values[i] = ((PdxString) values[i]).toString();
+            }
+          }
+        }
+        obj = values;
+      }
+    } else {
+      if (getDomainObjectForPdx) {
+        if (obj instanceof PdxInstance) {
+          try {
+            obj = ((PdxInstance) obj).getObject();
+            objectChangedMarker[0] = true;
+          } catch (Exception ex) {
+            throw new CacheException(
+                "Unable to retrieve domain object from PdxInstance while building the ResultSet. "
+                    + ex.getMessage()) {
+            };
+          }
+        } else if (obj instanceof PdxString) {
+          obj = ((PdxString) obj).toString();
+        }
+      } else if (isDistinct && localResults && obj instanceof PdxString) {
+        /* This is to convert PdxString to String */
+        obj = ((PdxString) obj).toString();
+      }
+
+      if (getDeserializedObject && obj instanceof VMCachedDeserializable) {
+        obj = ((VMCachedDeserializable) obj).getDeserializedForReading();
+        objectChangedMarker[0] = true;
+      }
+
+    }
+    return obj;
+  }  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/Gateway.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/Gateway.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/Gateway.java
new file mode 100644
index 0000000..69a578b
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/util/Gateway.java
@@ -0,0 +1,37 @@
+package com.gemstone.gemfire.cache.util;
+
+/**
+ * 
+ * From 9.0 old wan support is removed. Ideally Gateway (used for old wan) should be removed but it it there for 
+ * rolling upgrade support when GatewaySenderProfile update request comes from or sent to old member.
+ * Old member uses Gateway$OrderPolicy while latest members uses GatewaySender#OrderPolicy
+ * 
+ * @author kbachhav
+ * @since 9.0
+ *
+ */
+public class Gateway {
+
+  /**
+   * The order policy. This enum is applicable only when concurrency-level is > 1.
+   * 
+   * @since 6.5.1
+   */
+  public enum OrderPolicy {
+    /**
+     * Indicates that events will be parallelized based on the event's
+     * originating member and thread
+     */
+    THREAD,
+    /**
+     * Indicates that events will be parallelized based on the event's key
+     */
+    KEY,
+    /** Indicates that events will be parallelized based on the event's:
+     *  - partition (using the PartitionResolver) in the case of a partitioned
+     *    region event
+     *  - key in the case of a replicated region event
+     */
+    PARTITION
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewayQueueEvent.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewayQueueEvent.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewayQueueEvent.java
index 66209a8..03320dc 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewayQueueEvent.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewayQueueEvent.java
@@ -9,6 +9,7 @@ package com.gemstone.gemfire.cache.wan;
 
 import com.gemstone.gemfire.cache.Operation;
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
 
 /**
  * Represents <code>Cache</code> events going through 
@@ -53,6 +54,9 @@ public interface GatewayQueueEvent<K, V> {
    * Returns the deserialized value associated with this event.
    * 
    * @return the deserialized value associated with this event
+   * 
+   * @throws IllegalStateException may be thrown if the event's value was stored off-heap
+   * and {@link AsyncEventListener#processEvents(java.util.List)} has already returned.
    */
   public V getDeserializedValue();
 
@@ -60,6 +64,9 @@ public interface GatewayQueueEvent<K, V> {
    * Returns the serialized form of the value associated with this event.
    * 
    * @return the serialized form of the value associated with this event
+   * 
+   * @throws IllegalStateException may be thrown if the event's value was stored off-heap
+   * and {@link AsyncEventListener#processEvents(java.util.List)} has already returned.
    */
   public byte[] getSerializedValue();
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
index 1d45cfb..49db3a6 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
@@ -91,6 +91,8 @@ public interface GatewaySender {
 
   public static final int DEFAULT_DISPATCHER_THREADS = 5;
   
+  public static final int DEFAULT_HDFS_DISPATCHER_THREADS = 5;
+  
   public static final OrderPolicy DEFAULT_ORDER_POLICY = OrderPolicy.KEY;
   /**
    * The default maximum amount of memory (MB) to allow in the queue before

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/AbstractLauncher.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/AbstractLauncher.java
index ff3c0a1..1ff4c7b 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/AbstractLauncher.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/AbstractLauncher.java
@@ -61,6 +61,8 @@ import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
 public abstract class AbstractLauncher<T extends Comparable<T>> implements Runnable {
 
   protected static final Boolean DEFAULT_FORCE = Boolean.FALSE;
+  
+  protected static final long READ_PID_FILE_TIMEOUT_MILLIS = 2*1000;
 
   // @see http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.user.lnx.60%2Fuser%2Fattachapi.html
   // @see http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/aboutjrockit.html#wp1083571

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
index 1d437ab..5b2992d 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/DistributedSystem.java
@@ -36,6 +36,7 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.tcp.ConnectionTable;
 import com.gemstone.gemfire.internal.util.IOUtils;
 import com.gemstone.gemfire.memcached.GemFireMemcachedServer;
+import com.gemstone.gemfire.redis.GemFireRedisServer;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 
 /**
@@ -821,6 +822,21 @@ import com.gemstone.gemfire.security.GemFireSecurityException;
  *   <dd><U>Default</U>: ""</dd>
  * </dl>
  * 
+ * <dl>
+ *   <a name="redis-port"><dt>redis-port</dt></a>
+ *   <dd><U>Description</U>: Specifies the port used by {@link GemFireRedisServer}
+ *   which enables redis clients to connect and store data in GemFire distributed system.
+ *   see {@link GemFireRedisServer} for other configuration options.</dd>
+ *   <dd><U>Default</U>: "0" disables GemFireMemcachedServer</dd>
+ *   <dd><U>Allowed values</U>: 0..65535</dd>
+ * </dl>
+ * 
+ * <dl>
+ *   <a name="redis-bind-address"><dt>redis-bind-address</dt></a>
+ *   <dd><U>Description</U>: Specifies the bind address used by {@link GemFireRedisServer}</dd>
+ *   <dd><U>Default</U>: ""</dd>
+ * </dl>
+ * 
  * <B>Asynchronous Message Properties</B>
  *
  * <dl>
@@ -1060,7 +1076,7 @@ import com.gemstone.gemfire.security.GemFireSecurityException;
  * 
  * <dl>
  *   <a name="http-service-port"><dt>http-service-port</dt></a>
- *   <dd><U>Description</U>: Specifies the port used by gemfire HTTP service. If
+ *   <dd><U>Description</U>: Specifies the port used by the GemFire HTTP service. If
  *   configured with non-zero value, then an HTTP service will listen on this port.
  *   A value of "0" disables Gemfire HTTP service.
  *   </dd>
@@ -1071,7 +1087,7 @@ import com.gemstone.gemfire.security.GemFireSecurityException;
  *  
  * <dl>
  *   <a name="http-service-bind-address"><dt>http-service-bind-address</dt></a>
- *   <dd><U>Description</U>: The address where gemfire HTTP service will listen
+ *   <dd><U>Description</U>: The address where the GemFire HTTP service will listen
  *   for remote connections. One can use this property to configure what ip
  *   address or host name the HTTP service will listen on. When not set, by
  *   default the HTTP service will listen on the local host's address.
@@ -1175,6 +1191,21 @@ import com.gemstone.gemfire.security.GemFireSecurityException;
  *   <dd><U>Since</U>: 8.0</dd>
  * </dl>
  * 
+ * <b>Off-Heap Memory</b>
+ * 
+ * <dl>
+ *   <a name="off-heap-memory-size"><dt>off-heap-memory-size</dt></a>
+ *   <dd><U>Description</U>: The total size of off-heap memory specified as
+ *   off-heap-memory-size=<n>[g|m]. <n> is the size. [g|m] indicates
+ *   whether the size should be interpreted as gigabytes or megabytes.
+ *   By default no off-heap memory is allocated.
+ *   A non-zero value will cause that much memory to be allocated from the operating
+ *   system and reserved for off-heap use.
+ *   </dd>
+ *   <dd><U>Default</U>: <code>""</code></dd>
+ *   <dd><U>Since</U>: 9.0</dd>
+ * </dl>
+ * 
  * <b>Cluster Configuration Service</b>
  * <dl>
  *   <a name="enable-cluster-configuration"><dt>enable-cluster-configuration</dt></a>
@@ -1389,6 +1420,17 @@ import com.gemstone.gemfire.security.GemFireSecurityException;
  * <b>Miscellaneous</b> 
  *
  * <dl>
+ *   <a name="lock-memory"><dt>lock-memory</dt></a>
+ *   <dd><U>Description</U>: Include this option to lock GemFire heap and off-heap memory pages into RAM.
+ *   This prevents the operating system from swapping the pages out to disk, which can cause sever
+ *   performance degradation. When you use this command, also configure the operating system limits for
+ *   locked memory.
+ *   </dd>
+ *   <dd><U>Default</U>: <code>"false"</code></dd>
+ *   <dd><U>Since</U>: 9.0</dd>
+ * </dl>
+ * 
+ * <dl>
  *   <a name="deploy-working-dir"><dt>deploy-working-dir</dt></a>
  *   <dd><U>Description</U>: Specifies the working directory which this
  *   distributed member will use to persist deployed JAR files.  This directory

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
index 8c6e63e..87631d9 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
@@ -873,7 +873,7 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
   private LocatorState statusWithWorkingDirectory() {
     int parsedPid = 0;
     try {
-      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName());
+      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
       parsedPid = controller.getProcessId();
       
       // note: in-process request will go infinite loop unless we do the following
@@ -1031,7 +1031,7 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
   private LocatorState stopWithWorkingDirectory() {
     int parsedPid = 0;
     try {
-      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName());
+      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.LOCATOR.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
       parsedPid = controller.getProcessId();
       
       // NOTE in-process request will go infinite loop unless we do the following
@@ -1057,6 +1057,10 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
       // failed to open or read file or dir
       return createNoResponseState(e, "Failed to communicate with locator with process id " + parsedPid);
     } 
+    catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      return createNoResponseState(e, "Interrupted while trying to communicate with locator with process id " + parsedPid);
+    } 
     catch (MBeanInvocationFailedException e) {
       // MBean either doesn't exist or method or attribute don't exist
       return createNoResponseState(e, "Failed to communicate with locator with process id " + parsedPid);
@@ -1065,6 +1069,9 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
       // couldn't determine pid from within locator JVM
       return createNoResponseState(e, "Failed to find usable process id within file " + ProcessType.LOCATOR.getPidFileName() + " in " + getWorkingDirectory());
     } 
+    catch (TimeoutException e) {
+      return createNoResponseState(e, "Timed out trying to find usable process id within file " + ProcessType.LOCATOR.getPidFileName() + " in " + getWorkingDirectory());
+    } 
     catch (UnableToControlProcessException e) {
       return createNoResponseState(e, "Failed to communicate with locator with process id " + parsedPid);
     }
@@ -1073,7 +1080,7 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
   private LocatorState createNoResponseState(final Exception cause, final String errorMessage) {
     debug(cause);
     //info(errorMessage);
-    return new LocatorState(this, Status.NOT_RESPONDING); // TODO: use errorMessage
+    return new LocatorState(this, Status.NOT_RESPONDING, errorMessage);
   }
   
   private Properties getOverriddenDefaults() {
@@ -1896,6 +1903,7 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
     }
 
     public LocatorState(final LocatorLauncher launcher, final Status status) {
+      // if status is NOT_RESPONDING then this is executing inside the JVM asking for he status; pid etc will be set according to the caller's JVM instead
       this(status,
         launcher.statusMessage,
         System.currentTimeMillis(),
@@ -1913,6 +1921,24 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
         launcher.getMemberName());
     }
     
+    public LocatorState(final LocatorLauncher launcher, final Status status, final String errorMessage) {
+      this(status, // status
+          errorMessage, // statusMessage
+          System.currentTimeMillis(), // timestamp
+          null, // locatorLocation
+          null, // pid
+          0L, // uptime
+          launcher.getWorkingDirectory(), // workingDirectory
+          Collections.<String>emptyList(), // jvmArguments
+          null, // classpath
+          GemFireVersion.getGemFireVersion(), // gemfireVersion
+          null, // javaVersion
+          null, // logFile
+          null, // host
+          null, // port
+          null);// memberName
+    }
+    
     private static String getBindAddressAsString(LocatorLauncher launcher) {
       if (InternalLocator.hasLocator()) {
         final InternalLocator locator = InternalLocator.getLocator();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
index d5db59d..d09f19a 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
@@ -22,9 +22,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
+
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
@@ -33,6 +35,7 @@ import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
 import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.GemFireVersion;
@@ -68,6 +71,7 @@ import com.gemstone.gemfire.management.internal.cli.json.GfJsonArray;
 import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
 import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
 import com.gemstone.gemfire.pdx.PdxSerializer;
+
 import joptsimple.OptionException;
 import joptsimple.OptionParser;
 import joptsimple.OptionSet;
@@ -170,6 +174,9 @@ public final class ServerLauncher extends AbstractLauncher<String> {
   private final Float criticalHeapPercentage;
   private final Float evictionHeapPercentage;
   
+  private final Float criticalOffHeapPercentage;
+  private final Float evictionOffHeapPercentage;
+  
   private final String hostNameForClients; 
   private final Integer maxConnections;
   private final Integer maxMessageCount;
@@ -258,6 +265,8 @@ public final class ServerLauncher extends AbstractLauncher<String> {
     this.workingDirectory = builder.getWorkingDirectory();
     this.criticalHeapPercentage = builder.getCriticalHeapPercentage();
     this.evictionHeapPercentage = builder.getEvictionHeapPercentage();
+    this.criticalOffHeapPercentage = builder.getCriticalOffHeapPercentage();
+    this.evictionOffHeapPercentage = builder.getEvictionOffHeapPercentage();
     this.maxConnections = builder.getMaxConnections();
     this.maxMessageCount = builder.getMaxMessageCount();
     this.maxThreads = builder.getMaxThreads();
@@ -543,6 +552,14 @@ public final class ServerLauncher extends AbstractLauncher<String> {
     return this.evictionHeapPercentage;
   }
   
+  public Float getCriticalOffHeapPercentage() {
+    return this.criticalOffHeapPercentage;
+  }
+  
+  public Float getEvictionOffHeapPercentage() {
+    return this.evictionOffHeapPercentage;
+  }
+  
   public String getHostNameForClients() {
     return this.hostNameForClients;
   }
@@ -698,6 +715,12 @@ public final class ServerLauncher extends AbstractLauncher<String> {
           if (this.evictionHeapPercentage != null) {
             this.cache.getResourceManager().setEvictionHeapPercentage(getEvictionHeapPercentage());
           }
+          if (this.criticalOffHeapPercentage != null) {
+            this.cache.getResourceManager().setCriticalOffHeapPercentage(getCriticalOffHeapPercentage());
+          } 
+          if (this.evictionOffHeapPercentage != null) {
+            this.cache.getResourceManager().setEvictionOffHeapPercentage(getEvictionOffHeapPercentage());
+          }
           
           this.cache.setIsServer(true);
           startCacheServer(this.cache);
@@ -1054,7 +1077,7 @@ public final class ServerLauncher extends AbstractLauncher<String> {
   private ServerState statusWithWorkingDirectory() {
     int parsedPid = 0;
     try {
-      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName());
+      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
       parsedPid = controller.getProcessId();
       
       // note: in-process request will go infinite loop unless we do the following
@@ -1068,14 +1091,6 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       final String statusJson = controller.status();
       return ServerState.fromJson(statusJson);
     }
-//    catch (NoClassDefFoundError error) {
-//      if (isAttachAPINotFound(error)) {
-//        throw new AttachAPINotFoundException(LocalizedStrings.Launcher_ATTACH_API_NOT_FOUND_ERROR_MESSAGE
-//          .toLocalizedString(), error);
-//      }
-//
-//      throw error;
-//    }
     catch (ConnectionFailedException e) {
       // failed to attach to server JVM
       return createNoResponseState(e, "Failed to connect to server with process id " + parsedPid);
@@ -1088,10 +1103,10 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       // failed to open or read file or dir
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
     } 
-//    catch (MalformedObjectNameException e) {
-//      // JMX object name is bad
-//      return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
-//    } 
+    catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      return createNoResponseState(e, "Interrupted while trying to communicate with server with process id " + parsedPid);
+    } 
     catch (MBeanInvocationFailedException e) {
       // MBean either doesn't exist or method or attribute don't exist
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
@@ -1101,15 +1116,9 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       return createNoResponseState(e, "Failed to find usable process id within file " + ProcessType.SERVER.getPidFileName() + " in " + getWorkingDirectory());
     } 
     catch (UnableToControlProcessException e) {
-      // TODO comment me
-      return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
-    } 
-    catch (InterruptedException e) {
-      // TODO comment me
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
     } 
     catch (TimeoutException e) {
-      // TODO comment me
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
     }
   }
@@ -1209,7 +1218,7 @@ public final class ServerLauncher extends AbstractLauncher<String> {
   private ServerState stopWithWorkingDirectory() {
     int parsedPid = 0;
     try {
-      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName());
+      final ProcessController controller = new ProcessControllerFactory().createProcessController(this.controllerParameters, new File(getWorkingDirectory()), ProcessType.SERVER.getPidFileName(), READ_PID_FILE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
       parsedPid = controller.getProcessId();
       
       // NOTE in-process request will go infinite loop unless we do the following
@@ -1223,14 +1232,6 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       controller.stop();
       return new ServerState(this, Status.STOPPED);
     }
-//    catch (NoClassDefFoundError error) {
-//      if (isAttachAPINotFound(error)) {
-//        throw new AttachAPINotFoundException(LocalizedStrings.Launcher_ATTACH_API_NOT_FOUND_ERROR_MESSAGE
-//          .toLocalizedString(), error);
-//      }
-//
-//      throw error;
-//    }
     catch (ConnectionFailedException e) {
       // failed to attach to server JVM
       return createNoResponseState(e, "Failed to connect to server with process id " + parsedPid);
@@ -1243,10 +1244,10 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       // failed to open or read file or dir
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
     } 
-//    catch (MalformedObjectNameException e) {
-//      // JMX object name is bad
-//      return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
-//    } 
+    catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      return createNoResponseState(e, "Interrupted while trying to communicate with server with process id " + parsedPid);
+    } 
     catch (MBeanInvocationFailedException e) {
       // MBean either doesn't exist or method or attribute don't exist
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
@@ -1255,16 +1256,17 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       // couldn't determine pid from within server JVM
       return createNoResponseState(e, "Failed to find usable process id within file " + ProcessType.SERVER.getPidFileName() + " in " + getWorkingDirectory());
     } 
+    catch (TimeoutException e) {
+      return createNoResponseState(e, "Timed out trying to find usable process id within file " + ProcessType.SERVER.getPidFileName() + " in " + getWorkingDirectory());
+    } 
     catch (UnableToControlProcessException e) {
-      // TODO comment me
       return createNoResponseState(e, "Failed to communicate with server with process id " + parsedPid);
     }
   }
 
   private ServerState createNoResponseState(final Exception cause, final String errorMessage) {
     debug(cause);
-    //info(errorMessage);
-    return new ServerState(this, Status.NOT_RESPONDING); // TODO: use errorMessage
+    return new ServerState(this, Status.NOT_RESPONDING, errorMessage);
   }
 
   private Properties getOverriddenDefaults() {
@@ -1380,6 +1382,9 @@ public final class ServerLauncher extends AbstractLauncher<String> {
     private Float criticalHeapPercentage;
     private Float evictionHeapPercentage;
     
+    private Float criticalOffHeapPercentage;
+    private Float evictionOffHeapPercentage;
+    
     private String hostNameForClients; 
     private Integer loadPollInterval;
     private Integer maxConnections;
@@ -1429,6 +1434,8 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       parser.accepts("version");
       parser.accepts(CliStrings.START_SERVER__CRITICAL__HEAP__PERCENTAGE).withRequiredArg().ofType(Float.class);
       parser.accepts(CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE).withRequiredArg().ofType(Float.class);
+      parser.accepts(CliStrings.START_SERVER__CRITICAL_OFF_HEAP_PERCENTAGE).withRequiredArg().ofType(Float.class);
+      parser.accepts(CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE).withRequiredArg().ofType(Float.class);
       parser.accepts(CliStrings.START_SERVER__MAX__CONNECTIONS).withRequiredArg().ofType(Integer.class);
       parser.accepts(CliStrings.START_SERVER__MAX__MESSAGE__COUNT).withRequiredArg().ofType(Integer.class);
       parser.accepts(CliStrings.START_SERVER__MAX__THREADS).withRequiredArg().ofType(Integer.class);
@@ -1458,7 +1465,43 @@ public final class ServerLauncher extends AbstractLauncher<String> {
         setHelp(options.has("help"));
         setRebalance(options.has("rebalance"));
         setRedirectOutput(options.has("redirect-output"));
-
+        
+        if (options.hasArgument(CliStrings.START_SERVER__CRITICAL__HEAP__PERCENTAGE)) {
+          setCriticalHeapPercentage(Float.parseFloat(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__CRITICAL__HEAP__PERCENTAGE))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE)) {
+          setEvictionHeapPercentage(Float.parseFloat(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__CRITICAL_OFF_HEAP_PERCENTAGE)) {
+          setCriticalOffHeapPercentage(Float.parseFloat(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__CRITICAL_OFF_HEAP_PERCENTAGE))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE)) {
+          setEvictionOffHeapPercentage(Float.parseFloat(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__MAX__CONNECTIONS)) {
+          setMaxConnections(Integer.parseInt(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__MAX__CONNECTIONS))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__MAX__MESSAGE__COUNT)) {
+          setMaxConnections(Integer.parseInt(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__MAX__MESSAGE__COUNT))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE)) {
+          setMaxConnections(Integer.parseInt(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE))));
+        }
+        
+        if (options.hasArgument(CliStrings.START_SERVER__SOCKET__BUFFER__SIZE)) {
+          setMaxConnections(Integer.parseInt(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__SOCKET__BUFFER__SIZE))));
+        } 
+        
+        if (options.hasArgument(CliStrings.START_SERVER__MAX__THREADS)) {
+          setMaxThreads(Integer.parseInt(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__MAX__THREADS))));
+        }
+        
         if (!isHelping()) {
           if (options.has("dir")) {
             setWorkingDirectory(ObjectUtils.toString(options.valueOf("dir")));
@@ -2010,6 +2053,20 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       this.criticalHeapPercentage = criticalHeapPercentage;
       return this;
     }
+
+    public Float getCriticalOffHeapPercentage() {
+      return this.criticalOffHeapPercentage;
+    }
+    
+    public Builder setCriticalOffHeapPercentage(final Float criticalOffHeapPercentage) {
+      if (criticalOffHeapPercentage != null) {
+        if (criticalOffHeapPercentage < 0 || criticalOffHeapPercentage > 100.0f) {
+          throw new IllegalArgumentException(String.format("Critical off-heap percentage (%1$s) must be between 0 and 100!", criticalOffHeapPercentage));
+        }
+      }
+     this.criticalOffHeapPercentage = criticalOffHeapPercentage;
+     return this;
+    }
     
     public Float getEvictionHeapPercentage() {
       return this.evictionHeapPercentage;
@@ -2025,7 +2082,21 @@ public final class ServerLauncher extends AbstractLauncher<String> {
       this.evictionHeapPercentage = evictionHeapPercentage;
       return this;
     }
-
+    
+    public Float getEvictionOffHeapPercentage() {
+      return this.evictionOffHeapPercentage;
+    }
+    
+    public Builder setEvictionOffHeapPercentage(final Float evictionOffHeapPercentage) {
+      if (evictionOffHeapPercentage != null) {
+        if (evictionOffHeapPercentage < 0 || evictionOffHeapPercentage > 100.0f) {
+          throw new IllegalArgumentException(String.format("Eviction off-heap percentage (%1$s) must be between 0 and 100", evictionOffHeapPercentage));
+        }
+      }
+      this.evictionOffHeapPercentage = evictionOffHeapPercentage;
+      return this;
+    }
+    
     public String getHostNameForClients() {
       return this.hostNameForClients;
     }
@@ -2416,6 +2487,24 @@ public final class ServerLauncher extends AbstractLauncher<String> {
         launcher.getMemberName());
     }
 
+    public ServerState(final ServerLauncher launcher, final Status status, final String errorMessage) {
+      this(status, // status
+          errorMessage, // statusMessage
+          System.currentTimeMillis(), // timestamp
+          null, // serverLocation
+          null, // pid
+          0L, // uptime
+          launcher.getWorkingDirectory(), // workingDirectory
+          Collections.<String>emptyList(), // jvmArguments
+          null, // classpath
+          GemFireVersion.getGemFireVersion(), // gemfireVersion
+          null, // javaVersion
+          null, // logFile
+          null, // host
+          null, // port
+          null);// memberName
+    }
+    
     protected ServerState(final Status status,
                           final String statusMessage,
                           final long timestamp,

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
index c21c88c..f34a985 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
@@ -1381,7 +1381,36 @@ public abstract class AbstractDistributionConfig
   public boolean isMemcachedBindAddressModifiable() {
     return _modifiableDefault();
   }
+  
+  protected void checkRedisPort(int value) {
+    minMaxCheck(REDIS_PORT_NAME, value, 0, 65535);
+  }
+  protected void checkRedisBindAddress(String value) {
+    _checkIfModifiable(REDIS_BIND_ADDRESS_NAME);
+    if (value != null && value.length() > 0 &&
+        !SocketCreator.isLocalHost(value)) {
+      throw new IllegalArgumentException(
+          LocalizedStrings.AbstractDistributionConfig_REDIS_BIND_ADDRESS_0_INVALID_MUST_BE_IN_1
+          .toLocalizedString(new Object[]{value, SocketCreator.getMyAddresses()
+          }));
+    }
+  }
+  public boolean isRedisBindAddressModifiable() {
+    return _modifiableDefault();
+  }
+
+  public boolean isRedisPortModifiable() {
+    return _modifiableDefault();
+  }
 
+  public boolean isOffHeapMemorySizeModifiable() {
+    return _modifiableDefault();
+  }
+  
+  protected void checkOffHeapMemorySize(String value) {
+    _checkIfModifiable(OFF_HEAP_MEMORY_SIZE_NAME);
+  }
+  
   protected void checkEnableSharedConfiguration() {
     _checkIfModifiable(ENABLE_CLUSTER_CONFIGURATION_NAME);
   }
@@ -1411,6 +1440,18 @@ public abstract class AbstractDistributionConfig
     return _modifiableDefault();
   }
 
+  public boolean isLockMemoryModifiable() {
+    return _modifiableDefault();
+  }
+  
+  public boolean isDistributedTransactionsModifiable() {
+    return _modifiableDefault();
+  }
+  
+  protected void checkLockMemory(final boolean value) {
+    _checkIfModifiable(LOCK_MEMORY_NAME);
+  }
+    
   // AbstractConfig overriding methods
   
   @Override
@@ -1510,6 +1551,8 @@ public abstract class AbstractDistributionConfig
       MEMCACHED_PORT_NAME,
       MEMCACHED_PROTOCOL_NAME,
       MEMCACHED_BIND_ADDRESS_NAME,
+      REDIS_PORT_NAME,
+      REDIS_BIND_ADDRESS_NAME,
       USER_COMMAND_PACKAGES,
       ENABLE_CLUSTER_CONFIGURATION_NAME,
       USE_CLUSTER_CONFIGURATION_NAME,
@@ -1532,7 +1575,10 @@ public abstract class AbstractDistributionConfig
       HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,
       HTTP_SERVICE_SSL_PROTOCOLS_NAME,
       HTTP_SERVICE_SSL_CIPHERS_NAME,
-      HTTP_SERVICE_SSL_KEYSTORE_NAME,HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME,HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,HTTP_SERVICE_SSL_TRUSTSTORE_NAME,HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME
+      HTTP_SERVICE_SSL_KEYSTORE_NAME,HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME,HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,HTTP_SERVICE_SSL_TRUSTSTORE_NAME,HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,
+      OFF_HEAP_MEMORY_SIZE_NAME, 
+      LOCK_MEMORY_NAME,
+      DISTRIBUTED_TRANSACTIONS_NAME
     };
     List atts = Arrays.asList(myAtts);
     Collections.sort(atts);
@@ -1756,6 +1802,10 @@ public abstract class AbstractDistributionConfig
       this.setMemcachedProtocol((String)attValue);
     } else if (attName.equalsIgnoreCase(MEMCACHED_BIND_ADDRESS_NAME)) {
       this.setMemcachedBindAddress((String)attValue);
+    } else if (attName.equalsIgnoreCase(REDIS_PORT_NAME)) {
+      this.setRedisPort(((Integer)attValue).intValue());
+    } else if (attName.equalsIgnoreCase(REDIS_BIND_ADDRESS_NAME)) {
+      this.setRedisBindAddress((String)attValue);
     } else if (attName.equalsIgnoreCase(USER_COMMAND_PACKAGES)) {
       this.setUserCommandPackages((String)attValue);
     } else if (attName.equalsIgnoreCase(ENABLE_CLUSTER_CONFIGURATION_NAME)) {
@@ -1826,6 +1876,12 @@ public abstract class AbstractDistributionConfig
       this.setHttpServiceSSLTrustStorePassword((String)attValue);
     } else if (attName.equalsIgnoreCase(START_DEV_REST_API_NAME)) {
       this.setStartDevRestApi(((Boolean)attValue).booleanValue());
+    } else if (attName.equalsIgnoreCase(OFF_HEAP_MEMORY_SIZE_NAME)) {
+      this.setOffHeapMemorySize((String)attValue);
+    } else if (attName.equalsIgnoreCase(LOCK_MEMORY_NAME)) {
+      this.setLockMemory((Boolean)attValue);
+    } else if (attName.equalsIgnoreCase(DISTRIBUTED_TRANSACTIONS_NAME)) {
+      this.setDistributedTransactions(((Boolean)attValue).booleanValue());
     } else {
       throw new InternalGemFireException(LocalizedStrings.AbstractDistributionConfig_UNHANDLED_ATTRIBUTE_NAME_0.toLocalizedString(attName));
     }
@@ -2034,6 +2090,10 @@ public abstract class AbstractDistributionConfig
       return this.getMemcachedProtocol();
     } else if (attName.equalsIgnoreCase(MEMCACHED_BIND_ADDRESS_NAME)) {
       return this.getMemcachedBindAddress();
+    } else if (attName.equalsIgnoreCase(REDIS_PORT_NAME)) {
+      return this.getRedisPort();
+    } else if (attName.equalsIgnoreCase(REDIS_BIND_ADDRESS_NAME)) {
+      return this.getRedisBindAddress();
     } else if (attName.equalsIgnoreCase(USER_COMMAND_PACKAGES)) {
       return this.getUserCommandPackages();
     } else if (attName.equalsIgnoreCase(ENABLE_CLUSTER_CONFIGURATION_NAME)) {
@@ -2104,6 +2164,12 @@ public abstract class AbstractDistributionConfig
       return this.getHttpServiceSSLTrustStorePassword();
     } else if (attName.equalsIgnoreCase(START_DEV_REST_API_NAME)) {
       return this.getStartDevRestApi();
+    } else if (attName.equalsIgnoreCase(OFF_HEAP_MEMORY_SIZE_NAME)) {
+      return this.getOffHeapMemorySize();
+    } else if (attName.equalsIgnoreCase(LOCK_MEMORY_NAME)) {
+      return this.getLockMemory();
+    } else if (attName.equalsIgnoreCase(DISTRIBUTED_TRANSACTIONS_NAME)) {
+      return this.getDistributedTransactions();
     } else {
       throw new InternalGemFireException(LocalizedStrings.AbstractDistributionConfig_UNHANDLED_ATTRIBUTE_NAME_0.toLocalizedString(attName));
     }
@@ -2313,10 +2379,16 @@ public abstract class AbstractDistributionConfig
       return this.isMemcachedProtocolModifiable();
     } else if (attName.equalsIgnoreCase(MEMCACHED_BIND_ADDRESS_NAME)) {
       return this.isMemcachedBindAddressModifiable();
+    } else if (attName.equalsIgnoreCase(REDIS_PORT_NAME)) {
+      return this.isRedisPortModifiable();
+    } else if (attName.equalsIgnoreCase(REDIS_BIND_ADDRESS_NAME)) {
+      return this.isRedisBindAddressModifiable();
     } else if (attName.equalsIgnoreCase(USER_COMMAND_PACKAGES)) {
       return this.isUserCommandPackagesModifiable();
     } else if (attName.equalsIgnoreCase(ENABLE_CLUSTER_CONFIGURATION_NAME)) {
       return this.isEnableSharedConfigurationModifiable();
+    } else if (attName.equalsIgnoreCase(OFF_HEAP_MEMORY_SIZE_NAME)) {
+      return this.isOffHeapMemorySizeModifiable();
     } else if (attName.equalsIgnoreCase(LOAD_CLUSTER_CONFIG_FROM_DIR_NAME)) {
       return this.isLoadSharedConfigFromDirModifiable();
     } else if (attName.equalsIgnoreCase(USE_CLUSTER_CONFIGURATION_NAME)) {
@@ -2383,7 +2455,11 @@ public abstract class AbstractDistributionConfig
       return this.isHttpServiceSSLTrustStorePasswordModifiable();
     } else if (attName.equalsIgnoreCase(START_DEV_REST_API_NAME)) {
       return this.isStartDevRestApiModifiable();
-    } else {
+    } else if (attName.equalsIgnoreCase(LOCK_MEMORY_NAME)) {
+      return this.isLockMemoryModifiable();
+    } else if (attName.equals(DISTRIBUTED_TRANSACTIONS_NAME)) {
+      return this.isDistributedTransactionsModifiable();
+    }else {
       throw new InternalGemFireException(LocalizedStrings.AbstractDistributionConfig_UNHANDLED_ATTRIBUTE_NAME_0.toLocalizedString(attName));
     }
   }
@@ -2594,7 +2670,11 @@ public abstract class AbstractDistributionConfig
       return String.class;
     } else if (attName.equalsIgnoreCase(MEMCACHED_BIND_ADDRESS_NAME)) {
       return String.class;
-    } else if (attName.equalsIgnoreCase(USER_COMMAND_PACKAGES)) {
+    } else if (attName.equalsIgnoreCase(REDIS_PORT_NAME)) {
+      return Integer.class;
+    } else if (attName.equalsIgnoreCase(REDIS_BIND_ADDRESS_NAME)) {
+      return String.class;
+    }else if (attName.equalsIgnoreCase(USER_COMMAND_PACKAGES)) {
       return String.class;
     } else if (attName.equalsIgnoreCase(ENABLE_CLUSTER_CONFIGURATION_NAME)) {
       return Boolean.class;
@@ -2664,7 +2744,14 @@ public abstract class AbstractDistributionConfig
       return String.class;
     } else if (attName.equalsIgnoreCase(START_DEV_REST_API_NAME)) {
       return Boolean.class;
-    } else {
+    } else if (attName.equalsIgnoreCase(OFF_HEAP_MEMORY_SIZE_NAME)) {
+      return String.class;
+    } else if (attName.equalsIgnoreCase(LOCK_MEMORY_NAME)) {
+      return Boolean.class;
+    } else if (attName.equalsIgnoreCase(DISTRIBUTED_TRANSACTIONS_NAME)) {
+      return Boolean.class;
+    } 
+    else {
       throw new InternalGemFireException(LocalizedStrings.AbstractDistributionConfig_UNHANDLED_ATTRIBUTE_NAME_0.toLocalizedString(attName));
     }
   }
@@ -3041,7 +3128,8 @@ public abstract class AbstractDistributionConfig
     m.put(MEMCACHED_PORT_NAME, "The port GemFireMemcachedServer will listen on. Default is 0. Set to zero to disable GemFireMemcachedServer.");
     m.put(MEMCACHED_PROTOCOL_NAME, "The protocol that GemFireMemcachedServer understands. Default is ASCII. Values may be ASCII or BINARY");
     m.put(MEMCACHED_BIND_ADDRESS_NAME, "The address the GemFireMemcachedServer will listen on for remote connections. Default is \"\" which causes the GemFireMemcachedServer to listen on the host's default address. This property is ignored if memcached-port is \"0\".");
-
+    m.put(REDIS_PORT_NAME, "The port GemFireRedisServer will listen on. Default is 0. Set to zero to disable GemFireRedisServer.");
+    m.put(REDIS_BIND_ADDRESS_NAME, "The address the GemFireRedisServer will listen on for remote connections. Default is \"\" which causes the GemFireRedisServer to listen on the host's default address. This property is ignored if redis-port is \"0\".");
     m.put(ENABLE_CLUSTER_CONFIGURATION_NAME, LocalizedStrings.AbstractDistributionConfig_ENABLE_SHARED_CONFIGURATION.toLocalizedString());
     m.put(USE_CLUSTER_CONFIGURATION_NAME, LocalizedStrings.AbstractDistributionConfig_USE_SHARED_CONFIGURATION.toLocalizedString());
     m.put(LOAD_CLUSTER_CONFIG_FROM_DIR_NAME, LocalizedStrings.AbstractDistributionConfig_LOAD_SHARED_CONFIGURATION_FROM_DIR.toLocalizedString(SharedConfiguration.CLUSTER_CONFIG_ARTIFACTS_DIR_NAME));
@@ -3138,7 +3226,10 @@ public abstract class AbstractDistributionConfig
     
     
     m.put(START_DEV_REST_API_NAME, "If true then the developer(API) REST service will be started when the cache is created. Defaults to false.");
+    m.put(OFF_HEAP_MEMORY_SIZE_NAME, LocalizedStrings.AbstractDistributionConfig_OFF_HEAP_MEMORY_SIZE_0.toLocalizedString(DEFAULT_OFF_HEAP_MEMORY_SIZE));
     dcAttDescriptions = Collections.unmodifiableMap(m);
+    m.put(LOCK_MEMORY_NAME, LocalizedStrings.AbstractDistributionConfig_LOCK_MEMORY.toLocalizedString(DEFAULT_LOCK_MEMORY));
+    m.put(DISTRIBUTED_TRANSACTIONS_NAME, "Flag to indicate whether all transactions including JTA should be distributed transactions.  Default is false, meaning colocated transactions.");
   }
   /**
    * Used by unit tests.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
index 2096718..6429642 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
@@ -1870,6 +1870,16 @@ public interface DistributionConfig extends Config, LogConfig {
   public static final String CLIENT_CONFLATION_PROP_VALUE_ON = "true";
   /** @since 5.7 */
   public static final String CLIENT_CONFLATION_PROP_VALUE_OFF = "false";
+  
+     
+  /** @since 9.0 */
+  public static final String DISTRIBUTED_TRANSACTIONS_NAME = "distributed-transactions";
+  public static final boolean DEFAULT_DISTRIBUTED_TRANSACTIONS = false;
+
+  public boolean getDistributedTransactions();
+
+  public void setDistributedTransactions(boolean value);
+  
   /**
    * Returns the value of the <a
    * href="../DistributedSystem.html#conflate-events">"conflate-events"</a>
@@ -2511,6 +2521,42 @@ public interface DistributionConfig extends Config, LogConfig {
    public String getJmxManagerSSLProtocols( );
 
   /**
+   * Returns the value of the <a 
+   * href="../DistributedSystem.html#off-heap-memory-size">"off-heap-memory-size"</a> 
+   * property.
+   * @since 9.0
+   */
+  public String getOffHeapMemorySize();
+  /**
+   * Sets the value of the <a 
+   * href="../DistributedSystem.html#off-heap-memory-size">"off-heap-memory-size"</a> 
+   * property.
+   * @since 9.0
+   */
+  public void setOffHeapMemorySize(String value);
+  /**
+   * Returns true if the value of the <a 
+   * href="../DistributedSystem.html#off-heap-memory-size">"off-heap-memory-size"</a> 
+   * property can be modified. Some attributes can not be modified while the 
+   * system is running.
+   * @since 9.0
+   */
+  public boolean isOffHeapMemorySizeModifiable();
+  /** 
+   * The name of the "off-heap-memory-size" property 
+   * @since 9.0
+   */
+  public static final String OFF_HEAP_MEMORY_SIZE_NAME = "off-heap-memory-size";
+  /** 
+   * The default <a 
+   * href="../DistributedSystem.html#off-heap-memory-size">"off-heap-memory-size"</a>
+   * value of <code>""</code>. 
+   * @since 9.0
+   */
+  public static final String DEFAULT_OFF_HEAP_MEMORY_SIZE = "";
+
+  
+  /**
    * Sets the value of the <a
    * href="../DistributedSystem.html#jmx-manager-ssl-protocols">"jmx-manager-ssl-protocols"</a>
    * property.
@@ -2791,6 +2837,31 @@ public interface DistributionConfig extends Config, LogConfig {
   public boolean isMemcachedBindAddressModifiable();
   public static String MEMCACHED_BIND_ADDRESS_NAME = "memcached-bind-address";
   public static String DEFAULT_MEMCACHED_BIND_ADDRESS = "";
+  
+  /**
+   * Returns the value of the <a
+   * href="../DistributedSystem.html#redis-port">"redis-port"</a> property
+   * @return the port on which GemFireRedisServer should be started
+   * @since 8.0
+   */
+  public int getRedisPort();
+  public void setRedisPort(int value);
+  public boolean isRedisPortModifiable();
+  public static String REDIS_PORT_NAME = "redis-port";
+  public static int DEFAULT_REDIS_PORT = 0;
+
+  /**
+   * Returns the value of the <a
+   * href="../DistributedSystem.html#redis-bind-address">"redis-bind-address"</a> property
+   * @return the bind address for GemFireRedisServer
+   * @since 8.0
+   */
+  public String getRedisBindAddress();
+  public void setRedisBindAddress(String bindAddress);
+  public boolean isRedisBindAddressModifiable();
+  public static String REDIS_BIND_ADDRESS_NAME = "redis-bind-address";
+  public static String DEFAULT_REDIS_BIND_ADDRESS = "";
+
 
   //Added for the HTTP service
   
@@ -3545,4 +3616,25 @@ public interface DistributionConfig extends Config, LogConfig {
   public Properties getGatewaySSLProperties();
 
   public ConfigSource getConfigSource(String attName);
+
+ 
+  /**
+   * The name of the "lock-memory" property.  Used to cause pages to be locked
+   * into memory, thereby preventing them from being swapped to disk.
+   * @since 9.0
+   */
+  public static String LOCK_MEMORY_NAME = "lock-memory";
+  public static final boolean DEFAULT_LOCK_MEMORY = false;
+  /**
+   * Gets the value of <a href="../DistributedSystem.html#lock-memory">"lock-memory"</a>
+   * @since 9.0
+   */
+  public boolean getLockMemory();
+  /**
+   * Set the value of <a href="../DistributedSystem.html#lock-memory">"lock-memory"</a>
+   * @param value the new setting
+   * @since 9.0
+   */
+  public void setLockMemory(boolean value);
+  public boolean isLockMemoryModifiable();
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
index 08f8365..83eb7ae 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
@@ -301,6 +301,20 @@ public class DistributionConfigImpl
    * Bind address for GemFireMemcachedServer
    */
   private String memcachedBindAddress = DEFAULT_MEMCACHED_BIND_ADDRESS;
+  
+  /** Are distributed transactions enabled or not */
+  private boolean distributedTransactions = DEFAULT_DISTRIBUTED_TRANSACTIONS;
+
+  
+  /**
+   * port on which {@link GemFireRedisServer} is started
+   */
+  private int redisPort;
+  
+  /**
+   * Bind address for GemFireRedisServer
+   */
+  private String redisBindAddress = DEFAULT_REDIS_BIND_ADDRESS;
 
   private boolean jmxManager = Boolean.getBoolean(InternalLocator.FORCE_LOCATOR_DM_TYPE) ? true : DEFAULT_JMX_MANAGER;
   private boolean jmxManagerStart = DEFAULT_JMX_MANAGER_START;
@@ -367,6 +381,12 @@ public class DistributionConfigImpl
   
   protected String userCommandPackages = DEFAULT_USER_COMMAND_PACKAGES;
   
+  /** "off-heap-memory-size" with value of "" or "<size>[g|m]" */
+  protected String offHeapMemorySize = DEFAULT_OFF_HEAP_MEMORY_SIZE;
+  
+  /** Whether pages should be locked into memory or allowed to swap to disk */
+  private boolean lockMemory = DEFAULT_LOCK_MEMORY;
+  
   //////////////////////  Constructors  //////////////////////
 
   /**
@@ -487,6 +507,8 @@ public class DistributionConfigImpl
     this.memcachedPort = other.getMemcachedPort();
     this.memcachedProtocol = other.getMemcachedProtocol();
     this.memcachedBindAddress = other.getMemcachedBindAddress();
+    this.redisPort = other.getRedisPort();
+    this.redisBindAddress = other.getRedisBindAddress();
     this.userCommandPackages = other.getUserCommandPackages();
     
     // following added for 8.0
@@ -531,11 +553,17 @@ public class DistributionConfigImpl
     this.httpServiceSSLProperties = other.getHttpServiceSSLProperties();
     
     this.startDevRestApi = other.getStartDevRestApi();
+
+    // following added for 9.0
+    this.offHeapMemorySize = other.getOffHeapMemorySize();
     
     Map<String, ConfigSource> otherSources = ((DistributionConfigImpl)other).sourceMap;
     if (otherSources != null) {
       this.sourceMap = new HashMap<String, ConfigSource>(otherSources);
     }
+    
+    this.lockMemory = other.getLockMemory();
+    this.distributedTransactions = other.getDistributedTransactions();
   }
 
   /**
@@ -2300,6 +2328,16 @@ public class DistributionConfigImpl
     this.jmxManagerUpdateRate = value;
   }
 
+  @Override
+  public boolean getLockMemory() {
+    return this.lockMemory;
+  }
+
+  @Override
+  public void setLockMemory(final boolean value) {
+    this.lockMemory = value;
+  }
+
   ///////////////////////  Utility Methods  ///////////////////////
   /**
    * Two instances of <code>DistributedConfigImpl</code> are equal if all of 
@@ -3168,6 +3206,43 @@ public class DistributionConfigImpl
     checkMemcachedProtocol(protocol);
     this.memcachedProtocol = protocol;
   }
+  
+  @Override
+  public int getRedisPort() {
+    return this.redisPort;
+  }
+  
+  @Override
+  public void setRedisPort(int value) {
+    checkRedisPort(value);
+    this.redisPort = value;
+  }
+
+  @Override
+  public String getRedisBindAddress() {
+    return this.redisBindAddress;
+  }
+  
+  @Override
+  public void setRedisBindAddress(String bindAddress) {
+    checkRedisBindAddress(bindAddress);
+    this.redisBindAddress = bindAddress;
+  }
+  
+  @Override
+  public String getOffHeapMemorySize() {
+    return this.offHeapMemorySize;
+  }
+  
+  @Override 
+  public void setOffHeapMemorySize(String value) {
+    checkOffHeapMemorySize(value);
+    this.offHeapMemorySize = value;
+  }
+  
+  protected void checkOffHeapMemorySize(String value) {
+    super.checkOffHeapMemorySize(value);
+  }
 
   @Override
   public String getMemcachedBindAddress() {
@@ -3523,4 +3598,13 @@ public class DistributionConfigImpl
   public ConfigSource getConfigSource(String attName) {
     return this.sourceMap.get(attName);
   }
+  
+  public boolean getDistributedTransactions() {
+    return this.distributedTransactions;
+  }
+
+  public void setDistributedTransactions(boolean value) {
+    this.distributedTransactions = value;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionMessage.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionMessage.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionMessage.java
index a6b656d..c8ec9a2 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionMessage.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionMessage.java
@@ -104,6 +104,11 @@ public abstract class DistributionMessage
    */
   private transient ReplySender acker = null;
   
+  /**
+   * True if the P2P reader that received this message is a SHARED reader.
+   */
+  private transient boolean sharedReceiver;
+  
   //////////////////////  Constructors  //////////////////////
 
   protected DistributionMessage() {
@@ -410,9 +415,18 @@ public abstract class DistributionMessage
       && getProcessorType() == DistributionManager.SERIAL_EXECUTOR
       && !isPreciousThread();
     
-    inlineProcess |= this.getInlineProcess();
-    inlineProcess |= Connection.isDominoThread();
-    inlineProcess |= this.acker != null;
+    boolean forceInline = this.acker != null || getInlineProcess() || Connection.isDominoThread();
+    
+    if (inlineProcess && !forceInline && isSharedReceiver()) {
+      // If processing this message may need to add
+      // to more than one serial gateway then don't
+      // do it inline.
+      if (mayAddToMultipleSerialGateways(dm)) {
+        inlineProcess = false;
+      }
+    }
+    
+    inlineProcess |= forceInline;
     
     if (inlineProcess) {
       dm.getStats().incNumSerialThreads(1);
@@ -459,6 +473,12 @@ public abstract class DistributionMessage
     } // not inline
   }
 
+  protected boolean mayAddToMultipleSerialGateways(DistributionManager dm) {
+    // subclasses should override this method if processing
+    // them may add to multiple serial gateways.
+    return false;
+  }
+
   /**
    * returns true if the current thread should not be used for inline
    * processing.  i.e., it is a "precious" resource
@@ -602,6 +622,13 @@ public abstract class DistributionMessage
   {
     return bytesRead;
   }
+  
+  public void setSharedReceiver(boolean v) {
+    this.sharedReceiver = v;
+  }
+  public boolean isSharedReceiver() {
+    return this.sharedReceiver;
+  }
 
   /**
    * 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
index ba19e1c..e30b20b 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
@@ -64,6 +64,7 @@ import com.gemstone.gemfire.internal.DummyStatisticsImpl;
 import com.gemstone.gemfire.internal.GemFireStatSampler;
 import com.gemstone.gemfire.internal.InternalDataSerializer;
 import com.gemstone.gemfire.internal.InternalInstantiator;
+import com.gemstone.gemfire.internal.LinuxProcFsStatistics;
 import com.gemstone.gemfire.internal.LocalStatisticsImpl;
 import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.OsStatisticsFactory;
@@ -73,12 +74,14 @@ import com.gemstone.gemfire.internal.StatisticsManager;
 import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl;
 import com.gemstone.gemfire.internal.SystemTimer;
 import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
+import com.gemstone.gemfire.internal.cache.BridgeServerImpl;
 import com.gemstone.gemfire.internal.cache.CacheConfig;
 import com.gemstone.gemfire.internal.cache.EventID;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.execute.FunctionServiceStats;
 import com.gemstone.gemfire.internal.cache.execute.FunctionStats;
 import com.gemstone.gemfire.internal.cache.tier.sockets.HandShake;
+import com.gemstone.gemfire.internal.cache.xmlcache.BridgeServerCreation;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.logging.LogService;
@@ -88,6 +91,8 @@ import com.gemstone.gemfire.internal.logging.log4j.AlertAppender;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogWriterAppender;
 import com.gemstone.gemfire.internal.logging.log4j.LogWriterAppenders;
+import com.gemstone.gemfire.internal.offheap.MemoryAllocator;
+import com.gemstone.gemfire.internal.offheap.OffHeapStorage;
 import com.gemstone.gemfire.internal.tcp.ConnectionTable;
 import com.gemstone.gemfire.internal.util.concurrent.StoppableCondition;
 import com.gemstone.gemfire.internal.util.concurrent.StoppableReentrantLock;
@@ -116,15 +121,15 @@ public final class InternalDistributedSystem
    */
   public static volatile DistributedSystem systemAttemptingReconnect;
 
+  public static final CreationStackGenerator DEFAULT_CREATION_STACK_GENERATOR = new CreationStackGenerator() {
+    @Override
+    public Throwable generateCreationStack(final DistributionConfig config) {
+      return null;
+    }
+  };
+
   // the following is overridden from DistributedTestCase to fix #51058
-  public static final AtomicReference<CreationStackGenerator> TEST_CREATION_STACK_GENERATOR = new AtomicReference<CreationStackGenerator>(
-      new CreationStackGenerator() {
-        @Override
-        public Throwable generateCreationStack(final DistributionConfig config) {
-          return null;
-        }
-      });
-  
+  public static final AtomicReference<CreationStackGenerator> TEST_CREATION_STACK_GENERATOR = new AtomicReference<CreationStackGenerator>(DEFAULT_CREATION_STACK_GENERATOR);
   
   /** The distribution manager that is used to communicate with the
    * distributed system. */
@@ -493,6 +498,12 @@ public final class InternalDistributedSystem
     return this.isLoner;
   }
 
+  private MemoryAllocator offHeapStore = null;
+  
+  public MemoryAllocator getOffHeapStore() {
+    return this.offHeapStore;
+  }
+  
   /**
    * Initializes this connection to a distributed system with the
    * current configuration state.
@@ -579,6 +590,30 @@ public final class InternalDistributedSystem
         LocalizedStrings.InternalDistributedSystem_PROBLEM_IN_INITIALIZING_KEYS_FOR_CLIENT_AUTHENTICATION.toLocalizedString(), ex);
     }
 
+    final long offHeapMemorySize = OffHeapStorage.parseOffHeapMemorySize(getConfig().getOffHeapMemorySize());
+
+    this.offHeapStore = OffHeapStorage.createOffHeapStorage(getLogWriter(), this, offHeapMemorySize, this);
+    
+    // Note: this can only happen on a linux system
+    if (getConfig().getLockMemory()) {
+      // This calculation is not exact, but seems fairly close.  So far we have
+      // not loaded much into the heap and the current RSS usage is already 
+      // included the available memory calculation.
+      long avail = LinuxProcFsStatistics.getAvailableMemory(logger);
+      long size = offHeapMemorySize + Runtime.getRuntime().totalMemory();
+      if (avail < size) {
+        if (GemFireCacheImpl.ALLOW_MEMORY_LOCK_WHEN_OVERCOMMITTED) {
+          logger.warn(LocalizedMessage.create(LocalizedStrings.InternalDistributedSystem_MEMORY_OVERCOMMIT_WARN, size - avail));
+        } else {
+          throw new IllegalStateException(LocalizedStrings.InternalDistributedSystem_MEMORY_OVERCOMMIT.toLocalizedString(avail, size));
+        }
+      }
+      
+      logger.info("Locking memory. This may take a while...");
+      GemFireCacheImpl.lockMemory();
+      logger.info("Finished locking memory.");
+    }
+
     try {
       startInitLocator();
     } catch (InterruptedException e) {
@@ -1346,6 +1381,11 @@ public final class InternalDistributedSystem
     }
     finally {
       try {
+        if (getOffHeapStore() != null) {
+          getOffHeapStore().close();
+        }
+      } finally {
+      try {
         removeSystem(this);
         // Close the config object
         this.config.close();
@@ -1355,6 +1395,7 @@ public final class InternalDistributedSystem
         setDisconnected();
         SystemFailure.stopThreads();
       }
+      }
     }
   }
 
@@ -2528,6 +2569,8 @@ public final class InternalDistributedSystem
     // the membership manager when forced-disconnect starts.  If we're
     // reconnecting for lost roles then this will be null
     String cacheXML = null;
+    List<BridgeServerCreation> cacheServerCreation = null;
+    
     GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
     boolean inhibitCacheForSQLFire = false;
     if (cache != null) {
@@ -2535,6 +2578,7 @@ public final class InternalDistributedSystem
         inhibitCacheForSQLFire = true;
       } else {
         cacheXML = cache.getCacheConfig().getCacheXMLDescription();
+        cacheServerCreation = cache.getCacheConfig().getCacheServerCreation();
       }
     }
     
@@ -2616,7 +2660,7 @@ public final class InternalDistributedSystem
           }
         }
     
-        logger.info(LocalizedMessage.create(LocalizedStrings.DISTRIBUTED_SYSTEM_RECONNECTING, new Object[]{reconnectAttemptCounter}));
+        logger.info("Disconnecting old DistributedSystem to prepare for a reconnect attempt");
 //        logger.info("IDS@"+System.identityHashCode(this));
         
         try {
@@ -2790,6 +2834,21 @@ public final class InternalDistributedSystem
               config.setCacheXMLDescription(cacheXML);
             }
             cache = GemFireCacheImpl.create(this.reconnectDS, config);
+            if (cacheServerCreation != null) {
+              for (BridgeServerCreation bridge: cacheServerCreation) {
+                BridgeServerImpl impl = (BridgeServerImpl)cache.addCacheServer();
+                impl.configureFrom(bridge);
+                try {
+                  if (!impl.isRunning()) {
+                    impl.start();
+                  }
+                } catch (IOException ex) {
+                  throw new GemFireIOException(
+                      LocalizedStrings.CacheCreation_WHILE_STARTING_BRIDGE_SERVER_0
+                          .toLocalizedString(impl), ex);
+                }
+              }
+            }
             if (cache.getCachePerfStats().getReliableRegionsMissing() == 0){
               reconnectAttemptCounter = 0;
               if (isDebugEnabled) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
index 2dadc4d..9d6c049 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
@@ -190,8 +190,6 @@ public class InternalLocator extends Locator implements ConnectListener {
   
   private final AtomicBoolean shutdownHandled = new AtomicBoolean(false);
   
-  private final ExecutorService _executor;
-  
   private SharedConfiguration sharedConfig;
   
   private volatile boolean isSharedConfigurationStarted = false; 
@@ -215,21 +213,6 @@ public class InternalLocator extends Locator implements ConnectListener {
     }
   }
   
-  {
-    final LoggingThreadGroup loggingThreadGroup = LoggingThreadGroup.createThreadGroup(
-      "WAN Locator Discovery Logger Group", logger);
-
-    final ThreadFactory threadFactory = new ThreadFactory() {
-      public Thread newThread(final Runnable task) {
-        final Thread thread = new Thread(loggingThreadGroup, task, "WAN Locator Discovery Thread");
-        thread.setDaemon(true);
-        return thread;
-      }
-    };
-
-    this._executor = Executors.newCachedThreadPool(threadFactory);
-  }
-
   //////////////////////  Static Methods  /////////////////////
   
   /** the locator hosted by this JVM. As of 7.0 it is a singleton. */
@@ -1064,7 +1047,7 @@ public class InternalLocator extends Locator implements ConnectListener {
     if(stats != null) {
       stats.close();
     }
-
+    
     if(this.locatorListener != null){
       this.locatorListener.clearLocatorInfo();
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/LonerDistributionManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/LonerDistributionManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/LonerDistributionManager.java
index e6d1d72..0d0c922 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/LonerDistributionManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/LonerDistributionManager.java
@@ -74,13 +74,13 @@ public class LonerDistributionManager implements DM {
    */
   public LonerDistributionManager(InternalDistributedSystem system,
                                   InternalLogWriter logger) {
+    JChannel.setDefaultGFFunctions(new GFJGBasicAdapter());
     this.system = system;
     this.logger = logger;
     this.id = generateMemberId();
     this.allIds = Collections.singleton(id);
     this.viewMembers = new Vector(allIds);
     DistributionStats.enableClockStats = this.system.getConfig().getEnableTimeStatistics();
-    JChannel.setDefaultGFFunctions(new GFJGBasicAdapter());
   }
 
   //////////////////////  Instance Methods  //////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
index a26d0d4..68879de 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
@@ -17,11 +17,13 @@ import java.util.Properties;
 import java.util.Set;
 
 import com.gemstone.gemfire.internal.*;
+
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.Instantiator;
 import com.gemstone.gemfire.SystemConnectException;
+import com.gemstone.gemfire.internal.InternalDataSerializer;
 import com.gemstone.gemfire.internal.InternalDataSerializer.SerializerAttributesHolder;
 import com.gemstone.gemfire.internal.InternalInstantiator.InstantiatorAttributesHolder;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
@@ -309,33 +311,25 @@ public final class StartupMessage extends HighPriorityDistributionMessage implem
     return STARTUP_MESSAGE;
   }
 
-  private static final Version[] dsfidVersions = new Version[] {
-          Version.GFE_82
-  };
-
   @Override
   public Version[] getSerializationVersions() {
-    return dsfidVersions;
-  }
-
-  public void toDataPre_GFE_8_2_0_0(DataOutput out) throws IOException {
-    toDataContent(out, true);
+    return null;
   }
 
   @Override
   public void toData(DataOutput out) throws IOException {
-    toDataContent(out, false);
-  }
-
-  private void toDataContent(DataOutput out, boolean pre8_2_0_0) throws IOException {
     super.toData(out);
     out.writeBoolean(this.directChannel != null);
     if (this.directChannel != null) {
       InternalDataSerializer.invokeToData(this.directChannel, out);
     }
-    if (pre8_2_0_0) {
+
+    boolean pre9_0_0_0 = InternalDataSerializer.
+        getVersionForDataStream(out).compareTo(Version.GFE_90) < 0;
+    if (pre9_0_0_0) {
       DataSerializer.writeObject(new Properties(), out);
     }
+
     DataSerializer.writeString(this.version, out);
     out.writeInt(this.replyProcessorId);
     out.writeBoolean(this.isMcastEnabled);
@@ -379,7 +373,7 @@ public final class StartupMessage extends HighPriorityDistributionMessage implem
     data.writeIsSharedConfigurationEnabled(this.isSharedConfigurationEnabled);
     data.writeMcastPort(this.mcastPort);
     data.writeMcastHostAddress(this.mcastHostAddress);
-    data.toData(out);
+    data.writeTo(out);
   }
 
   /**
@@ -394,18 +388,9 @@ public final class StartupMessage extends HighPriorityDistributionMessage implem
     this.fromDataProblems.append("\n\n");
   }
 
-  public void fromDataPre_GFE_8_2_0_0(DataInput in)
-          throws IOException, ClassNotFoundException {
-    fromDataContent(in, true);
-  }
-
   @Override
   public void fromData(DataInput in)
     throws IOException, ClassNotFoundException {
-    fromDataContent(in, false);
-  }
-
-  private void fromDataContent(DataInput in, boolean pre8_2_0_0) throws IOException, ClassNotFoundException {
     super.fromData(in);
     boolean hasDirectChannel = in.readBoolean();
     if (hasDirectChannel) {
@@ -413,9 +398,13 @@ public final class StartupMessage extends HighPriorityDistributionMessage implem
     } else {
       this.directChannel = null;
     }
-    if (pre8_2_0_0) {
+
+    boolean pre9_0_0_0 = InternalDataSerializer.
+        getVersionForDataStream(in).compareTo(Version.GFE_90) < 0;
+    if (pre9_0_0_0) {
       DataSerializer.readObject(in);
     }
+    
     this.version = DataSerializer.readString(in);
     this.replyProcessorId = in.readInt();
     this.isMcastEnabled = in.readBoolean();
@@ -461,7 +450,8 @@ public final class StartupMessage extends HighPriorityDistributionMessage implem
     this.redundancyZone = DataSerializer.readString(in);
     this.enforceUniqueZone = in.readBoolean();
 
-    StartupMessageData data = new StartupMessageData(in, this.version);
+    StartupMessageData data = new StartupMessageData();
+    data.readFrom(in);
     this.hostedLocatorsAll = data.readHostedLocators();
     this.isSharedConfigurationEnabled = data.readIsSharedConfigurationEnabled();
     this.mcastPort = data.readMcastPort();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessageData.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessageData.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessageData.java
index 2799069..3c0cc47 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessageData.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessageData.java
@@ -33,14 +33,13 @@ import com.gemstone.gemfire.internal.GemFireVersion;
  */
 class StartupMessageData {
 
-  static final String SUPPORTED_VERSION = "6.6.3";
   static final String HOSTED_LOCATORS = "HL";
   static final String COMMA_DELIMITER = ",";
   static final String MCAST_PORT = "MP";
   static final String MCAST_HOST_ADDRESS = "MHA";
   static final String IS_SHARED_CONFIG_ENABLED = "ISCE";
   
-  private final Properties optionalFields;
+  private Properties optionalFields;
   
   /**
    * Constructs a new instance with empty Properties. After construction
@@ -53,23 +52,8 @@ class StartupMessageData {
     this.optionalFields = new Properties();
   }
   
-  /**
-   * Constructs a new instance which deserializes any optional fields it
-   * finds in the DataInput (from the wire) if the specified version is
-   * greater than or equal to the minimum {@link #SUPPORTED_VERSION}.
-   * 
-   * @throws ClassNotFoundException
-   * @throws IOException
-   */
-  StartupMessageData(DataInput in, String version) throws ClassNotFoundException, IOException {
-    // [bruce] commenting this out for the GemFireXD Cheetah 1.0 release.  It should be removed
-    // from the GemFire Cedar branch as well.  Future versioning work should use the
-    // version ordinal found in the DataInput passed to fromData methods.
-//    if (GemFireVersion.compareVersions(version, StartupMessageData.SUPPORTED_VERSION) >= 0) {
-      this.optionalFields = (Properties) DataSerializer.readObject(in);
-//    } else {
-//      this.optionalFields = null;
-//    }
+  public void readFrom(DataInput in) throws ClassNotFoundException, IOException {
+    this.optionalFields = DataSerializer.readObject(in);
   }
 
   /**
@@ -206,7 +190,7 @@ class StartupMessageData {
    * 
    * @throws IOException
    */
-  void toData(DataOutput out) throws IOException {
+  void writeTo(DataOutput out) throws IOException {
     if (this.optionalFields.isEmpty()) {
       DataSerializer.writeObject(null, out);
     } else {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseMessage.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseMessage.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseMessage.java
index eb4c7bb..e94692a 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseMessage.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseMessage.java
@@ -195,17 +195,6 @@ public class StartupResponseMessage extends HighPriorityDistributionMessage impl
     return STARTUP_RESPONSE_MESSAGE;
   }
   
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    toDataContent(out, Version.CURRENT);
-  }
-
-  @Override
-  public void fromData(DataInput in)
-    throws IOException, ClassNotFoundException {
-    fromDataContent(in, Version.CURRENT);
-  }
-  
   private void fromDataProblem(String s) {
     if (this.fromDataProblems == null) {
       this.fromDataProblems = new StringBuffer();
@@ -215,18 +204,18 @@ public class StartupResponseMessage extends HighPriorityDistributionMessage impl
     this.fromDataProblems.append(System.getProperty("line.separator", "\n"));
   }
 
-  // versions where serialization changed
-  private static Version[] serializationVersions = new Version[] {
-    Version.GFE_80, Version.GFE_82
-  };
-  
   @Override
   public Version[] getSerializationVersions() {
-    return serializationVersions;
+    return null;
   }
   
-  public void toDataContent(DataOutput out, Version ver) throws IOException {
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    
     super.toData(out);
+    
+    Version ver = InternalDataSerializer.getVersionForDataStream(out);
+    
     out.writeInt(processorId);
     if (ver.compareTo(Version.GFE_80) < 0) {
       out.writeLong(System.currentTimeMillis());
@@ -250,25 +239,21 @@ public class StartupResponseMessage extends HighPriorityDistributionMessage impl
     }
     
     DataSerializer.writeObject(interfaces, out);
-    if (ver.compareTo(Version.GFE_82) < 0) {
+    if (ver.compareTo(Version.GFE_90) < 0) {
       DataSerializer.writeObject(new Properties(), out);
     }
     out.writeInt(distributedSystemId);
     DataSerializer.writeString(redundancyZone, out);
   }
   
-  public void toDataPre_GFE_8_0_0_0(DataOutput out) throws IOException {
-    toDataContent(out, Version.GFE_80);
-  }
-
-  public void toDataPre_GFE_8_2_0_0(DataOutput out) throws IOException {
-    toDataContent(out, Version.GFE_82);
-  }
-
-  private void fromDataContent(DataInput in, Version ver)
+  @Override
+  public void fromData(DataInput in)
     throws IOException, ClassNotFoundException {
       
     super.fromData(in);
+    
+    Version ver = InternalDataSerializer.getVersionForDataStream(in);
+    
     this.processorId = in.readInt();
     if (ver.compareTo(Version.GFE_80) < 0) {
       in.readLong();
@@ -301,23 +286,13 @@ public class StartupResponseMessage extends HighPriorityDistributionMessage impl
     } // for
     
     interfaces = (Set)DataSerializer.readObject(in);
-    if (ver.compareTo(Version.GFE_82) < 0) {
+    if (ver.compareTo(Version.GFE_90) < 0) {
       DataSerializer.readObject(in);
     }
     distributedSystemId = in.readInt();
     redundancyZone = DataSerializer.readString(in);
   }
  
-  public void fromDataPre_GFE_8_0_0_0(DataInput in)
-      throws IOException, ClassNotFoundException {
-    fromDataContent(in, Version.GFE_80);
-  }
-  
-  public void fromDataPre_GFE_8_2_0_0(DataInput in)
-      throws IOException, ClassNotFoundException {
-    fromDataContent(in, Version.GFE_82);
-  }
-  
   @Override
   public String toString() {
     return "StartupResponse: rejectionMessage="

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage.java
index 61fda2d..c24478a 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupResponseWithVersionMessage.java
@@ -17,6 +17,7 @@ import org.apache.logging.log4j.Logger;
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.InternalDataSerializer;
 import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.internal.logging.LogService;
 
@@ -71,51 +72,27 @@ public class StartupResponseWithVersionMessage extends StartupResponseMessage {
     return super.toString() + " version="+this.version;
   }
 
-  // versions where serialization changed
-  private static Version[] serializationVersions = new Version[] {
-    Version.GFE_80};
-  
   @Override
   public Version[] getSerializationVersions() {
-    return serializationVersions;
+    return null;
   }
 
-  public void toDataPre_GFE_8_0_0_0(DataOutput out) throws IOException {
-    super.toDataPre_GFE_8_0_0_0(out);
-    cmnToData(out);
-  }
-  
   @Override
   public void toData(DataOutput out) throws IOException {
     super.toData(out);
-    cmnToData(out);
-  }
-
-  public void cmnToData(DataOutput out) throws IOException {
     DataSerializer.writeString(this.version, out);
-    
     StartupMessageData data = new StartupMessageData();
     data.writeHostedLocators(this.hostedLocators);
     data.writeIsSharedConfigurationEnabled(this.isSharedConfigurationEnabled);
-    data.toData(out);
+    data.writeTo(out);
   }
 
   @Override
-  public void fromDataPre_GFE_8_0_0_0(DataInput in) throws IOException, ClassNotFoundException {
-    super.fromDataPre_GFE_8_0_0_0(in);
-    cmnFromData(in);
-  }
-  
-  @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     super.fromData(in);
-    cmnFromData(in);
-  }
-
-  public void cmnFromData(DataInput in) throws IOException, ClassNotFoundException {
     this.version = DataSerializer.readString(in);
-    
-    StartupMessageData data = new StartupMessageData(in, this.version);
+    StartupMessageData data = new StartupMessageData();
+    data.readFrom(in);
     this.hostedLocators = data.readHostedLocators();
     this.isSharedConfigurationEnabled = data.readIsSharedConfigurationEnabled();
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/31d1b20e/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
index 68f8bb8..ada8c6a 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalDistributedMember.java
@@ -41,6 +41,7 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.net.Inet4Address;
 
 /**
  * This is the fundamental representation of a member of a GemFire distributed
@@ -1177,4 +1178,31 @@ public final class InternalDistributedMember
   public Version[] getSerializationVersions() {
     return dsfidVersions;
   }
+
+
+  @Override
+  public int getSizeInBytes() {
+  
+    int size = 0;
+  
+    // ipaddr:  1 byte length + 4 bytes (IPv4) or 16 bytes (IPv6)
+    if (ipAddr.getIpAddress() instanceof Inet4Address){
+      size += 5;
+    } else {
+      size += 17;
+    }
+    
+    // port:  4 bytes
+    // flags: 1 byte
+    //vmKind: 1 byte
+    size += 6;
+    
+    // viewID:  String(1+1+numchars)
+    size += (2+ String.valueOf(this.vmViewId).length());
+    
+    // empty name: String(1+1)
+    size += 2;
+    
+    return size;
+  }
 }


Mime
View raw message