You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2015/08/14 22:40:21 UTC

[32/50] [abbrv] incubator-geode git commit: Fix for GEODE-109

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZRemRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZRemRangeByScoreExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZRemRangeByScoreExecutor.java
index ca6cd82..19356b7 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZRemRangeByScoreExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZRemRangeByScoreExecutor.java
@@ -74,7 +74,7 @@ public class ZRemRangeByScoreExecutor extends SortedSetExecutor {
     try {
       if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY && startInclusive && stopInclusive) {
         numRemoved = keyRegion.size();
-        context.getRegionCache().removeKey(key);
+        context.getRegionProvider().removeKey(key);
       } else {
         removeList = getKeys(context, key, keyRegion, start, stop, startInclusive, stopInclusive);
       }
@@ -93,7 +93,7 @@ public class ZRemRangeByScoreExecutor extends SortedSetExecutor {
         if (oldVal != null)
           numRemoved++;
         if (keyRegion.isEmpty())
-          context.getRegionCache().removeKey(key);
+          context.getRegionProvider().removeKey(key);
       }
     }
     command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZScanExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZScanExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZScanExecutor.java
index 097e9be..faa8ffd 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZScanExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/sortedset/ZScanExecutor.java
@@ -2,6 +2,7 @@ package com.gemstone.gemfire.internal.redis.executor.sortedset;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.regex.Pattern;
@@ -31,7 +32,7 @@ public class ZScanExecutor extends AbstractScanExecutor {
     }
 
     ByteArrayWrapper key = command.getKey();
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = (Region<ByteArrayWrapper, DoubleWrapper>) context.getRegionCache().getRegion(key);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = (Region<ByteArrayWrapper, DoubleWrapper>) context.getRegionProvider().getRegion(key);
     checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
     if (keyRegion == null) {
       command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), new ArrayList<String>()));
@@ -96,7 +97,7 @@ public class ZScanExecutor extends AbstractScanExecutor {
       return;
     }
 
-    List<ByteArrayWrapper> returnList = (List<ByteArrayWrapper>) getIteration(keyRegion.entrySet(), matchPattern, count, cursor);
+    List<ByteArrayWrapper> returnList = (List<ByteArrayWrapper>) getIteration(new HashSet(keyRegion.entrySet()), matchPattern, count, cursor);
 
     command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/AppendExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/AppendExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/AppendExecutor.java
index fa83882..fda38c8 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/AppendExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/AppendExecutor.java
@@ -17,7 +17,7 @@ public class AppendExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();;
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();;
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.APPEND));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitCountExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitCountExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitCountExecutor.java
index a4fbf95..4ac408d 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitCountExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitCountExecutor.java
@@ -18,7 +18,7 @@ public class BitCountExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() != 2 && commandElems.size() != 4) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITCOUNT));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitOpExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitOpExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitOpExecutor.java
index 7dd10e9..c678b79 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitOpExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitOpExecutor.java
@@ -17,7 +17,7 @@ public class BitOpExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 4) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITOP));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitPosExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitPosExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitPosExecutor.java
index 7a2a492..796c858 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitPosExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/BitPosExecutor.java
@@ -19,7 +19,7 @@ public class BitPosExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITPOS));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrByExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrByExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrByExecutor.java
index 4bcbd8d..9dfdfed 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrByExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrByExecutor.java
@@ -23,7 +23,7 @@ public class DecrByExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DECRBY));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrExecutor.java
index 55b7fc5..b66160d 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/DecrExecutor.java
@@ -9,7 +9,7 @@ import com.gemstone.gemfire.internal.redis.Command;
 import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
 import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
 import com.gemstone.gemfire.internal.redis.RedisDataType;
-import com.gemstone.gemfire.internal.redis.RegionCache;
+import com.gemstone.gemfire.internal.redis.RegionProvider;
 
 public class DecrExecutor extends StringExecutor {
 
@@ -25,7 +25,7 @@ public class DecrExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    RegionCache rC = context.getRegionCache();
+    RegionProvider rC = context.getRegionProvider();
     Region<ByteArrayWrapper, ByteArrayWrapper> r = rC.getStringsRegion();;
 
     if (commandElems.size() < 2) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetBitExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetBitExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetBitExecutor.java
index 1035d10..928700a 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetBitExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetBitExecutor.java
@@ -17,7 +17,7 @@ public class GetBitExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETBIT));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetExecutor.java
index aed0f2a..86d5c75 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetExecutor.java
@@ -12,7 +12,7 @@ public class GetExecutor extends StringExecutor {
 
   @Override
   public void executeCommand(Command command, ExecutionHandlerContext context) {
-    Region<ByteArrayWrapper, ByteArrayWrapper> r= context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r= context.getRegionProvider().getStringsRegion();
 
     if (command.getProcessedCommand().size() < 2) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETEXECUTOR));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
index 20d938d..4d96c5f 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
@@ -23,7 +23,7 @@ public class GetRangeExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 4) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETRANGE));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
index f599c96..132fdc5 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
@@ -17,7 +17,7 @@ public class GetSetExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETSET));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
index 8e9ca4d..02c5b1e 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
@@ -23,7 +23,7 @@ public class IncrByExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBY));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
index 2c3c5f8..c08f709 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
@@ -24,7 +24,7 @@ public class IncrByFloatExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBYFLOAT));
       return;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
index aafe7dd..44feb03 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
@@ -21,7 +21,7 @@ public class IncrExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 2) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCR));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
index bd002ce..b063288 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
@@ -18,7 +18,7 @@ public class MGetExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 2) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MGET));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
index d95dc34..531895e 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
@@ -20,7 +20,7 @@ public class MSetExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSET));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
index c7f52cd..0182f19 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
@@ -22,7 +22,7 @@ public class MSetNXExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSETNX));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
index ef8cd3e..e3e85b3 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
@@ -21,7 +21,7 @@ public class SetBitExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 4) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETBIT));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
index 6ad4c90..448f912 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
@@ -24,7 +24,7 @@ public class SetEXExecutor extends StringExecutor implements Extendable {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 4) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
@@ -54,7 +54,7 @@ public class SetEXExecutor extends StringExecutor implements Extendable {
     checkAndSetDataType(key, context);
     r.put(key, new ByteArrayWrapper(value));
 
-    context.getRegionCache().setExpiration(key, expiration);
+    context.getRegionProvider().setExpiration(key, expiration);
 
     command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
index c4b9b85..b6dc703 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
@@ -19,7 +19,7 @@ public class SetExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SET));
@@ -90,7 +90,7 @@ public class SetExecutor extends StringExecutor {
     }
 
     if (keyWasSet && expiration > 0L) {
-      context.getRegionCache().setExpiration(key, expiration);
+      context.getRegionProvider().setExpiration(key, expiration);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
index 0956a6a..0daaeb9 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
@@ -21,7 +21,7 @@ public class SetNXExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETNX));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
index 8f00a83..1656065 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
@@ -19,7 +19,7 @@ public class SetRangeExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 4) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETRANGE));
@@ -48,7 +48,7 @@ public class SetRangeExecutor extends StringExecutor {
       int length = wrapper == null ? 0 : wrapper.toBytes().length;
       command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), length));
       if (wrapper == null)
-        context.getRegionCache().removeKey(key);
+        context.getRegionProvider().removeKey(key);
       return;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
index 1f95ce6..49c81b3 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
@@ -9,7 +9,7 @@ import com.gemstone.gemfire.internal.redis.executor.AbstractExecutor;
 public abstract class StringExecutor extends AbstractExecutor {
   
   protected final void checkAndSetDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
-    Object oldVal = context.getRegionCache().metaPutIfAbsent(key, RedisDataType.REDIS_STRING);
+    Object oldVal = context.getRegionProvider().metaPutIfAbsent(key, RedisDataType.REDIS_STRING);
     if (oldVal == RedisDataType.REDIS_PROTECTED)
       throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
     if (oldVal != null && oldVal != RedisDataType.REDIS_STRING)
@@ -17,7 +17,7 @@ public abstract class StringExecutor extends AbstractExecutor {
   }
   
   protected void checkDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
-    RedisDataType currentType = context.getRegionCache().getRedisDataType(key);
+    RedisDataType currentType = context.getRegionProvider().getRedisDataType(key);
     if (currentType == null)
       return;
     if (currentType == RedisDataType.REDIS_PROTECTED)

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
index 8174f1c..389de5a 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
@@ -18,7 +18,7 @@ public class StrlenExecutor extends StringExecutor {
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionCache().getStringsRegion();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
 
     if (commandElems.size() < 2) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.STRLEN));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java
new file mode 100644
index 0000000..64a2b6b
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.redis.org.apache.hadoop.fs;
+
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * A class for POSIX glob pattern with brace expansions.
+ */
+public class GlobPattern {
+  private static final char BACKSLASH = '\\';
+  private Pattern compiled;
+  private boolean hasWildcard = false;
+
+  /**
+   * Construct the glob pattern object with a glob pattern string
+   * @param globPattern the glob pattern string
+   */
+  public GlobPattern(String globPattern) {
+    set(globPattern);
+  }
+
+  /**
+   * @return the compiled pattern
+   */
+  public Pattern compiled() {
+    return compiled;
+  }
+
+  /**
+   * Compile glob pattern string
+   * @param globPattern the glob pattern
+   * @return the pattern object
+   */
+  public static Pattern compile(String globPattern) {
+    return new GlobPattern(globPattern).compiled();
+  }
+
+  /**
+   * Match input against the compiled glob pattern
+   * @param s input chars
+   * @return true for successful matches
+   */
+  public boolean matches(CharSequence s) {
+    return compiled.matcher(s).matches();
+  }
+
+  /**
+   * Set and compile a glob pattern
+   * @param glob  the glob pattern string
+   */
+  public void set(String glob) {
+    StringBuilder regex = new StringBuilder();
+    int setOpen = 0;
+    int curlyOpen = 0;
+    int len = glob.length();
+    hasWildcard = false;
+
+    for (int i = 0; i < len; i++) {
+      char c = glob.charAt(i);
+
+      switch (c) {
+      case BACKSLASH:
+        if (++i >= len) {
+          error("Missing escaped character", glob, i);
+        }
+        regex.append(c).append(glob.charAt(i));
+        continue;
+      case '.':
+      case '$':
+      case '(':
+      case ')':
+      case '|':
+      case '+':
+        // escape regex special chars that are not glob special chars
+        regex.append(BACKSLASH);
+        break;
+      case '*':
+        regex.append('.');
+        hasWildcard = true;
+        break;
+      case '?':
+        regex.append('.');
+        hasWildcard = true;
+        continue;
+      case '{': // start of a group
+        regex.append("(?:"); // non-capturing
+        curlyOpen++;
+        hasWildcard = true;
+        continue;
+      case ',':
+        regex.append(curlyOpen > 0 ? '|' : c);
+        continue;
+      case '}':
+        if (curlyOpen > 0) {
+          // end of a group
+          curlyOpen--;
+          regex.append(")");
+          continue;
+        }
+        break;
+      case '[':
+        if (setOpen > 0) {
+          error("Unclosed character class", glob, i);
+        }
+        setOpen++;
+        hasWildcard = true;
+        break;
+      case '^': // ^ inside [...] can be unescaped
+        if (setOpen == 0) {
+          regex.append(BACKSLASH);
+        }
+        break;
+      case '!': // [! needs to be translated to [^
+        regex.append(setOpen > 0 && '[' == glob.charAt(i - 1) ? '^' : '!');
+        continue;
+      case ']':
+        // Many set errors like [][] could not be easily detected here,
+        // as []], []-] and [-] are all valid POSIX glob and java regex.
+        // We'll just let the regex compiler do the real work.
+        setOpen = 0;
+        break;
+      default:
+      }
+      regex.append(c);
+    }
+
+    if (setOpen > 0) {
+      error("Unclosed character class", glob, len);
+    }
+    if (curlyOpen > 0) {
+      error("Unclosed group", glob, len);
+    }
+    compiled = Pattern.compile(regex.toString());
+  }
+
+  /**
+   * @return true if this is a wildcard pattern (with special chars)
+   */
+  public boolean hasWildcard() {
+    return hasWildcard;
+  }
+
+  private static void error(String message, String pattern, int pos) {
+    throw new PatternSyntaxException(message, pattern, pos);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/main/java/com/gemstone/gemfire/redis/GemFireRedisServer.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/redis/GemFireRedisServer.java b/gemfire-core/src/main/java/com/gemstone/gemfire/redis/GemFireRedisServer.java
index 662e0a8..821ea08 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/redis/GemFireRedisServer.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/redis/GemFireRedisServer.java
@@ -46,7 +46,7 @@ import com.gemstone.gemfire.internal.redis.ByteToCommandDecoder;
 import com.gemstone.gemfire.internal.redis.Coder;
 import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
 import com.gemstone.gemfire.internal.redis.RedisDataType;
-import com.gemstone.gemfire.internal.redis.RegionCache;
+import com.gemstone.gemfire.internal.redis.RegionProvider;
 import com.gemstone.gemfire.internal.redis.executor.hll.HyperLogLogPlus;
 
 /**
@@ -63,6 +63,12 @@ import com.gemstone.gemfire.internal.redis.executor.hll.HyperLogLogPlus;
  * or {@link GemFireRedisServer#STRING_REGION}. The default Region type is 
  * {@link RegionShortcut#PARTITION} although this can be changed by specifying the
  * SystemProperty {@value #DEFAULT_REGION_SYS_PROP_NAME} to a type defined by {@link RegionShortcut}.
+ * If the {@link GemFireRedisServer#NUM_THREADS_SYS_PROP_NAME} system property is set to 0,
+ * one thread per client will be created. Otherwise a worker thread pool of specified size is
+ * used or a default size of 4 * {@link Runtime#availableProcessors()} if the property is not set.
+ * <p>
+ * Setting the AUTH password requires setting the property "redis-password" just as "redis-port"
+ * would be in xml or through GFSH.
  * <p>
  * The supported commands are as follows:
  * <p>
@@ -182,7 +188,7 @@ public class GemFireRedisServer {
    */
   private LogWriter logger;
 
-  private RegionCache regionCache;
+  private RegionProvider regionCache;
 
   private final MetaCacheListener metaListener;
 
@@ -216,12 +222,6 @@ public class GemFireRedisServer {
   public static final String REDIS_META_DATA_REGION = "__ReDiS_MeTa_DaTa";
 
   /**
-   * The field that defines the name of the {@link Region} which holds all of
-   * the lists meta data. The current value of this field is {@value #LISTS_META_DATA_REGION}.
-   */
-  public static final String LISTS_META_DATA_REGION = "__LiStS_MeTa_DaTa";
-
-  /**
    * The system property name used to set the default {@link Region} creation
    * type. The property name is {@value #DEFAULT_REGION_SYS_PROP_NAME} and the
    * acceptable values are types defined by {@link RegionShortcut}, 
@@ -236,28 +236,23 @@ public class GemFireRedisServer {
   public static final String NUM_THREADS_SYS_PROP_NAME = "gemfireredis.numthreads";
 
   /**
-   * This String holds the String representation of the {@link RegionShortcut}
-   * that will be used as the default Region type for all region creation. This
-   * is set by the system property {@value #DEFAULT_REGION_SYS_PROP_NAME} and the
-   * default type is {@link RegionShortcut#PARTITION}.
-   */
-  private static final String regionType = System.getProperty(DEFAULT_REGION_SYS_PROP_NAME, "PARTITION");
-
-  /**
    * The actual {@link RegionShortcut} type specified by the system property
    * {@value #DEFAULT_REGION_SYS_PROP_NAME}.
    */
-  public static final RegionShortcut DEFAULT_REGION_TYPE = setRegion(regionType);
+  public final RegionShortcut DEFAULT_REGION_TYPE;
+
+  private boolean shutdown;
+  private boolean started;
 
   /**
    * Determine the {@link RegionShortcut} type from a String value.
    * If the String value doesn't map to a RegionShortcut type then 
    * {@link RegionShortcut#PARTITION} will be used by default.
    * 
-   * @param regionType The String representation of a {@link RegionShortcut}
    * @return {@link RegionShortcut}
    */
-  private static RegionShortcut setRegion(String regionType) {
+  private static RegionShortcut setRegionType() {
+    String regionType = System.getProperty(DEFAULT_REGION_SYS_PROP_NAME, "PARTITION");
     RegionShortcut type;
     try {
       type = RegionShortcut.valueOf(regionType);
@@ -312,9 +307,9 @@ public class GemFireRedisServer {
 
   /**
    * Constructor for {@link GemFireRedisServer} that will start the
-   * server and bind to the given address and port. Additionally the 
-   * number of threads used by the server to handle clients is specified
-   * as well as the logging level to be used by GemFire
+   * server and bind to the given address and port. Keep in mind that the
+   * log level configuration will only be set if a {@link Cache} does not already
+   * exist, if one already exists then setting that property will have no effect.
    * 
    * @param bindAddress The address to which the server will attempt to bind to
    * @param port The port the server will bind to, will use {@value #DEFAULT_REDIS_SERVER_PORT} by default if argument is less than or equal to 0
@@ -344,6 +339,9 @@ public class GemFireRedisServer {
       }
 
     });
+    this.DEFAULT_REGION_TYPE = setRegionType();
+    this.shutdown = false;
+    this.started = false;
   }
 
   /**
@@ -362,15 +360,18 @@ public class GemFireRedisServer {
    * This is function to call on a {@link GemFireRedisServer} instance
    * to start it running
    */
-  public void start() {
-    try {
-      startGemFire();
-      initializeRedis();
-      startRedisServer();
-    } catch (IOException e) {
-      throw new RuntimeException("Could not start Server", e);
-    } catch (InterruptedException e) {
-      throw new RuntimeException("Could not start Server", e);
+  public synchronized void start() {
+    if (!started) {
+      try {
+        startGemFire();
+        initializeRedis();
+        startRedisServer();
+      } catch (IOException e) {
+        throw new RuntimeException("Could not start Server", e);
+      } catch (InterruptedException e) {
+        throw new RuntimeException("Could not start Server", e);
+      }
+      started = true;
     }
   }
 
@@ -383,20 +384,24 @@ public class GemFireRedisServer {
   private void startGemFire() {
     Cache c = GemFireCacheImpl.getInstance();
     if (c == null) {
-      CacheFactory cacheFactory = new CacheFactory();
-      if (logLevel != null)
-        cacheFactory.set("log-level", logLevel);
-      this.cache = cacheFactory.create();
-    } else
-      this.cache = c;
-    this.logger = this.cache.getLogger();
+      synchronized (GemFireRedisServer.class) {
+        c = GemFireCacheImpl.getInstance();
+        if (c == null) {
+          CacheFactory cacheFactory = new CacheFactory();
+          if (logLevel != null)
+            cacheFactory.set("log-level", logLevel);
+          c = cacheFactory.create();
+        }
+      }
+    }
+    this.cache = c;
+    this.logger = c.getLogger();
   }
 
   private void initializeRedis() {
     synchronized (this.cache) {
       RegionFactory<String, RedisDataType> rfMeta = cache.createRegionFactory(RegionShortcut.REPLICATE);
       rfMeta.addCacheListener(this.metaListener);
-      RegionFactory<String, Integer> rfList = cache.createRegionFactory(RegionShortcut.REPLICATE);
       RegionFactory<ByteArrayWrapper, ByteArrayWrapper> rfString = cache.createRegionFactory(DEFAULT_REGION_TYPE);
       RegionFactory<ByteArrayWrapper, HyperLogLogPlus> rfHLL = cache.createRegionFactory(DEFAULT_REGION_TYPE);
       Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion;
@@ -408,14 +413,10 @@ public class GemFireRedisServer {
       Region<String, RedisDataType> redisMetaData;
       if ((redisMetaData = this.cache.getRegion(REDIS_META_DATA_REGION)) == null)
         redisMetaData = rfMeta.create(REDIS_META_DATA_REGION);
-      Region<String, Integer> listsMetaData;
-      if ((listsMetaData = this.cache.getRegion(LISTS_META_DATA_REGION)) == null)
-        listsMetaData = rfList.create(LISTS_META_DATA_REGION);
-      this.regionCache = new RegionCache(stringsRegion, hLLRegion, redisMetaData, listsMetaData, expirationFutures, expirationExecutor);
+      this.regionCache = new RegionProvider(stringsRegion, hLLRegion, redisMetaData, expirationFutures, expirationExecutor, this.DEFAULT_REGION_TYPE);
       redisMetaData.put(REDIS_META_DATA_REGION, RedisDataType.REDIS_PROTECTED);
       redisMetaData.put(HLL_REGION, RedisDataType.REDIS_PROTECTED);
       redisMetaData.put(STRING_REGION, RedisDataType.REDIS_PROTECTED);
-      redisMetaData.put(LISTS_META_DATA_REGION, RedisDataType.REDIS_PROTECTED);
     }
     checkForRegions();
   }
@@ -542,9 +543,9 @@ public class GemFireRedisServer {
       final String key = (String) event.getKey();
       final RedisDataType value = event.getOldValue();
       if (value != null && value != RedisDataType.REDIS_STRING && value != RedisDataType.REDIS_HLL && value != RedisDataType.REDIS_PROTECTED) {
-        Region<?, ?> r = this.regionCache.getRegion(Coder.stringToByteArrayWrapper(key));
+        ByteArrayWrapper kW = Coder.stringToByteArrayWrapper(key);
+        Region<?, ?> r = this.regionCache.getRegion(kW);
         if (r != null) { 
-          ByteArrayWrapper kW = Coder.stringToByteArrayWrapper(key);
           this.regionCache.removeRegionReferenceLocally(kW, value);
         }
       }
@@ -579,23 +580,26 @@ public class GemFireRedisServer {
    * Shutdown method for {@link GemFireRedisServer}. This closes the {@link Cache},
    * interrupts all execution and forcefully closes all connections.
    */
-  public void shutdown() {
-    if (logger.infoEnabled())
-      logger.info("GemFireRedisServer shutting down");
-    ChannelFuture closeFuture = this.serverChannel.closeFuture();
-    this.serverChannel.close();
-    Future<?> c = workerGroup.shutdownGracefully();
-    Future<?> c2 = bossGroup.shutdownGracefully();
-    c.syncUninterruptibly();
-    c2.syncUninterruptibly();
-    this.regionCache.close();
-    if (mainThread != null)
-      mainThread.interrupt();
-    for (ScheduledFuture<?> f : this.expirationFutures.values())
-      f.cancel(true);
-    this.expirationFutures.clear();
-    this.expirationExecutor.shutdownNow();
-    closeFuture.syncUninterruptibly();
+  public synchronized void shutdown() {
+    if (!shutdown) {
+      if (logger.infoEnabled())
+        logger.info("GemFireRedisServer shutting down");
+      ChannelFuture closeFuture = this.serverChannel.closeFuture();
+      Future<?> c = workerGroup.shutdownGracefully();
+      Future<?> c2 = bossGroup.shutdownGracefully();
+      this.serverChannel.close();
+      c.syncUninterruptibly();
+      c2.syncUninterruptibly();
+      this.regionCache.close();
+      if (mainThread != null)
+        mainThread.interrupt();
+      for (ScheduledFuture<?> f : this.expirationFutures.values())
+        f.cancel(true);
+      this.expirationFutures.clear();
+      this.expirationExecutor.shutdownNow();
+      closeFuture.syncUninterruptibly();
+      shutdown = true;
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ConcurrentStartTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ConcurrentStartTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ConcurrentStartTest.java
new file mode 100644
index 0000000..618aca0
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ConcurrentStartTest.java
@@ -0,0 +1,58 @@
+package com.gemstone.gemfire.redis;
+
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class ConcurrentStartTest {
+
+  int numServers = 10;
+  @Test
+  public void testCachelessStart() throws InterruptedException {
+    runNServers(numServers);
+    GemFireCacheImpl.getInstance().close();
+  }
+  @Test
+  public void testCachefulStart() throws InterruptedException {
+    CacheFactory cf = new CacheFactory();
+    cf.set("mcast-port", "0");
+    cf.set("locators", "");
+    Cache c = cf.create();
+    runNServers(numServers);
+    c.close();
+  }
+  
+  private void runNServers(int n) throws InterruptedException {
+    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(numServers);
+    final Thread[] threads = new Thread[n];
+    for (int i = 0; i < n; i++) {
+      final int j = i;
+      Runnable r = new Runnable() {
+
+        @Override
+        public void run() {
+          GemFireRedisServer s = new GemFireRedisServer(ports[j]);
+          s.start();
+          s.shutdown();
+        }
+      };
+      
+      Thread t = new Thread(r);
+      t.setDaemon(true);
+      t.start();
+      threads[i] = t;
+    }
+    for (Thread t : threads)
+      t.join();
+    Cache c = GemFireCacheImpl.getInstance();
+    assertFalse(c.isClosed());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/test/java/com/gemstone/gemfire/redis/HashesJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/HashesJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/HashesJUnitTest.java
new file mode 100755
index 0000000..d41b656
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/HashesJUnitTest.java
@@ -0,0 +1,175 @@
+package com.gemstone.gemfire.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import redis.clients.jedis.Jedis;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class HashesJUnitTest {
+  private static Jedis jedis;
+  private static GemFireRedisServer server;
+  private static GemFireCache cache;
+  private static Random rand;
+  private static int port = 6379;
+
+  @BeforeClass
+  public static void setUp() throws IOException {
+    rand = new Random();
+    CacheFactory cf = new CacheFactory();
+    //cf.set("log-file", "redis.log");
+    cf.set("log-level", "error");
+    cf.set("mcast-port", "0");
+    cf.set("locators", "");
+    cache = cf.create();
+    port = AvailablePortHelper.getRandomAvailableTCPPort();
+    server = new GemFireRedisServer("localhost", port);
+
+    server.start();
+    jedis = new Jedis("localhost", port, 10000000);
+  }
+
+  @Test
+  public void testHMSetHSetHLen() {
+    int num = 10;
+    String key = randString();
+    Map<String, String> hash = new HashMap<String, String>();
+    for (int i = 0; i < num; i++) {
+      hash.put(randString(), randString());
+    }
+    String response = jedis.hmset(key, hash);
+    assertTrue(response.equals("OK"));
+    assertEquals(new Long(hash.size()), jedis.hlen(key));
+
+    key = randString();
+    hash = new HashMap<String, String>();
+    for (int i = 0; i < num; i++) {
+      hash.put(randString(), randString());
+    }
+    Set<String> keys = hash.keySet();
+    Long count = 1L;
+    for (String field: keys) {
+      Long res = jedis.hset(key, field, hash.get(field));
+      assertTrue(res == 1L);
+      assertEquals(count++, jedis.hlen(key));
+    }
+  }
+
+  @Test
+  public void testHMGetHDelHGetAllHVals() {
+    String key = randString();
+    Map<String, String> hash = new HashMap<String, String>();
+    for (int i = 0; i < 10; i++) {
+      String m = randString();
+      String f = randString();
+      hash.put(m, f);
+    }
+    jedis.hmset(key, hash);
+    Set<String> keys = hash.keySet();
+    String[] keyArray = keys.toArray(new String[keys.size()]);
+    List<String> retList = jedis.hmget(key, keyArray);
+
+    for (int i = 0; i < keys.size(); i++) {
+      assertEquals(retList.get(i), hash.get(keyArray[i]));
+    }
+
+    Map<String, String> retMap = jedis.hgetAll(key);
+
+    assertEquals(retMap, hash);
+
+    List<String> retVals = jedis.hvals(key);
+    Set<String> retSet = new HashSet<String>(retVals);
+
+    assertTrue(retSet.containsAll(hash.values()));
+
+    jedis.hdel(key, keyArray);
+    assertTrue(jedis.hlen(key) == 0);
+  }
+
+  @Test
+  public void testHkeys() {
+    String key = randString();
+    Map<String, String> hash = new HashMap<String, String>();
+    for (int i = 0; i < 10; i++) {
+      hash.put(randString(), randString());
+    }
+    String response = jedis.hmset(key, hash);
+
+    Set<String> keys = hash.keySet();
+    Set<String> retSet = jedis.hkeys(key);
+
+    assertTrue(retSet.containsAll(keys));
+  }
+
+  @Test
+  public void testHIncrBy() {
+    String key = randString();
+    String field = randString();
+
+    Long incr = (long) rand.nextInt(50);
+    if (incr == 0)
+      incr++;
+
+    long response1 = jedis.hincrBy(key, field, incr);
+    assertTrue(response1 == incr);
+
+    long response2 = jedis.hincrBy(randString(), randString(), incr);
+    assertTrue(response2 == incr);
+
+    long response3 = jedis.hincrBy(key, field, incr);
+    assertTrue(response3 == 2*incr);
+
+
+    String field1 = randString();
+    Exception ex = null;
+    try {
+      jedis.hincrBy(key, field1, Long.MAX_VALUE);
+      jedis.hincrBy(key, field1, incr);
+    } catch (Exception e) {
+      ex = e;
+    }
+
+    assertNotNull(ex);
+  }
+
+  private String randString() {
+    int length = rand.nextInt(8) + 5;
+    StringBuilder rString = new StringBuilder();
+    for (int i = 0; i < length; i++)
+      rString.append((char) (rand.nextInt(57) + 65));
+    return rString.toString();
+    //return Long.toHexString(Double.doubleToLongBits(Math.random()));
+  }
+
+  @After
+  public void flushAll() {
+    jedis.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+    cache.close();
+    server.shutdown();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ListsJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ListsJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ListsJUnitTest.java
new file mode 100755
index 0000000..6a00775
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/ListsJUnitTest.java
@@ -0,0 +1,238 @@
+package com.gemstone.gemfire.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import redis.clients.jedis.Jedis;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class ListsJUnitTest {
+
+  private static Jedis jedis;
+  private static GemFireRedisServer server;
+  private static GemFireCache cache;
+  private static Random rand;
+  private static int port = 6379;
+
+  @BeforeClass
+  public static void setUp() throws IOException {
+    rand = new Random();
+    CacheFactory cf = new CacheFactory();
+    //cf.set("log-file", "redis.log");
+    cf.set("log-level", "error");
+    cf.set("mcast-port", "0");
+    cf.set("locators", "");
+    cache = cf.create();
+    port = AvailablePortHelper.getRandomAvailableTCPPort();
+    server = new GemFireRedisServer("localhost", port);
+
+    server.start();
+    jedis = new Jedis("localhost", port, 10000000);
+  }
+
+  @Test
+  public void testLindex() {
+    int elements = 50;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.rpush(key, stringArray);
+    
+
+    for (int i = 0; i < elements; i++) {
+      String gemString = jedis.lindex(key, i);
+      String s = strings.get(i);
+      assertEquals(gemString, s);
+    }
+  }
+
+  @Test
+  public void testLPopRPush() {
+    int elements = 50;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.rpush(key, stringArray);
+
+    for (int i = 0; i < elements; i++) {
+      String gemString = jedis.lpop(key);
+      String s = strings.get(i);
+      assertEquals(s, gemString);
+    }
+  }
+
+  @Test
+  public void testRPopLPush() {
+    int elements = 500;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.lpush(key, stringArray);
+
+    for (int i = 0; i < elements; i++) {
+      String gemString = jedis.rpop(key);
+      String s = strings.get(i);
+      assertEquals(gemString, s);
+    }
+
+  }
+
+  @Test
+  public void testLRange() {
+    int elements = 10;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.rpush(key, stringArray);
+
+    for (int i = 0; i < elements; i++) {
+      List<String> range = jedis.lrange(key, 0, i);
+      assertEquals(range, strings.subList(0, i+1));
+    }
+
+    for (int i = 0; i < elements; i++) {
+      List<String> range = jedis.lrange(key, i, -1);
+      assertEquals(range, strings.subList(i, strings.size()));
+    }
+  }
+
+  @Test
+  public void testLTrim() {
+    int elements = 5;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.rpush(key, stringArray);
+    // Take off last element one at a time
+    for (int i = elements - 1; i >= 0; i--) {
+      jedis.ltrim(key, 0, i);
+      List<String> range = jedis.lrange(key, 0, -1);
+      assertEquals(range, strings.subList(0, i+1));
+    }
+    jedis.rpop(key);
+    jedis.rpush(key, stringArray);
+    // Take off first element one at a time
+    for (int i = 1; i < elements; i++) {
+      jedis.ltrim(key, 1, -1);
+      List<String> range = jedis.lrange(key, 0, -1);
+      List<String> expected = strings.subList(i, strings.size());
+      assertEquals(range, expected);
+    }
+  }
+
+  @Test
+  public void testLRPushX() {
+    String key = randString();
+    String otherKey = "Other key";
+    jedis.lpush(key, randString());
+    assertTrue(jedis.lpushx(key, randString()) > 0);
+    assertTrue(jedis.rpushx(key, randString()) > 0);
+
+    assertTrue(jedis.lpushx(otherKey, randString()) == 0);
+    assertTrue(jedis.rpushx(otherKey, randString()) == 0);
+
+    jedis.del(key);
+
+    assertTrue(jedis.lpushx(key, randString()) == 0);
+    assertTrue(jedis.rpushx(key, randString()) == 0);
+  }
+
+  @Test
+  public void testLRem() {
+    int elements = 5;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.rpush(key, stringArray);
+
+    for (int i = 0; i < elements; i++) {
+      String remove = strings.remove(0);
+      jedis.lrem(key, 0, remove);
+      List<String> range = jedis.lrange(key, 0, -1);
+      assertEquals(strings, range);
+    }
+  }
+
+  @Test
+  public void testLSet() {
+    int elements = 10;
+    ArrayList<String> strings = new ArrayList<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.rpush(key, stringArray);
+
+    for (int i = 0; i < elements; i++) {
+      String s = randString();
+      strings.set(i, s);
+      jedis.lset(key, i, s);
+      List<String> range = jedis.lrange(key, 0, -1);
+      assertEquals(range, strings);
+    }
+  }
+
+  private String randString() {
+    int length = rand.nextInt(8) + 5;
+    StringBuilder rString = new StringBuilder();
+    for (int i = 0; i < length; i++)
+      rString.append((char) (rand.nextInt(57) + 65));
+    //return rString.toString();
+    return Long.toHexString(Double.doubleToLongBits(Math.random()));
+  }
+
+  @After
+  public void flushAll() {
+    jedis.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+    cache.close();
+    server.shutdown();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
new file mode 100644
index 0000000..858321d
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
@@ -0,0 +1,231 @@
+package com.gemstone.gemfire.redis;
+
+import java.util.Random;
+
+import redis.clients.jedis.Jedis;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+
+import dunit.AsyncInvocation;
+import dunit.Host;
+import dunit.SerializableCallable;
+import dunit.VM;
+
+public class RedisDistDUnitTest extends CacheTestCase {
+
+  public static final String TEST_KEY = "key";
+  public static int pushes = 200;
+  int redisPort = 6379;
+  private Host host;
+  private VM server1;
+  private VM server2;
+  private VM client1;
+  private VM client2;
+
+  private int server1Port;
+  private int server2Port;
+
+  private abstract class ClientTestBase extends SerializableCallable {
+
+    int port;
+    protected ClientTestBase (int port) {
+      this.port = port;
+    }
+
+  }
+
+  public RedisDistDUnitTest() throws Throwable {
+    super("RedisDistTest");  
+  }
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    disconnectAllFromDS();
+    host = Host.getHost(0);
+    server1 = host.getVM(0);
+    server2 = host.getVM(1);
+    client1 = host.getVM(2);
+    client2 = host.getVM(3);  
+    final SerializableCallable<Object> startRedisAdapter = new SerializableCallable<Object>() {
+
+      private static final long serialVersionUID = 1978017907725504294L;
+
+      @Override
+      public Object call() throws Exception {
+        int port = AvailablePortHelper.getRandomAvailableTCPPort();
+        CacheFactory cF = new CacheFactory();
+        cF.set("log-level", "info");
+        cF.set("redis-bind-address", "localhost");
+        cF.set("redis-port", ""+port);
+        cF.set("mcast-port", "40404");
+        cF.create();
+        return Integer.valueOf(port);
+      }
+    };
+    AsyncInvocation i = server1.invokeAsync(startRedisAdapter);
+    server2Port = (Integer) server2.invoke(startRedisAdapter);
+    try {
+      server1Port = (Integer) i.getResult();
+    } catch (Throwable e) {
+      throw new Exception(e);
+    }
+  }
+
+  @Override
+  public void tearDown2() throws Exception {
+    super.tearDown2();
+    disconnectAllFromDS();
+  }
+
+  public void testConcListOps() throws Throwable {
+    final Jedis jedis1 = new Jedis("localhost", server1Port, 10000);
+    final Jedis jedis2 = new Jedis("localhost", server2Port, 10000);
+    final int pushes = 20;
+    class ConcListOps extends ClientTestBase {
+      protected ConcListOps(int port) {
+        super(port);
+      }
+
+      @Override
+      public Object call() throws Exception {
+        Jedis jedis = new Jedis("localhost", port, 10000);
+        Random r = new Random();
+        for (int i = 0; i < pushes; i++) {
+          if (r.nextBoolean()) {
+            jedis.lpush(TEST_KEY, randString());
+          } else {
+            jedis.rpush(TEST_KEY, randString());
+          }
+        }
+        return null;
+      }
+    };
+
+    AsyncInvocation i = client1.invokeAsync(new ConcListOps(server1Port));
+    client2.invoke(new ConcListOps(server2Port));
+    i.getResult();
+    long expected = 2 * pushes;
+    long result1 = jedis1.llen(TEST_KEY);
+    long result2 = jedis2.llen(TEST_KEY);
+    assertEquals(expected, result1);
+    assertEquals(result1, result2);
+  }
+
+
+  public void testConcCreateDestroy() throws Throwable {
+    final int ops = 40;
+    final String hKey = TEST_KEY+"hash";
+    final String lKey = TEST_KEY+"list";
+    final String zKey = TEST_KEY+"zset";
+    final String sKey = TEST_KEY+"set";
+
+    class ConcCreateDestroy extends ClientTestBase{
+      protected ConcCreateDestroy(int port) {
+        super(port);
+      }
+
+      @Override
+      public Object call() throws Exception {
+        Jedis jedis = new Jedis("localhost", port, 10000);
+        Random r = new Random();
+        for (int i = 0; i < ops; i++) {
+          int n = r.nextInt(4);
+          if (n == 0) {
+            if (r.nextBoolean()) {
+              jedis.hset(hKey, randString(), randString());
+            } else {
+              jedis.del(hKey);
+            }
+          } else if (n == 1) {
+            if (r.nextBoolean()) {
+              jedis.lpush(lKey, randString());
+            } else {
+              jedis.del(lKey);
+            }
+          } else if (n == 2) {
+            if (r.nextBoolean()) {
+              jedis.zadd(zKey, r.nextDouble(), randString());
+            } else {
+              jedis.del(zKey);
+            }
+          } else {
+            if (r.nextBoolean()) {
+              jedis.sadd(sKey, randString());
+            } else {
+              jedis.del(sKey);
+            }
+          }
+        }
+        return null;
+      }
+    }
+
+    // Expect to run with no exception
+    AsyncInvocation i = client1.invokeAsync(new ConcCreateDestroy(server1Port));
+    client2.invoke(new ConcCreateDestroy(server2Port));
+    i.getResult();
+  }
+
+  /**
+   * Just make sure there are no unexpected server crashes
+   * @throws Throwable 
+   */
+  public void testConcOps() throws Throwable {
+
+    final int ops = 100;
+    final String hKey = TEST_KEY+"hash";
+    final String lKey = TEST_KEY+"list";
+    final String zKey = TEST_KEY+"zset";
+    final String sKey = TEST_KEY+"set";
+
+    class ConcOps extends ClientTestBase {
+
+      protected ConcOps(int port) {
+        super(port);
+      }
+
+      @Override
+      public Object call() throws Exception {
+        Jedis jedis = new Jedis("localhost", port, 10000);
+        Random r = new Random();
+        for (int i = 0; i < ops; i++) {
+          int n = r.nextInt(4);
+          if (n == 0) {
+            jedis.hset(hKey, randString(), randString());
+            jedis.hgetAll(hKey);
+            jedis.hvals(hKey);
+          } else if (n == 1) {
+            jedis.lpush(lKey, randString());
+            jedis.rpush(lKey, randString());
+            jedis.ltrim(lKey, 0, 100);
+            jedis.lrange(lKey, 0, -1);
+          } else if (n == 2) {
+            jedis.zadd(zKey, r.nextDouble(), randString());
+            jedis.zrangeByLex(zKey, "(a", "[z");
+            jedis.zrangeByScoreWithScores(zKey, 0, 1, 0, 100);
+            jedis.zremrangeByScore(zKey, r.nextDouble(), r.nextDouble());
+          } else {
+            jedis.sadd(sKey, randString());
+            jedis.smembers(sKey);
+            jedis.sdiff(sKey, "afd");
+            jedis.sunionstore("dst", sKey, "afds");
+          }
+        }
+        return null;
+      }
+    }
+
+    // Expect to run with no exception
+    AsyncInvocation i = client1.invokeAsync(new ConcOps(server1Port));
+    client2.invoke(new ConcOps(server2Port));
+    i.getResult();
+  }
+
+  private String randString() {
+    return Long.toHexString(Double.doubleToLongBits(Math.random()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1a6a0ef5/gemfire-core/src/test/java/com/gemstone/gemfire/redis/SetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/SetsJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/SetsJUnitTest.java
new file mode 100755
index 0000000..abc6060
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/SetsJUnitTest.java
@@ -0,0 +1,242 @@
+package com.gemstone.gemfire.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import redis.clients.jedis.Jedis;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class SetsJUnitTest {
+
+  private static Jedis jedis;
+  private static GemFireRedisServer server;
+  private static GemFireCache cache;
+  private static Random rand;
+  private static int port = 6379;
+
+  @BeforeClass
+  public static void setUp() throws IOException {
+    rand = new Random();
+    CacheFactory cf = new CacheFactory();
+    //cf.set("log-file", "redis.log");
+    cf.set("log-level", "error");
+    cf.set("mcast-port", "0");
+    cf.set("locators", "");
+    cache = cf.create();
+    port = AvailablePortHelper.getRandomAvailableTCPPort();
+    server = new GemFireRedisServer("localhost", port);
+
+    server.start();
+    jedis = new Jedis("localhost", port, 10000000);
+  }
+
+  @Test
+  public void testSAddScard() {
+    int elements = 10;
+    Set<String> strings = new HashSet<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    Long response = jedis.sadd(key, stringArray);
+    assertEquals(response, new Long(strings.size()));
+
+    assertEquals(jedis.scard(key), new Long(strings.size()));
+  }
+
+  @Test
+  public void testSMembersIsMember() {
+    int elements = 10;
+    Set<String> strings = new HashSet<String>();
+    String key = randString();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.sadd(key, stringArray);
+
+    Set<String> returnedSet = jedis.smembers(key);
+
+    assertEquals(returnedSet, new HashSet<String>(strings));
+
+    for (String entry: strings) {
+      boolean exists = jedis.sismember(key, entry);
+      assertTrue(exists);
+    }
+  }
+
+  @Test
+  public void testSMove() {
+    String source = randString();
+    String dest = randString();
+    String test = randString();
+    int elements = 10;
+    Set<String> strings = new HashSet<String>();
+    for (int i = 0; i < elements; i++) {
+      String elem = randString();
+      strings.add(elem);
+    }
+    String[] stringArray = strings.toArray(new String[strings.size()]);
+    jedis.sadd(source, stringArray);
+
+    long i = 1;
+    for (String entry: strings) {
+      assertTrue(jedis.smove(source, dest, entry) == 1);
+      assertTrue(jedis.sismember(dest, entry));
+      assertTrue(jedis.scard(source) == strings.size() - i);
+      assertTrue(jedis.scard(dest) == i);
+      i++;
+    }
+
+    assertTrue(jedis.smove(test, dest, randString()) == 0);
+  }
+
+  @Test
+  public void testSDiffAndStore() {
+    int numSets = 3;
+    int elements = 10;
+    String[] keys = new String[numSets];
+    ArrayList<Set<String>> sets = new ArrayList<Set<String>>();
+    for (int j = 0; j < numSets; j++) {
+      keys[j] = randString();
+      Set<String> newSet = new HashSet<String>();
+      for (int i = 0; i < elements; i++)
+        newSet.add(randString());
+      sets.add(newSet);
+    }
+    
+    for (int i = 0; i < numSets; i++) {
+      Set<String> s = sets.get(i);
+      String[] stringArray = s.toArray(new String[s.size()]);
+      jedis.sadd(keys[i], stringArray);
+    }
+    
+    Set<String> result = sets.get(0);
+    for (int i = 1; i < numSets; i++)
+      result.removeAll(sets.get(i));
+    
+    assertEquals(result, jedis.sdiff(keys));
+    
+    String destination = randString();
+    
+    jedis.sdiffstore(destination, keys);
+    
+    Set<String> destResult = jedis.smembers(destination);
+    
+    assertEquals(result, destResult);
+    
+  }
+  
+  @Test
+  public void testSUnionAndStore() {
+    int numSets = 3;
+    int elements = 10;
+    String[] keys = new String[numSets];
+    ArrayList<Set<String>> sets = new ArrayList<Set<String>>();
+    for (int j = 0; j < numSets; j++) {
+      keys[j] = randString();
+      Set<String> newSet = new HashSet<String>();
+      for (int i = 0; i < elements; i++)
+        newSet.add(randString());
+      sets.add(newSet);
+    }
+    
+    for (int i = 0; i < numSets; i++) {
+      Set<String> s = sets.get(i);
+      String[] stringArray = s.toArray(new String[s.size()]);
+      jedis.sadd(keys[i], stringArray);
+    }
+    
+    Set<String> result = sets.get(0);
+    for (int i = 1; i < numSets; i++)
+      result.addAll(sets.get(i));
+    
+    assertEquals(result, jedis.sunion(keys));
+    
+    String destination = randString();
+    
+    jedis.sunionstore(destination, keys);
+    
+    Set<String> destResult = jedis.smembers(destination);
+    
+    assertEquals(result, destResult);
+    
+  }
+  
+  @Test
+  public void testSInterAndStore() {
+    int numSets = 3;
+    int elements = 10;
+    String[] keys = new String[numSets];
+    ArrayList<Set<String>> sets = new ArrayList<Set<String>>();
+    for (int j = 0; j < numSets; j++) {
+      keys[j] = randString();
+      Set<String> newSet = new HashSet<String>();
+      for (int i = 0; i < elements; i++)
+        newSet.add(randString());
+      sets.add(newSet);
+    }
+    
+    for (int i = 0; i < numSets; i++) {
+      Set<String> s = sets.get(i);
+      String[] stringArray = s.toArray(new String[s.size()]);
+      jedis.sadd(keys[i], stringArray);
+    }
+    
+    Set<String> result = sets.get(0);
+    for (int i = 1; i < numSets; i++)
+      result.retainAll(sets.get(i));
+    
+    assertEquals(result, jedis.sinter(keys));
+    
+    String destination = randString();
+    
+    jedis.sinterstore(destination, keys);
+    
+    Set<String> destResult = jedis.smembers(destination);
+    
+    assertEquals(result, destResult);
+    
+  }
+
+  private String randString() {
+    int length = rand.nextInt(8) + 5;
+    StringBuilder rString = new StringBuilder();
+    for (int i = 0; i < length; i++)
+      rString.append((char) (rand.nextInt(57) + 65));
+    return rString.toString();
+    //return Long.toHexString(Double.doubleToLongBits(Math.random()));
+  }
+
+  @After
+  public void flushAll() {
+    jedis.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+    cache.close();
+    server.shutdown();
+  }
+}