You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2017/02/10 21:34:04 UTC

[01/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2449 [created] c6dbc6d4e


http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index c0fdb6e..25a9cff 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -27,6 +27,7 @@ include 'geode-pulse'
 include 'geode-assembly'
 include 'geode-rebalancer'
 include 'geode-lucene'
+include 'geode-redis'
 include 'geode-old-client-support'
 include 'geode-wan'
 include 'geode-cq'
@@ -42,3 +43,4 @@ include 'extensions/geode-modules-assembly'
 if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion)) {
   throw new GradleException('Running with unsupported Gradle Version. Use Gradle Wrapper or with Gradle version >= ' + minimumGradleVersion)
 }
+


[17/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataType.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataType.java
deleted file mode 100755
index 63a15df..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataType.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.GeodeRedisServer;
-
-/**
- * The RedisDataType enum contains the choices to which every {@link Region} on the server must be.
- * There is only one instance of {@link #REDIS_STRING} and {@link #REDIS_PROTECTED} defined by
- * {@link GeodeRedisServer#STRING_REGION} and {@link GeodeRedisServer#REDIS_META_DATA_REGION}
- * respectively.
- * <p>
- * The data types are:
- * <li>{@link RedisDataType#REDIS_STRING}</li>
- * <li>{@link RedisDataType#REDIS_HASH}</li>
- * <li>{@link RedisDataType#REDIS_LIST}</li>
- * <li>{@link RedisDataType#REDIS_SET}</li>
- * <li>{@link RedisDataType#REDIS_SORTEDSET}</li>
- * <li>{@link RedisDataType#REDIS_PROTECTED}</li>
- *
- */
-public enum RedisDataType {
-  /**
-   * Strings Regions
-   */
-  REDIS_STRING {
-    @Override
-    public String toString() {
-      return "string";
-    }
-  },
-
-  /**
-   * Hashes Regions
-   */
-  REDIS_HASH {
-    @Override
-    public String toString() {
-      return "hash";
-    }
-  },
-
-  /**
-   * Lists Regions
-   */
-  REDIS_LIST {
-    @Override
-    public String toString() {
-      return "list";
-    }
-  },
-
-  /**
-   * Sets Regions
-   */
-  REDIS_SET {
-    @Override
-    public String toString() {
-      return "set";
-    }
-  },
-
-  /**
-   * SortedSets Regions
-   */
-  REDIS_SORTEDSET {
-    @Override
-    public String toString() {
-      return "zset";
-    }
-  },
-
-  /**
-   * HyperLogLog Regions
-   */
-  REDIS_HLL {
-    @Override
-    public String toString() {
-      return "hyperloglog";
-    }
-  },
-
-  /**
-   * Regions protected from overwrite or deletion
-   */
-  REDIS_PROTECTED {
-    @Override
-    public String toString() {
-      return "protected";
-    }
-  },
-
-  /**
-   * None
-   */
-  NONE {
-    @Override
-    public String toString() {
-      return "none";
-    }
-  };
-
-};

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java
deleted file mode 100755
index 727412b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-/**
- * This exception is for the case that a client attempts to operate on a data structure of one
- * {@link RedisDataType} with a command that is of another type
- * 
- *
- */
-public class RedisDataTypeMismatchException extends RuntimeException {
-
-  private static final long serialVersionUID = -2451663685348513870L;
-
-  public RedisDataTypeMismatchException() {
-    super();
-  }
-
-  public RedisDataTypeMismatchException(String message) {
-    super(message);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java
deleted file mode 100644
index afc009e..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-/**
- * This exception is used when an error happens while creating a
- * {@link org.apache.geode.cache.Region} globally
- * 
- *
- */
-public class RegionCreationException extends RuntimeException {
-
-  public RegionCreationException() {}
-
-  public RegionCreationException(String err) {
-    super(err);
-  }
-
-  public RegionCreationException(String err, Throwable cause) {
-    super(err, cause);
-  }
-
-  private static final long serialVersionUID = 8416820139078312997L;
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RegionProvider.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
deleted file mode 100644
index 5994d7d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import java.io.Closeable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.TransactionId;
-import org.apache.geode.cache.query.IndexExistsException;
-import org.apache.geode.cache.query.IndexInvalidException;
-import org.apache.geode.cache.query.IndexNameConflictException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvalidException;
-import org.apache.geode.cache.query.QueryService;
-import org.apache.geode.cache.query.RegionNotFoundException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.redis.internal.executor.ExpirationExecutor;
-import org.apache.geode.redis.internal.executor.ListQuery;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-import org.apache.geode.internal.hll.HyperLogLogPlus;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.cli.Result.Status;
-import org.apache.geode.management.internal.cli.commands.CreateAlterDestroyRegionCommands;
-import org.apache.geode.redis.GeodeRedisServer;
-
-/**
- * This class stands between {@link Executor} and {@link Cache#getRegion(String)}. This is needed
- * because some keys for Redis represented as a {@link Region} in {@link GeodeRedisServer} come with
- * additional state. Therefore getting, creating, or destroying a {@link Region} needs to be
- * synchronized, which is done away with and abstracted by this class.
- * 
- *
- */
-public class RegionProvider implements Closeable {
-
-  private final ConcurrentHashMap<ByteArrayWrapper, Region<?, ?>> regions;
-
-  /**
-   * This is the Redis meta data {@link Region} that holds the {@link RedisDataType} information for
-   * all Regions created. The mapping is a {@link String} key which is the name of the
-   * {@link Region} created to hold the data to the RedisDataType it contains.
-   */
-  private final Region<String, RedisDataType> redisMetaRegion;
-
-  /**
-   * This is the {@link RedisDataType#REDIS_STRING} {@link Region}. This is the Region that stores
-   * all string contents
-   */
-  private final Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion;
-
-  /**
-   * This is the {@link RedisDataType#REDIS_HLL} {@link Region}. This is the Region that stores all
-   * HyperLogLog contents
-   */
-  private final Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion;
-
-  private final Cache cache;
-  private final QueryService queryService;
-  private final ConcurrentMap<ByteArrayWrapper, Map<Enum<?>, Query>> preparedQueries =
-      new ConcurrentHashMap<ByteArrayWrapper, Map<Enum<?>, Query>>();
-  private final ConcurrentMap<ByteArrayWrapper, ScheduledFuture<?>> expirationsMap;
-  private final ScheduledExecutorService expirationExecutor;
-  private final RegionShortcut defaultRegionType;
-  private static final CreateAlterDestroyRegionCommands cliCmds =
-      new CreateAlterDestroyRegionCommands();
-  private final ConcurrentHashMap<String, Lock> locks;
-
-  public RegionProvider(Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion,
-      Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion,
-      Region<String, RedisDataType> redisMetaRegion,
-      ConcurrentMap<ByteArrayWrapper, ScheduledFuture<?>> expirationsMap,
-      ScheduledExecutorService expirationExecutor, RegionShortcut defaultShortcut) {
-    if (stringsRegion == null || hLLRegion == null || redisMetaRegion == null)
-      throw new NullPointerException();
-    this.regions = new ConcurrentHashMap<ByteArrayWrapper, Region<?, ?>>();
-    this.stringsRegion = stringsRegion;
-    this.hLLRegion = hLLRegion;
-    this.redisMetaRegion = redisMetaRegion;
-    this.cache = GemFireCacheImpl.getInstance();
-    this.queryService = cache.getQueryService();
-    this.expirationsMap = expirationsMap;
-    this.expirationExecutor = expirationExecutor;
-    this.defaultRegionType = defaultShortcut;
-    this.locks = new ConcurrentHashMap<String, Lock>();
-  }
-
-  public boolean existsKey(ByteArrayWrapper key) {
-    return this.redisMetaRegion.containsKey(key.toString());
-  }
-
-  public Set<String> metaKeySet() {
-    return this.redisMetaRegion.keySet();
-  }
-
-  public Set<Map.Entry<String, RedisDataType>> metaEntrySet() {
-    return this.redisMetaRegion.entrySet();
-  }
-
-  public int getMetaSize() {
-    return this.redisMetaRegion.size() - RedisConstants.NUM_DEFAULT_KEYS;
-  }
-
-  private boolean metaRemoveEntry(ByteArrayWrapper key) {
-    return this.redisMetaRegion.remove(key.toString()) != null;
-  }
-
-  public RedisDataType metaPutIfAbsent(ByteArrayWrapper key, RedisDataType value) {
-    return this.redisMetaRegion.putIfAbsent(key.toString(), value);
-  }
-
-  public RedisDataType metaPut(ByteArrayWrapper key, RedisDataType value) {
-    return this.redisMetaRegion.put(key.toString(), value);
-  }
-
-  public RedisDataType metaGet(ByteArrayWrapper key) {
-    return this.redisMetaRegion.get(key.toString());
-  }
-
-  public Region<?, ?> getRegion(ByteArrayWrapper key) {
-    return this.regions.get(key);
-  }
-
-  public void removeRegionReferenceLocally(ByteArrayWrapper key, RedisDataType type) {
-    Lock lock = this.locks.get(key.toString());
-    boolean locked = false;
-    try {
-      locked = lock.tryLock();
-      // If we cannot get the lock we ignore this remote event, this key has local event
-      // that started independently, ignore this event to prevent deadlock
-      if (locked) {
-        cancelKeyExpiration(key);
-        removeRegionState(key, type);
-      }
-    } finally {
-      if (locked) {
-        lock.unlock();
-      }
-    }
-  }
-
-  public boolean removeKey(ByteArrayWrapper key) {
-    RedisDataType type = getRedisDataType(key);
-    return removeKey(key, type);
-  }
-
-  public boolean removeKey(ByteArrayWrapper key, RedisDataType type) {
-    return removeKey(key, type, true);
-  }
-
-  public boolean removeKey(ByteArrayWrapper key, RedisDataType type, boolean cancelExpiration) {
-    if (type == null || type == RedisDataType.REDIS_PROTECTED)
-      return false;
-    Lock lock = this.locks.get(key.toString());
-    try {
-      if (lock != null) {// Strings/hlls will not have locks
-        lock.lock();
-      }
-      metaRemoveEntry(key);
-      try {
-        if (type == RedisDataType.REDIS_STRING) {
-          return this.stringsRegion.remove(key) != null;
-        } else if (type == RedisDataType.REDIS_HLL) {
-          return this.hLLRegion.remove(key) != null;
-        } else {
-          return destroyRegion(key, type);
-        }
-      } catch (Exception exc) {
-        return false;
-      } finally {
-        if (cancelExpiration)
-          cancelKeyExpiration(key);
-        else
-          removeKeyExpiration(key);
-        if (lock != null)
-          this.locks.remove(key.toString());
-      }
-    } finally {
-      if (lock != null) {
-        lock.unlock();
-      }
-    }
-  }
-
-  public Region<?, ?> getOrCreateRegion(ByteArrayWrapper key, RedisDataType type,
-      ExecutionHandlerContext context) {
-    return getOrCreateRegion0(key, type, context, true);
-  }
-
-  public void createRemoteRegionReferenceLocally(ByteArrayWrapper key, RedisDataType type) {
-    if (type == null || type == RedisDataType.REDIS_STRING || type == RedisDataType.REDIS_HLL)
-      return;
-    Region<?, ?> r = this.regions.get(key);
-    if (r != null)
-      return;
-    if (!this.regions.contains(key)) {
-      String stringKey = key.toString();
-      Lock lock = this.locks.get(stringKey);
-      if (lock == null) {
-        this.locks.putIfAbsent(stringKey, new ReentrantLock());
-        lock = this.locks.get(stringKey);
-      }
-      boolean locked = false;
-      try {
-        locked = lock.tryLock();
-        // If we cannot get the lock then this remote event may have been initialized
-        // independently on this machine, so if we wait on the lock it is more than
-        // likely we will deadlock just to do the same task. This event can be ignored
-        if (locked) {
-          r = cache.getRegion(key.toString());
-          // If r is null, this implies that we are after a create/destroy
-          // simply ignore. Calls to getRegion or getOrCreate will work correctly
-          if (r == null)
-            return;
-
-          if (type == RedisDataType.REDIS_LIST) {
-            doInitializeList(key, r);
-          } else if (type == RedisDataType.REDIS_SORTEDSET) {
-            try {
-              doInitializeSortedSet(key, r);
-            } catch (RegionNotFoundException | IndexInvalidException e) {
-              // ignore
-            }
-          }
-          this.regions.put(key, r);
-        }
-      } finally {
-        if (locked) {
-          lock.unlock();
-        }
-      }
-    }
-  }
-
-  private Region<?, ?> getOrCreateRegion0(ByteArrayWrapper key, RedisDataType type,
-      ExecutionHandlerContext context, boolean addToMeta) {
-    checkDataType(key, type);
-    Region<?, ?> r = this.regions.get(key);
-    if (r != null && r.isDestroyed()) {
-      removeKey(key, type);
-      r = null;
-    }
-    if (r == null) {
-      String stringKey = key.toString();
-      Lock lock = this.locks.get(stringKey);
-      if (lock == null) {
-        this.locks.putIfAbsent(stringKey, new ReentrantLock());
-        lock = this.locks.get(stringKey);
-      }
-
-      try {
-        lock.lock();
-        r = regions.get(key);
-        if (r == null) {
-          boolean hasTransaction = context != null && context.hasTransaction(); // Can create
-                                                                                // without context
-          CacheTransactionManager txm = null;
-          TransactionId transactionId = null;
-          try {
-            if (hasTransaction) {
-              txm = cache.getCacheTransactionManager();
-              transactionId = txm.suspend();
-            }
-            Exception concurrentCreateDestroyException = null;
-            do {
-              concurrentCreateDestroyException = null;
-              r = createRegionGlobally(stringKey);
-              try {
-                if (type == RedisDataType.REDIS_LIST) {
-                  doInitializeList(key, r);
-                } else if (type == RedisDataType.REDIS_SORTEDSET) {
-                  try {
-                    doInitializeSortedSet(key, r);
-                  } catch (RegionNotFoundException | IndexInvalidException e) {
-                    concurrentCreateDestroyException = e;
-                  }
-                }
-              } catch (QueryInvalidException e) {
-                if (e.getCause() instanceof RegionNotFoundException) {
-                  concurrentCreateDestroyException = e;
-                }
-              }
-            } while (concurrentCreateDestroyException != null);
-            this.regions.put(key, r);
-            if (addToMeta) {
-              RedisDataType existingType = metaPutIfAbsent(key, type);
-              if (existingType != null && existingType != type)
-                throw new RedisDataTypeMismatchException(
-                    "The key name \"" + key + "\" is already used by a " + existingType.toString());
-            }
-          } finally {
-            if (hasTransaction)
-              txm.resume(transactionId);
-          }
-        }
-      } finally {
-        lock.unlock();
-      }
-    }
-    return r;
-  }
-
-  /**
-   * SYNCHRONIZE EXTERNALLY OF this.locks.get(key.toString())!!!!!
-   * 
-   * @param key Key of region to destroy
-   * @param type Type of region to destroyu
-   * @return Flag if destroyed
-   */
-  private boolean destroyRegion(ByteArrayWrapper key, RedisDataType type) {
-    Region<?, ?> r = this.regions.get(key);
-    if (r != null) {
-      try {
-        r.destroyRegion();
-      } catch (Exception e) {
-        return false;
-      } finally {
-        removeRegionState(key, type);
-      }
-    }
-    return true;
-  }
-
-  /**
-   * Do not call this method if you are not synchronized on the lock associated with this key
-   * 
-   * @param key Key of region to remove
-   * @param type Type of key to remove all state
-   */
-  private void removeRegionState(ByteArrayWrapper key, RedisDataType type) {
-    this.preparedQueries.remove(key);
-    this.regions.remove(key);
-  }
-
-  private void doInitializeSortedSet(ByteArrayWrapper key, Region<?, ?> r)
-      throws RegionNotFoundException, IndexInvalidException {
-    String fullpath = r.getFullPath();
-    try {
-      queryService.createIndex("scoreIndex", "entry.value.score",
-          r.getFullPath() + ".entrySet entry");
-      queryService.createIndex("scoreIndex2", "value.score", r.getFullPath() + ".values value");
-    } catch (IndexNameConflictException | IndexExistsException | UnsupportedOperationException e) {
-      // ignore, these indexes already exist or unsupported but make sure prepared queries are made
-    }
-    HashMap<Enum<?>, Query> queryList = new HashMap<Enum<?>, Query>();
-    for (SortedSetQuery lq : SortedSetQuery.values()) {
-      String queryString = lq.getQueryString(fullpath);
-      Query query = this.queryService.newQuery(queryString);
-      queryList.put(lq, query);
-    }
-    this.preparedQueries.put(key, queryList);
-  }
-
-  private void doInitializeList(ByteArrayWrapper key, Region r) {
-    r.put("head", Integer.valueOf(0));
-    r.put("tail", Integer.valueOf(0));
-    String fullpath = r.getFullPath();
-    HashMap<Enum<?>, Query> queryList = new HashMap<Enum<?>, Query>();
-    for (ListQuery lq : ListQuery.values()) {
-      String queryString = lq.getQueryString(fullpath);
-      Query query = this.queryService.newQuery(queryString);
-      queryList.put(lq, query);
-    }
-    this.preparedQueries.put(key, queryList);
-  }
-
-  /**
-   * This method creates a Region globally with the given name. If there is an error in the
-   * creation, a runtime exception will be thrown.
-   * 
-   * @param key Name of Region to create
-   * @return Region Region created globally
-   */
-  private Region<?, ?> createRegionGlobally(String key) {
-    Region<?, ?> r = null;
-    r = cache.getRegion(key);
-    if (r != null)
-      return r;
-    do {
-      Result result = cliCmds.createRegion(key, defaultRegionType, null, null, true, null, null,
-          null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-          null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-          null, null);
-      r = cache.getRegion(key);
-      if (result.getStatus() == Status.ERROR && r == null) {
-        String err = "";
-        while (result.hasNextLine())
-          err += result.nextLine();
-        throw new RegionCreationException(err);
-      }
-    } while (r == null); // The region can be null in the case that it is concurrently destroyed by
-    // a remote even triggered internally by Geode
-    return r;
-  }
-
-  public Query getQuery(ByteArrayWrapper key, Enum<?> query) {
-    return this.preparedQueries.get(key).get(query);
-    /*
-     * if (query instanceof ListQuery) { return
-     * this.queryService.newQuery(((ListQuery)query).getQueryString(this.regions.get(key).
-     * getFullPath())); } else { return
-     * this.queryService.newQuery(((SortedSetQuery)query).getQueryString(this.regions.get(key).
-     * getFullPath())); }
-     */
-  }
-
-  /**
-   * Checks if the given key is associated with the passed data type. If there is a mismatch, a
-   * {@link RuntimeException} is thrown
-   * 
-   * @param key Key to check
-   * @param type Type to check to
-   */
-  protected void checkDataType(ByteArrayWrapper key, RedisDataType type) {
-    RedisDataType currentType = redisMetaRegion.get(key.toString());
-    if (currentType == null)
-      return;
-    if (currentType == RedisDataType.REDIS_PROTECTED)
-      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
-    if (currentType != type)
-      throw new RedisDataTypeMismatchException(
-          "The key name \"" + key + "\" is already used by a " + currentType.toString());
-  }
-
-  public boolean regionExists(ByteArrayWrapper key) {
-    return this.regions.containsKey(key);
-  }
-
-  public Region<ByteArrayWrapper, ByteArrayWrapper> getStringsRegion() {
-    return this.stringsRegion;
-  }
-
-  public Region<ByteArrayWrapper, HyperLogLogPlus> gethLLRegion() {
-    return this.hLLRegion;
-  }
-
-  private RedisDataType getRedisDataType(String key) {
-    return this.redisMetaRegion.get(key);
-  }
-
-  public RedisDataType getRedisDataType(ByteArrayWrapper key) {
-    return getRedisDataType(key.toString());
-  }
-
-  /**
-   * Sets the expiration for a key. The setting and modifying of a key expiration can only be set by
-   * a delay, which means that both expiring after a time and at a time can be done but the delay to
-   * expire at a time must be calculated before these calls. It is also important to note that the
-   * delay is always handled in milliseconds
-   * 
-   * @param key The key to set the expiration for
-   * @param delay The delay in milliseconds of the expiration
-   * @return True is expiration set, false otherwise
-   */
-  public final boolean setExpiration(ByteArrayWrapper key, long delay) {
-    RedisDataType type = getRedisDataType(key);
-    if (type == null)
-      return false;
-    ScheduledFuture<?> future = this.expirationExecutor
-        .schedule(new ExpirationExecutor(key, type, this), delay, TimeUnit.MILLISECONDS);
-    this.expirationsMap.put(key, future);
-    return true;
-  }
-
-  /**
-   * Modifies an expiration on a key
-   * 
-   * @param key String key to modify expiration on
-   * @param delay Delay in milliseconds to reset the expiration to
-   * @return True if reset, false if not
-   */
-  public final boolean modifyExpiration(ByteArrayWrapper key, long delay) {
-    /*
-     * Attempt to cancel future task
-     */
-    boolean canceled = cancelKeyExpiration(key);
-
-    if (!canceled)
-      return false;
-
-    RedisDataType type = getRedisDataType(key);
-    if (type == null)
-      return false;
-
-    ScheduledFuture<?> future = this.expirationExecutor
-        .schedule(new ExpirationExecutor(key, type, this), delay, TimeUnit.MILLISECONDS);
-    this.expirationsMap.put(key, future);
-    return true;
-  }
-
-  /**
-   * Removes an expiration from a key
-   * 
-   * @param key Key
-   * @return True is expiration cancelled on the key, false otherwise
-   */
-  public final boolean cancelKeyExpiration(ByteArrayWrapper key) {
-    ScheduledFuture<?> future = expirationsMap.remove(key);
-    if (future == null)
-      return false;
-    return future.cancel(false);
-  }
-
-  private boolean removeKeyExpiration(ByteArrayWrapper key) {
-    return expirationsMap.remove(key) != null;
-  }
-
-  /**
-   * Check method if key has expiration
-   * 
-   * @param key Key
-   * @return True if key has expiration, false otherwise
-   */
-  public boolean hasExpiration(ByteArrayWrapper key) {
-    return this.expirationsMap.containsKey(key);
-  }
-
-  /**
-   * Get remaining expiration time
-   * 
-   * @param key Key
-   * @return Remaining time in milliseconds or 0 if no delay or key doesn't exist
-   */
-  public final long getExpirationDelayMillis(ByteArrayWrapper key) {
-    ScheduledFuture<?> future = this.expirationsMap.get(key);
-    return future != null ? future.getDelay(TimeUnit.MILLISECONDS) : 0L;
-  }
-
-  @Override
-  public void close() {
-    this.preparedQueries.clear();
-  }
-
-  public String dumpRegionsCache() {
-    StringBuilder builder = new StringBuilder();
-    for (Entry<ByteArrayWrapper, Region<?, ?>> e : this.regions.entrySet()) {
-      builder.append(e.getKey() + " --> {" + e.getValue() + "}\n");
-    }
-    return builder.toString();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java
deleted file mode 100755
index c9d47ab..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Executor;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
-import org.apache.geode.redis.internal.RegionProvider;
-import org.apache.geode.redis.GeodeRedisServer;
-
-/**
- * The AbstractExecutor is the base of all {@link Executor} types for the {@link GeodeRedisServer}.
- * 
- *
- */
-public abstract class AbstractExecutor implements Executor {
-
-  /**
-   * Number of Regions used by GeodeRedisServer internally
-   */
-  public static final int NUM_DEFAULT_REGIONS = 3;
-
-  /**
-   * Max length of a list
-   */
-  protected static final Integer INFINITY_LIMIT = Integer.MAX_VALUE;
-
-  /**
-   * Constant of number of milliseconds in a second
-   */
-  protected static final int millisInSecond = 1000;
-
-  /**
-   * Getter method for a {@link Region} in the case that a Region should be created if one with the
-   * given name does not exist. Before getting or creating a Region, a check is first done to make
-   * sure the desired key doesn't already exist with a different {@link RedisDataType}. If there is
-   * a data type mismatch this method will throw a {@link RuntimeException}.
-   * 
-   * ********************** IMPORTANT NOTE ********************************************** This
-   * method will not fail in returning a Region unless an internal error occurs, so if a Region is
-   * destroyed right after it is created, it will attempt to retry until a reference to that Region
-   * is obtained
-   * *************************************************************************************
-   * 
-   * @param context Client client
-   * @param key String key of desired key
-   * @param type Type of data type desired
-   * @return Region with name key
-   */
-  protected Region<?, ?> getOrCreateRegion(ExecutionHandlerContext context, ByteArrayWrapper key,
-      RedisDataType type) {
-    return context.getRegionProvider().getOrCreateRegion(key, type, context);
-  }
-
-  /**
-   * Checks if the given key is associated with the passed data type. If there is a mismatch, a
-   * {@link RuntimeException} is thrown
-   * 
-   * @param key Key to check
-   * @param type Type to check to
-   * @param context context
-   */
-  protected void checkDataType(ByteArrayWrapper key, RedisDataType type,
-      ExecutionHandlerContext context) {
-    RedisDataType currentType = context.getRegionProvider().getRedisDataType(key);
-    if (currentType == null)
-      return;
-    if (currentType == RedisDataType.REDIS_PROTECTED)
-      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
-    if (currentType != type)
-      throw new RedisDataTypeMismatchException(
-          "The key name \"" + key + "\" is already used by a " + currentType.toString());
-  }
-
-  protected Query getQuery(ByteArrayWrapper key, Enum<?> type, ExecutionHandlerContext context) {
-    return context.getRegionProvider().getQuery(key, type);
-  }
-
-  protected boolean removeEntry(ByteArrayWrapper key, RedisDataType type,
-      ExecutionHandlerContext context) {
-    if (type == null || type == RedisDataType.REDIS_PROTECTED)
-      return false;
-    RegionProvider rC = context.getRegionProvider();
-    return rC.removeKey(key, type);
-  }
-
-  protected int getBoundedStartIndex(int index, int size) {
-    if (size < 0)
-      throw new IllegalArgumentException("Size < 0, really?");
-    if (index >= 0)
-      return Math.min(index, size);
-    else
-      return Math.max(index + size, 0);
-  }
-
-  protected int getBoundedEndIndex(int index, int size) {
-    if (size < 0)
-      throw new IllegalArgumentException("Size < 0, really?");
-    if (index >= 0)
-      return Math.min(index, size);
-    else
-      return Math.max(index + size, -1);
-  }
-
-  protected long getBoundedStartIndex(long index, long size) {
-    if (size < 0L)
-      throw new IllegalArgumentException("Size < 0, really?");
-    if (index >= 0L)
-      return Math.min(index, size);
-    else
-      return Math.max(index + size, 0);
-  }
-
-  protected long getBoundedEndIndex(long index, long size) {
-    if (size < 0L)
-      throw new IllegalArgumentException("Size < 0, really?");
-    if (index >= 0L)
-      return Math.min(index, size);
-    else
-      return Math.max(index + size, -1);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
deleted file mode 100755
index 0eb6dca..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.apache.geode.redis.internal.org.apache.hadoop.fs.GlobPattern;
-
-
-public abstract class AbstractScanExecutor extends AbstractExecutor {
-
-  protected final String ERROR_CURSOR = "Invalid cursor";
-
-  protected final String ERROR_COUNT = "Count must be numeric and positive";
-
-  protected final String ERROR_INVALID_CURSOR =
-      "Cursor is invalid, dataset may have been altered if this is cursor from a previous scan";
-
-  protected final int DEFUALT_COUNT = 10;
-
-  protected abstract List<?> getIteration(Collection<?> list, Pattern matchPatter, int count,
-      int cursor);
-
-  /**
-   * @param pattern A glob pattern.
-   * @return A regex pattern to recognize the given glob pattern.
-   */
-  protected final Pattern convertGlobToRegex(String pattern) {
-    if (pattern == null)
-      return null;
-    return GlobPattern.compile(pattern);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java
deleted file mode 100644
index 9d318a4..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Executor;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class AuthExecutor implements Executor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.AUTH));
-      return;
-    }
-    byte[] pwd = context.getAuthPwd();
-    if (pwd == null) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_NO_PASS));
-      return;
-    }
-    boolean correct = Arrays.equals(commandElems.get(1), pwd);
-
-    if (correct) {
-      context.setAuthenticationVerified();
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-    } else {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_INVALID_PWD));
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java
deleted file mode 100755
index 0a121cc..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-
-public class DBSizeExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    int size = context.getRegionProvider().getMetaSize();
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), size));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
deleted file mode 100755
index e0db651..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.cache.UnsupportedOperationInTransactionException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class DelExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    if (context.hasTransaction())
-      throw new UnsupportedOperationInTransactionException();
-
-    List<byte[]> commandElems = command.getProcessedCommand();
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DEL));
-      return;
-    }
-
-    int numRemoved = 0;
-
-    for (int i = 1; i < commandElems.size(); i++) {
-      byte[] byteKey = commandElems.get(i);
-      ByteArrayWrapper key = new ByteArrayWrapper(byteKey);
-      RedisDataType type = context.getRegionProvider().getRedisDataType(key);
-      if (removeEntry(key, type, context))
-        numRemoved++;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java
deleted file mode 100755
index 407e653..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class EchoExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ECHO));
-      return;
-    }
-
-    byte[] echoMessage = commandElems.get(1);
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), echoMessage));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java
deleted file mode 100755
index 96611dc..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ExistsExecutor extends AbstractExecutor {
-  private final int EXISTS = 1;
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.EXISTS));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    boolean exists = context.getRegionProvider().existsKey(key);
-
-    if (exists)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTS));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java
deleted file mode 100755
index 86503f1..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
-
-public class ExpirationExecutor implements Runnable {
-  private final ByteArrayWrapper key;
-  private final RedisDataType type;
-  private final RegionProvider rC;
-
-  public ExpirationExecutor(ByteArrayWrapper k, RedisDataType type, RegionProvider rC) {
-    this.key = k;
-    this.type = type;
-    this.rC = rC;
-  }
-
-  @Override
-  public void run() {
-    rC.removeKey(key, type, false);
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java
deleted file mode 100755
index 0962a7d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RegionProvider;
-
-public class ExpireAtExecutor extends AbstractExecutor implements Extendable {
-
-  private final String ERROR_TIMESTAMP_NOT_USABLE = "The timestamp specified must be numeric";
-
-  private final int TIMESTAMP_INDEX = 2;
-
-  private final int SET = 1;
-
-  private final int NOT_SET = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-    RegionProvider rC = context.getRegionProvider();
-    ByteArrayWrapper wKey = command.getKey();
-
-    byte[] timestampByteArray = commandElems.get(TIMESTAMP_INDEX);
-    long timestamp;
-    try {
-      timestamp = Coder.bytesToLong(timestampByteArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_TIMESTAMP_NOT_USABLE));
-      return;
-    }
-
-    if (!timeUnitMillis())
-      timestamp = timestamp * millisInSecond;
-
-    long currentTimeMillis = System.currentTimeMillis();
-
-    if (timestamp <= currentTimeMillis) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
-      return;
-    }
-
-    long delayMillis = timestamp - currentTimeMillis;
-
-    boolean expirationSet = false;
-
-    if (rC.hasExpiration(wKey))
-      expirationSet = rC.modifyExpiration(wKey, delayMillis);
-    else
-      expirationSet = rC.setExpiration(wKey, delayMillis);
-
-    if (expirationSet)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
-  }
-
-  protected boolean timeUnitMillis() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.EXPIREAT;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java
deleted file mode 100755
index d986826..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RegionProvider;
-
-public class ExpireExecutor extends AbstractExecutor implements Extendable {
-
-  private final String ERROR_SECONDS_NOT_USABLE = "The number of seconds specified must be numeric";
-
-  private final int SECONDS_INDEX = 2;
-
-  private final int SET = 1;
-
-  private final int NOT_SET = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-    ByteArrayWrapper wKey = command.getKey();
-    RegionProvider rC = context.getRegionProvider();
-    byte[] delayByteArray = commandElems.get(SECONDS_INDEX);
-    long delay;
-    try {
-      delay = Coder.bytesToLong(delayByteArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_USABLE));
-      return;
-    }
-
-    if (delay <= 0) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
-      return;
-    }
-
-    // If time unit given is not in millis convert to millis
-    if (!timeUnitMillis())
-      delay = delay * millisInSecond;
-
-    boolean expirationSet = false;
-
-    if (rC.hasExpiration(wKey))
-      expirationSet = rC.modifyExpiration(wKey, delay);
-    else
-      expirationSet = rC.setExpiration(wKey, delay);
-
-
-    if (expirationSet)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
-  }
-
-  /*
-   * Overridden by PExpire
-   */
-  protected boolean timeUnitMillis() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.EXPIRE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java
deleted file mode 100755
index f855166..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.Map.Entry;
-
-import org.apache.geode.cache.EntryDestroyedException;
-import org.apache.geode.cache.UnsupportedOperationInTransactionException;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class FlushAllExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    if (context.hasTransaction())
-      throw new UnsupportedOperationInTransactionException();
-
-    for (Entry<String, RedisDataType> e : context.getRegionProvider().metaEntrySet()) {
-      try {
-        String skey = e.getKey();
-        RedisDataType type = e.getValue();
-        removeEntry(Coder.stringToByteWrapper(skey), type, context);
-      } catch (EntryDestroyedException e1) {
-        continue;
-      }
-
-    }
-
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java
deleted file mode 100755
index 9398d87..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.org.apache.hadoop.fs.GlobPattern;
-import org.apache.geode.redis.GeodeRedisServer;
-
-public class KeysExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.KEYS));
-      return;
-    }
-
-    String glob = Coder.bytesToString(commandElems.get(1));
-    Set<String> allKeys = context.getRegionProvider().metaKeySet();
-    List<String> matchingKeys = new ArrayList<String>();
-
-    Pattern pattern;
-    try {
-      pattern = GlobPattern.compile(glob);
-    } catch (PatternSyntaxException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
-      return;
-    }
-
-    for (String key : allKeys) {
-      if (!(key.equals(GeodeRedisServer.REDIS_META_DATA_REGION)
-          || key.equals(GeodeRedisServer.STRING_REGION) || key.equals(GeodeRedisServer.HLL_REGION))
-          && pattern.matcher(key).matches())
-        matchingKeys.add(key);
-    }
-
-    if (matchingKeys.isEmpty())
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-    else
-      command.setResponse(
-          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), matchingKeys));
-
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java
deleted file mode 100644
index dcd062a..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-public enum ListQuery {
-
-  LINDEX {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
-    }
-  },
-  LRANGE {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
-    }
-  },
-  LREMG {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE value = $1 AND key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $2";
-    }
-  },
-  LREML {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE value = $1 AND key != 'head' AND key != 'tail' ORDER BY key desc LIMIT $2";
-    }
-  },
-  LREME {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE value = $1 ORDER BY key asc";
-    }
-  },
-  LSET {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
-    }
-  },
-  LTRIM {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
-    }
-  };
-
-  public abstract String getQueryString(String fullpath);
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java
deleted file mode 100755
index fa68d13..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class PExpireAtExecutor extends ExpireAtExecutor {
-
-  @Override
-  protected boolean timeUnitMillis() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.PEXPIREAT;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java
deleted file mode 100755
index 3581d5d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class PExpireExecutor extends ExpireExecutor {
-
-  @Override
-  protected boolean timeUnitMillis() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.PEXPIRE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java
deleted file mode 100755
index 9e15d56..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class PTTLExecutor extends TTLExecutor {
-
-
-  @Override
-  protected boolean timeUnitMillis() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.PTTL;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java
deleted file mode 100755
index db4d19a..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class PersistExecutor extends AbstractExecutor {
-
-  private final int TIMEOUT_REMOVED = 1;
-
-  private final int KEY_NOT_EXIST_OR_NO_TIMEOUT = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PERSIST));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    boolean canceled = context.getRegionProvider().cancelKeyExpiration(key);
-
-    if (canceled)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), TIMEOUT_REMOVED));
-    else
-      command.setResponse(
-          Coder.getIntegerResponse(context.getByteBufAllocator(), KEY_NOT_EXIST_OR_NO_TIMEOUT));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java
deleted file mode 100755
index 4561b5c..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-
-public class PingExecutor extends AbstractExecutor {
-
-  private final String PING_RESPONSE = "PONG";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    command
-        .setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), PING_RESPONSE));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java
deleted file mode 100755
index 84ad241..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-
-public class QuitExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    command.setResponse(
-        Coder.getSimpleStringResponse(context.getByteBufAllocator(), RedisConstants.QUIT_RESPONSE));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java
deleted file mode 100755
index 5e625cf..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.GeodeRedisServer;
-
-public class ScanExecutor extends AbstractScanExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SCAN));
-      return;
-    }
-
-    String cursorString = command.getStringKey();
-    int cursor = 0;
-    Pattern matchPattern = null;
-    String globMatchString = null;
-    int count = DEFUALT_COUNT;
-    try {
-      cursor = Integer.parseInt(cursorString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-    if (cursor < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-
-    if (commandElems.size() > 3) {
-      try {
-        byte[] bytes = commandElems.get(2);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("MATCH")) {
-          bytes = commandElems.get(3);
-          globMatchString = Coder.bytesToString(bytes);
-        } else if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(3);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (commandElems.size() > 5) {
-      try {
-        byte[] bytes = commandElems.get(4);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(5);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (count < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-      return;
-    }
-
-    try {
-      matchPattern = convertGlobToRegex(globMatchString);
-    } catch (PatternSyntaxException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
-      return;
-    }
-
-    @SuppressWarnings("unchecked")
-    List<String> returnList = (List<String>) getIteration(context.getRegionProvider().metaKeySet(),
-        matchPattern, count, cursor);
-
-    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
-    List<String> returnList = new ArrayList<String>();
-    int size = list.size();
-    int beforeCursor = 0;
-    int numElements = 0;
-    int i = -1;
-    for (String key : (Collection<String>) list) {
-      if (key.equals(GeodeRedisServer.REDIS_META_DATA_REGION)
-          || key.equals(GeodeRedisServer.STRING_REGION) || key.equals(GeodeRedisServer.HLL_REGION))
-        continue;
-      i++;
-      if (beforeCursor < cursor) {
-        beforeCursor++;
-        continue;
-      } else if (numElements < count) {
-        if (matchPattern != null) {
-          if (matchPattern.matcher(key).matches()) {
-            returnList.add(key);
-            numElements++;
-          }
-        } else {
-          returnList.add(key);
-          numElements++;
-        }
-      } else
-        break;
-    }
-
-    if (i == size - (NUM_DEFAULT_REGIONS + 1))
-      returnList.add(0, String.valueOf(0));
-    else
-      returnList.add(0, String.valueOf(i));
-    return returnList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java
deleted file mode 100755
index 0392095..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-
-public class ShutDownExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {}
-
-}


[03/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLogPlus.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLogPlus.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLogPlus.java
new file mode 100644
index 0000000..657a124
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLogPlus.java
@@ -0,0 +1,1866 @@
+/*
+ * Copyright (C) 2011 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+import org.apache.geode.redis.internal.executor.hll.Varint;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+
+/**
+ * Implementation of HyperLogLog++ described in
+ * <p/>
+ * <p>
+ * http://static.googleusercontent.com/external_content/untrusted_dlcp/research.google.com/en/us/pubs/archive/40671.pdf
+ * </p>
+ * <p/>
+ * Brief HyperLogLog++ Overview
+ * <p/>
+ * Uses 64 bit hashing instead of 32 Has two representation modes: sparse and normal
+ * <p/>
+ * 'normal' is approximately the same as regular hyperloglog (still uses 64 bits)
+ * <p/>
+ * 'sparse' handles lower cardinality values with a highly accurate but poorly scaling strategy and
+ * leverages data compression to compete with 'normal' for as long as possible (sparse has the
+ * advantage on accuracy per unit of memory at low cardinality but quickly falls behind).
+ */
+public class HyperLogLogPlus implements ICardinality, Serializable {
+
+  private static final long serialVersionUID = 7504952025744337762L;
+
+  private enum Format {
+    SPARSE, NORMAL
+  }
+
+  /**
+   * used to mark codec version for serialization
+   */
+  private static final int VERSION = 2;
+
+  // threshold and bias data taken from google's bias correction data set:
+  // https://docs.google.com/document/d/1gyjfMHy43U9OWBXxfaeG-3MjGzejW1dlpyMwEYAAWEI/view?fullscreen#
+  static final double[] thresholdData =
+      {10, 20, 40, 80, 220, 400, 900, 1800, 3100, 6500, 15500, 20000, 50000, 120000, 350000};
+
+  static final double[][] rawEstimateData = {
+      // precision 4
+      {11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722,
+          17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766,
+          24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996,
+          32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966,
+          41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506,
+          51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482,
+          61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928,
+          70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394,},
+      // precision 5
+      {23, 23.1194, 23.8208, 24.2318, 24.77, 25.2436, 25.7774, 26.2848, 26.8224, 27.3742, 27.9336,
+          28.503, 29.0494, 29.6292, 30.2124, 30.798, 31.367, 31.9728, 32.5944, 33.217, 33.8438,
+          34.3696, 35.0956, 35.7044, 36.324, 37.0668, 37.6698, 38.3644, 39.049, 39.6918, 40.4146,
+          41.082, 41.687, 42.5398, 43.2462, 43.857, 44.6606, 45.4168, 46.1248, 46.9222, 47.6804,
+          48.447, 49.3454, 49.9594, 50.7636, 51.5776, 52.331, 53.19, 53.9676, 54.7564, 55.5314,
+          56.4442, 57.3708, 57.9774, 58.9624, 59.8796, 60.755, 61.472, 62.2076, 63.1024, 63.8908,
+          64.7338, 65.7728, 66.629, 67.413, 68.3266, 69.1524, 70.2642, 71.1806, 72.0566, 72.9192,
+          73.7598, 74.3516, 75.5802, 76.4386, 77.4916, 78.1524, 79.1892, 79.8414, 80.8798, 81.8376,
+          82.4698, 83.7656, 84.331, 85.5914, 86.6012, 87.7016, 88.5582, 89.3394, 90.3544, 91.4912,
+          92.308, 93.3552, 93.9746, 95.2052, 95.727, 97.1322, 98.3944, 98.7588, 100.242, 101.1914,
+          102.2538, 102.8776, 103.6292, 105.1932, 105.9152, 107.0868, 107.6728, 108.7144, 110.3114,
+          110.8716, 111.245, 112.7908, 113.7064, 114.636, 115.7464, 116.1788, 117.7464, 118.4896,
+          119.6166, 120.5082, 121.7798, 122.9028, 123.4426, 124.8854, 125.705, 126.4652, 128.3464,
+          128.3462, 130.0398, 131.0342, 131.0042, 132.4766, 133.511, 134.7252, 135.425, 136.5172,
+          138.0572, 138.6694, 139.3712, 140.8598, 141.4594, 142.554, 143.4006, 144.7374, 146.1634,
+          146.8994, 147.605, 147.9304, 149.1636, 150.2468, 151.5876, 152.2096, 153.7032, 154.7146,
+          155.807, 156.9228, 157.0372, 158.5852,},
+      // precision 6
+      {46, 46.1902, 47.271, 47.8358, 48.8142, 49.2854, 50.317, 51.354, 51.8924, 52.9436, 53.4596,
+          54.5262, 55.6248, 56.1574, 57.2822, 57.837, 58.9636, 60.074, 60.7042, 61.7976, 62.4772,
+          63.6564, 64.7942, 65.5004, 66.686, 67.291, 68.5672, 69.8556, 70.4982, 71.8204, 72.4252,
+          73.7744, 75.0786, 75.8344, 77.0294, 77.8098, 79.0794, 80.5732, 81.1878, 82.5648, 83.2902,
+          84.6784, 85.3352, 86.8946, 88.3712, 89.0852, 90.499, 91.2686, 92.6844, 94.2234, 94.9732,
+          96.3356, 97.2286, 98.7262, 100.3284, 101.1048, 102.5962, 103.3562, 105.1272, 106.4184,
+          107.4974, 109.0822, 109.856, 111.48, 113.2834, 114.0208, 115.637, 116.5174, 118.0576,
+          119.7476, 120.427, 122.1326, 123.2372, 125.2788, 126.6776, 127.7926, 129.1952, 129.9564,
+          131.6454, 133.87, 134.5428, 136.2, 137.0294, 138.6278, 139.6782, 141.792, 143.3516,
+          144.2832, 146.0394, 147.0748, 148.4912, 150.849, 151.696, 153.5404, 154.073, 156.3714,
+          157.7216, 158.7328, 160.4208, 161.4184, 163.9424, 165.2772, 166.411, 168.1308, 168.769,
+          170.9258, 172.6828, 173.7502, 175.706, 176.3886, 179.0186, 180.4518, 181.927, 183.4172,
+          184.4114, 186.033, 188.5124, 189.5564, 191.6008, 192.4172, 193.8044, 194.997, 197.4548,
+          198.8948, 200.2346, 202.3086, 203.1548, 204.8842, 206.6508, 206.6772, 209.7254, 210.4752,
+          212.7228, 214.6614, 215.1676, 217.793, 218.0006, 219.9052, 221.66, 223.5588, 225.1636,
+          225.6882, 227.7126, 229.4502, 231.1978, 232.9756, 233.1654, 236.727, 238.1974, 237.7474,
+          241.1346, 242.3048, 244.1948, 245.3134, 246.879, 249.1204, 249.853, 252.6792, 253.857,
+          254.4486, 257.2362, 257.9534, 260.0286, 260.5632, 262.663, 264.723, 265.7566, 267.2566,
+          267.1624, 270.62, 272.8216, 273.2166, 275.2056, 276.2202, 278.3726, 280.3344, 281.9284,
+          283.9728, 284.1924, 286.4872, 287.587, 289.807, 291.1206, 292.769, 294.8708, 296.665,
+          297.1182, 299.4012, 300.6352, 302.1354, 304.1756, 306.1606, 307.3462, 308.5214, 309.4134,
+          310.8352, 313.9684, 315.837, 316.7796, 318.9858,},
+      // precision 7
+      {92, 93.4934, 94.9758, 96.4574, 97.9718, 99.4954, 101.5302, 103.0756, 104.6374, 106.1782,
+          107.7888, 109.9522, 111.592, 113.2532, 114.9086, 116.5938, 118.9474, 120.6796, 122.4394,
+          124.2176, 125.9768, 128.4214, 130.2528, 132.0102, 133.8658, 135.7278, 138.3044, 140.1316,
+          142.093, 144.0032, 145.9092, 148.6306, 150.5294, 152.5756, 154.6508, 156.662, 159.552,
+          161.3724, 163.617, 165.5754, 167.7872, 169.8444, 172.7988, 174.8606, 177.2118, 179.3566,
+          181.4476, 184.5882, 186.6816, 189.0824, 191.0258, 193.6048, 196.4436, 198.7274, 200.957,
+          203.147, 205.4364, 208.7592, 211.3386, 213.781, 215.8028, 218.656, 221.6544, 223.996,
+          226.4718, 229.1544, 231.6098, 234.5956, 237.0616, 239.5758, 242.4878, 244.5244, 248.2146,
+          250.724, 252.8722, 255.5198, 258.0414, 261.941, 264.9048, 266.87, 269.4304, 272.028,
+          274.4708, 278.37, 281.0624, 283.4668, 286.5532, 289.4352, 293.2564, 295.2744, 298.2118,
+          300.7472, 304.1456, 307.2928, 309.7504, 312.5528, 315.979, 318.2102, 322.1834, 324.3494,
+          327.325, 330.6614, 332.903, 337.2544, 339.9042, 343.215, 345.2864, 348.0814, 352.6764,
+          355.301, 357.139, 360.658, 363.1732, 366.5902, 369.9538, 373.0828, 375.922, 378.9902,
+          382.7328, 386.4538, 388.1136, 391.2234, 394.0878, 396.708, 401.1556, 404.1852, 406.6372,
+          409.6822, 412.7796, 416.6078, 418.4916, 422.131, 424.5376, 428.1988, 432.211, 434.4502,
+          438.5282, 440.912, 444.0448, 447.7432, 450.8524, 453.7988, 456.7858, 458.8868, 463.9886,
+          466.5064, 468.9124, 472.6616, 475.4682, 478.582, 481.304, 485.2738, 488.6894, 490.329,
+          496.106, 497.6908, 501.1374, 504.5322, 506.8848, 510.3324, 513.4512, 516.179, 520.4412,
+          522.6066, 526.167, 528.7794, 533.379, 536.067, 538.46, 542.9116, 545.692, 547.9546,
+          552.493, 555.2722, 557.335, 562.449, 564.2014, 569.0738, 571.0974, 574.8564, 578.2996,
+          581.409, 583.9704, 585.8098, 589.6528, 594.5998, 595.958, 600.068, 603.3278, 608.2016,
+          609.9632, 612.864, 615.43, 620.7794, 621.272, 625.8644, 629.206, 633.219, 634.5154,
+          638.6102,},
+      // precision 8
+      {184.2152, 187.2454, 190.2096, 193.6652, 196.6312, 199.6822, 203.249, 206.3296, 210.0038,
+          213.2074, 216.4612, 220.27, 223.5178, 227.4412, 230.8032, 234.1634, 238.1688, 241.6074,
+          245.6946, 249.2664, 252.8228, 257.0432, 260.6824, 264.9464, 268.6268, 272.2626, 276.8376,
+          280.4034, 284.8956, 288.8522, 292.7638, 297.3552, 301.3556, 305.7526, 309.9292, 313.8954,
+          318.8198, 322.7668, 327.298, 331.6688, 335.9466, 340.9746, 345.1672, 349.3474, 354.3028,
+          358.8912, 364.114, 368.4646, 372.9744, 378.4092, 382.6022, 387.843, 392.5684, 397.1652,
+          402.5426, 407.4152, 412.5388, 417.3592, 422.1366, 427.486, 432.3918, 437.5076, 442.509,
+          447.3834, 453.3498, 458.0668, 463.7346, 469.1228, 473.4528, 479.7, 484.644, 491.0518,
+          495.5774, 500.9068, 506.432, 512.1666, 517.434, 522.6644, 527.4894, 533.6312, 538.3804,
+          544.292, 550.5496, 556.0234, 562.8206, 566.6146, 572.4188, 579.117, 583.6762, 590.6576,
+          595.7864, 601.509, 607.5334, 612.9204, 619.772, 624.2924, 630.8654, 636.1836, 642.745,
+          649.1316, 655.0386, 660.0136, 666.6342, 671.6196, 678.1866, 684.4282, 689.3324, 695.4794,
+          702.5038, 708.129, 713.528, 720.3204, 726.463, 732.7928, 739.123, 744.7418, 751.2192,
+          756.5102, 762.6066, 769.0184, 775.2224, 781.4014, 787.7618, 794.1436, 798.6506, 805.6378,
+          811.766, 819.7514, 824.5776, 828.7322, 837.8048, 843.6302, 849.9336, 854.4798, 861.3388,
+          867.9894, 873.8196, 880.3136, 886.2308, 892.4588, 899.0816, 905.4076, 912.0064, 917.3878,
+          923.619, 929.998, 937.3482, 943.9506, 947.991, 955.1144, 962.203, 968.8222, 975.7324,
+          981.7826, 988.7666, 994.2648, 1000.3128, 1007.4082, 1013.7536, 1020.3376, 1026.7156,
+          1031.7478, 1037.4292, 1045.393, 1051.2278, 1058.3434, 1062.8726, 1071.884, 1076.806,
+          1082.9176, 1089.1678, 1095.5032, 1102.525, 1107.2264, 1115.315, 1120.93, 1127.252,
+          1134.1496, 1139.0408, 1147.5448, 1153.3296, 1158.1974, 1166.5262, 1174.3328, 1175.657,
+          1184.4222, 1190.9172, 1197.1292, 1204.4606, 1210.4578, 1218.8728, 1225.3336, 1226.6592,
+          1236.5768, 1241.363, 1249.4074, 1254.6566, 1260.8014, 1266.5454, 1274.5192,},
+      // precision 9
+      {369, 374.8294, 381.2452, 387.6698, 394.1464, 400.2024, 406.8782, 413.6598, 420.462, 427.2826,
+          433.7102, 440.7416, 447.9366, 455.1046, 462.285, 469.0668, 476.306, 483.8448, 491.301,
+          498.9886, 506.2422, 513.8138, 521.7074, 529.7428, 537.8402, 545.1664, 553.3534, 561.594,
+          569.6886, 577.7876, 585.65, 594.228, 602.8036, 611.1666, 620.0818, 628.0824, 637.2574,
+          646.302, 655.1644, 664.0056, 672.3802, 681.7192, 690.5234, 700.2084, 708.831, 718.485,
+          728.1112, 737.4764, 746.76, 756.3368, 766.5538, 775.5058, 785.2646, 795.5902, 804.3818,
+          814.8998, 824.9532, 835.2062, 845.2798, 854.4728, 864.9582, 875.3292, 886.171, 896.781,
+          906.5716, 916.7048, 927.5322, 937.875, 949.3972, 958.3464, 969.7274, 980.2834, 992.1444,
+          1003.4264, 1013.0166, 1024.018, 1035.0438, 1046.34, 1057.6856, 1068.9836, 1079.0312,
+          1091.677, 1102.3188, 1113.4846, 1124.4424, 1135.739, 1147.1488, 1158.9202, 1169.406,
+          1181.5342, 1193.2834, 1203.8954, 1216.3286, 1226.2146, 1239.6684, 1251.9946, 1262.123,
+          1275.4338, 1285.7378, 1296.076, 1308.9692, 1320.4964, 1333.0998, 1343.9864, 1357.7754,
+          1368.3208, 1380.4838, 1392.7388, 1406.0758, 1416.9098, 1428.9728, 1440.9228, 1453.9292,
+          1462.617, 1476.05, 1490.2996, 1500.6128, 1513.7392, 1524.5174, 1536.6322, 1548.2584,
+          1562.3766, 1572.423, 1587.1232, 1596.5164, 1610.5938, 1622.5972, 1633.1222, 1647.7674,
+          1658.5044, 1671.57, 1683.7044, 1695.4142, 1708.7102, 1720.6094, 1732.6522, 1747.841,
+          1756.4072, 1769.9786, 1782.3276, 1797.5216, 1808.3186, 1819.0694, 1834.354, 1844.575,
+          1856.2808, 1871.1288, 1880.7852, 1893.9622, 1906.3418, 1920.6548, 1932.9302, 1945.8584,
+          1955.473, 1968.8248, 1980.6446, 1995.9598, 2008.349, 2019.8556, 2033.0334, 2044.0206,
+          2059.3956, 2069.9174, 2082.6084, 2093.7036, 2106.6108, 2118.9124, 2132.301, 2144.7628,
+          2159.8422, 2171.0212, 2183.101, 2193.5112, 2208.052, 2221.3194, 2233.3282, 2247.295,
+          2257.7222, 2273.342, 2286.5638, 2299.6786, 2310.8114, 2322.3312, 2335.516, 2349.874,
+          2363.5968, 2373.865, 2387.1918, 2401.8328, 2414.8496, 2424.544, 2436.7592, 2447.1682,
+          2464.1958, 2474.3438, 2489.0006, 2497.4526, 2513.6586, 2527.19, 2540.7028, 2553.768,},
+      // precision 10
+      {738.1256, 750.4234, 763.1064, 775.4732, 788.4636, 801.0644, 814.488, 827.9654, 841.0832,
+          854.7864, 868.1992, 882.2176, 896.5228, 910.1716, 924.7752, 938.899, 953.6126, 968.6492,
+          982.9474, 998.5214, 1013.1064, 1028.6364, 1044.2468, 1059.4588, 1075.3832, 1091.0584,
+          1106.8606, 1123.3868, 1139.5062, 1156.1862, 1172.463, 1189.339, 1206.1936, 1223.1292,
+          1240.1854, 1257.2908, 1275.3324, 1292.8518, 1310.5204, 1328.4854, 1345.9318, 1364.552,
+          1381.4658, 1400.4256, 1419.849, 1438.152, 1456.8956, 1474.8792, 1494.118, 1513.62,
+          1532.5132, 1551.9322, 1570.7726, 1590.6086, 1610.5332, 1630.5918, 1650.4294, 1669.7662,
+          1690.4106, 1710.7338, 1730.9012, 1750.4486, 1770.1556, 1791.6338, 1812.7312, 1833.6264,
+          1853.9526, 1874.8742, 1896.8326, 1918.1966, 1939.5594, 1961.07, 1983.037, 2003.1804,
+          2026.071, 2047.4884, 2070.0848, 2091.2944, 2114.333, 2135.9626, 2158.2902, 2181.0814,
+          2202.0334, 2224.4832, 2246.39, 2269.7202, 2292.1714, 2314.2358, 2338.9346, 2360.891,
+          2384.0264, 2408.3834, 2430.1544, 2454.8684, 2476.9896, 2501.4368, 2522.8702, 2548.0408,
+          2570.6738, 2593.5208, 2617.0158, 2640.2302, 2664.0962, 2687.4986, 2714.2588, 2735.3914,
+          2759.6244, 2781.8378, 2808.0072, 2830.6516, 2856.2454, 2877.2136, 2903.4546, 2926.785,
+          2951.2294, 2976.468, 3000.867, 3023.6508, 3049.91, 3073.5984, 3098.162, 3121.5564,
+          3146.2328, 3170.9484, 3195.5902, 3221.3346, 3242.7032, 3271.6112, 3296.5546, 3317.7376,
+          3345.072, 3369.9518, 3394.326, 3418.1818, 3444.6926, 3469.086, 3494.2754, 3517.8698,
+          3544.248, 3565.3768, 3588.7234, 3616.979, 3643.7504, 3668.6812, 3695.72, 3719.7392,
+          3742.6224, 3770.4456, 3795.6602, 3819.9058, 3844.002, 3869.517, 3895.6824, 3920.8622,
+          3947.1364, 3973.985, 3995.4772, 4021.62, 4046.628, 4074.65, 4096.2256, 4121.831,
+          4146.6406, 4173.276, 4195.0744, 4223.9696, 4251.3708, 4272.9966, 4300.8046, 4326.302,
+          4353.1248, 4374.312, 4403.0322, 4426.819, 4450.0598, 4478.5206, 4504.8116, 4528.8928,
+          4553.9584, 4578.8712, 4603.8384, 4632.3872, 4655.5128, 4675.821, 4704.6222, 4731.9862,
+          4755.4174, 4781.2628, 4804.332, 4832.3048, 4862.8752, 4883.4148, 4906.9544, 4935.3516,
+          4954.3532, 4984.0248, 5011.217, 5035.3258, 5057.3672, 5084.1828,},
+      // precision 11
+      {1477, 1501.6014, 1526.5802, 1551.7942, 1577.3042, 1603.2062, 1629.8402, 1656.2292, 1682.9462,
+          1709.9926, 1737.3026, 1765.4252, 1793.0578, 1821.6092, 1849.626, 1878.5568, 1908.527,
+          1937.5154, 1967.1874, 1997.3878, 2027.37, 2058.1972, 2089.5728, 2120.1012, 2151.9668,
+          2183.292, 2216.0772, 2247.8578, 2280.6562, 2313.041, 2345.714, 2380.3112, 2414.1806,
+          2447.9854, 2481.656, 2516.346, 2551.5154, 2586.8378, 2621.7448, 2656.6722, 2693.5722,
+          2729.1462, 2765.4124, 2802.8728, 2838.898, 2876.408, 2913.4926, 2951.4938, 2989.6776,
+          3026.282, 3065.7704, 3104.1012, 3143.7388, 3181.6876, 3221.1872, 3261.5048, 3300.0214,
+          3339.806, 3381.409, 3421.4144, 3461.4294, 3502.2286, 3544.651, 3586.6156, 3627.337,
+          3670.083, 3711.1538, 3753.5094, 3797.01, 3838.6686, 3882.1678, 3922.8116, 3967.9978,
+          4009.9204, 4054.3286, 4097.5706, 4140.6014, 4185.544, 4229.5976, 4274.583, 4316.9438,
+          4361.672, 4406.2786, 4451.8628, 4496.1834, 4543.505, 4589.1816, 4632.5188, 4678.2294,
+          4724.8908, 4769.0194, 4817.052, 4861.4588, 4910.1596, 4956.4344, 5002.5238, 5048.13,
+          5093.6374, 5142.8162, 5187.7894, 5237.3984, 5285.6078, 5331.0858, 5379.1036, 5428.6258,
+          5474.6018, 5522.7618, 5571.5822, 5618.59, 5667.9992, 5714.88, 5763.454, 5808.6982,
+          5860.3644, 5910.2914, 5953.571, 6005.9232, 6055.1914, 6104.5882, 6154.5702, 6199.7036,
+          6251.1764, 6298.7596, 6350.0302, 6398.061, 6448.4694, 6495.933, 6548.0474, 6597.7166,
+          6646.9416, 6695.9208, 6742.6328, 6793.5276, 6842.1934, 6894.2372, 6945.3864, 6996.9228,
+          7044.2372, 7094.1374, 7142.2272, 7192.2942, 7238.8338, 7288.9006, 7344.0908, 7394.8544,
+          7443.5176, 7490.4148, 7542.9314, 7595.6738, 7641.9878, 7694.3688, 7743.0448, 7797.522,
+          7845.53, 7899.594, 7950.3132, 7996.455, 8050.9442, 8092.9114, 8153.1374, 8197.4472,
+          8252.8278, 8301.8728, 8348.6776, 8401.4698, 8453.551, 8504.6598, 8553.8944, 8604.1276,
+          8657.6514, 8710.3062, 8758.908, 8807.8706, 8862.1702, 8910.4668, 8960.77, 9007.2766,
+          9063.164, 9121.0534, 9164.1354, 9218.1594, 9267.767, 9319.0594, 9372.155, 9419.7126,
+          9474.3722, 9520.1338, 9572.368, 9622.7702, 9675.8448, 9726.5396, 9778.7378, 9827.6554,
+          9878.1922, 9928.7782, 9978.3984, 10026.578, 10076.5626, 10137.1618, 10177.5244,
+          10229.9176,},
+      // precision 12
+      {2954, 3003.4782, 3053.3568, 3104.3666, 3155.324, 3206.9598, 3259.648, 3312.539, 3366.1474,
+          3420.2576, 3474.8376, 3530.6076, 3586.451, 3643.38, 3700.4104, 3757.5638, 3815.9676,
+          3875.193, 3934.838, 3994.8548, 4055.018, 4117.1742, 4178.4482, 4241.1294, 4304.4776,
+          4367.4044, 4431.8724, 4496.3732, 4561.4304, 4627.5326, 4693.949, 4761.5532, 4828.7256,
+          4897.6182, 4965.5186, 5034.4528, 5104.865, 5174.7164, 5244.6828, 5316.6708, 5387.8312,
+          5459.9036, 5532.476, 5604.8652, 5679.6718, 5753.757, 5830.2072, 5905.2828, 5980.0434,
+          6056.6264, 6134.3192, 6211.5746, 6290.0816, 6367.1176, 6447.9796, 6526.5576, 6606.1858,
+          6686.9144, 6766.1142, 6847.0818, 6927.9664, 7010.9096, 7091.0816, 7175.3962, 7260.3454,
+          7344.018, 7426.4214, 7511.3106, 7596.0686, 7679.8094, 7765.818, 7852.4248, 7936.834,
+          8022.363, 8109.5066, 8200.4554, 8288.5832, 8373.366, 8463.4808, 8549.7682, 8642.0522,
+          8728.3288, 8820.9528, 8907.727, 9001.0794, 9091.2522, 9179.988, 9269.852, 9362.6394,
+          9453.642, 9546.9024, 9640.6616, 9732.6622, 9824.3254, 9917.7484, 10007.9392, 10106.7508,
+          10196.2152, 10289.8114, 10383.5494, 10482.3064, 10576.8734, 10668.7872, 10764.7156,
+          10862.0196, 10952.793, 11049.9748, 11146.0702, 11241.4492, 11339.2772, 11434.2336,
+          11530.741, 11627.6136, 11726.311, 11821.5964, 11918.837, 12015.3724, 12113.0162,
+          12213.0424, 12306.9804, 12408.4518, 12504.8968, 12604.586, 12700.9332, 12798.705,
+          12898.5142, 12997.0488, 13094.788, 13198.475, 13292.7764, 13392.9698, 13486.8574,
+          13590.1616, 13686.5838, 13783.6264, 13887.2638, 13992.0978, 14081.0844, 14189.9956,
+          14280.0912, 14382.4956, 14486.4384, 14588.1082, 14686.2392, 14782.276, 14888.0284,
+          14985.1864, 15088.8596, 15187.0998, 15285.027, 15383.6694, 15495.8266, 15591.3736,
+          15694.2008, 15790.3246, 15898.4116, 15997.4522, 16095.5014, 16198.8514, 16291.7492,
+          16402.6424, 16499.1266, 16606.2436, 16697.7186, 16796.3946, 16902.3376, 17005.7672,
+          17100.814, 17206.8282, 17305.8262, 17416.0744, 17508.4092, 17617.0178, 17715.4554,
+          17816.758, 17920.1748, 18012.9236, 18119.7984, 18223.2248, 18324.2482, 18426.6276,
+          18525.0932, 18629.8976, 18733.2588, 18831.0466, 18940.1366, 19032.2696, 19131.729,
+          19243.4864, 19349.6932, 19442.866, 19547.9448, 19653.2798, 19754.4034, 19854.0692,
+          19965.1224, 20065.1774, 20158.2212, 20253.353, 20366.3264, 20463.22,},
+      // precision 13
+      {5908.5052, 6007.2672, 6107.347, 6208.5794, 6311.2622, 6414.5514, 6519.3376, 6625.6952,
+          6732.5988, 6841.3552, 6950.5972, 7061.3082, 7173.5646, 7287.109, 7401.8216, 7516.4344,
+          7633.3802, 7751.2962, 7870.3784, 7990.292, 8110.79, 8233.4574, 8356.6036, 8482.2712,
+          8607.7708, 8735.099, 8863.1858, 8993.4746, 9123.8496, 9255.6794, 9388.5448, 9522.7516,
+          9657.3106, 9792.6094, 9930.5642, 10068.794, 10206.7256, 10347.81, 10490.3196, 10632.0778,
+          10775.9916, 10920.4662, 11066.124, 11213.073, 11358.0362, 11508.1006, 11659.1716,
+          11808.7514, 11959.4884, 12112.1314, 12265.037, 12420.3756, 12578.933, 12734.311,
+          12890.0006, 13047.2144, 13207.3096, 13368.5144, 13528.024, 13689.847, 13852.7528,
+          14018.3168, 14180.5372, 14346.9668, 14513.5074, 14677.867, 14846.2186, 15017.4186,
+          15184.9716, 15356.339, 15529.2972, 15697.3578, 15871.8686, 16042.187, 16216.4094,
+          16389.4188, 16565.9126, 16742.3272, 16919.0042, 17094.7592, 17273.965, 17451.8342,
+          17634.4254, 17810.5984, 17988.9242, 18171.051, 18354.7938, 18539.466, 18721.0408,
+          18904.9972, 19081.867, 19271.9118, 19451.8694, 19637.9816, 19821.2922, 20013.1292,
+          20199.3858, 20387.8726, 20572.9514, 20770.7764, 20955.1714, 21144.751, 21329.9952,
+          21520.709, 21712.7016, 21906.3868, 22096.2626, 22286.0524, 22475.051, 22665.5098,
+          22862.8492, 23055.5294, 23249.6138, 23437.848, 23636.273, 23826.093, 24020.3296,
+          24213.3896, 24411.7392, 24602.9614, 24805.7952, 24998.1552, 25193.9588, 25389.0166,
+          25585.8392, 25780.6976, 25981.2728, 26175.977, 26376.5252, 26570.1964, 26773.387,
+          26962.9812, 27163.0586, 27368.164, 27565.0534, 27758.7428, 27961.1276, 28163.2324,
+          28362.3816, 28565.7668, 28758.644, 28956.9768, 29163.4722, 29354.7026, 29561.1186,
+          29767.9948, 29959.9986, 30164.0492, 30366.9818, 30562.5338, 30762.9928, 30976.1592,
+          31166.274, 31376.722, 31570.3734, 31770.809, 31974.8934, 32179.5286, 32387.5442,
+          32582.3504, 32794.076, 32989.9528, 33191.842, 33392.4684, 33595.659, 33801.8672,
+          34000.3414, 34200.0922, 34402.6792, 34610.0638, 34804.0084, 35011.13, 35218.669,
+          35418.6634, 35619.0792, 35830.6534, 36028.4966, 36229.7902, 36438.6422, 36630.7764,
+          36833.3102, 37048.6728, 37247.3916, 37453.5904, 37669.3614, 37854.5526, 38059.305,
+          38268.0936, 38470.2516, 38674.7064, 38876.167, 39068.3794, 39281.9144, 39492.8566,
+          39684.8628, 39898.4108, 40093.1836, 40297.6858, 40489.7086, 40717.2424,},
+      // precision 14
+      {11817.475, 12015.0046, 12215.3792, 12417.7504, 12623.1814, 12830.0086, 13040.0072, 13252.503,
+          13466.178, 13683.2738, 13902.0344, 14123.9798, 14347.394, 14573.7784, 14802.6894,
+          15033.6824, 15266.9134, 15502.8624, 15741.4944, 15980.7956, 16223.8916, 16468.6316,
+          16715.733, 16965.5726, 17217.204, 17470.666, 17727.8516, 17986.7886, 18247.6902,
+          18510.9632, 18775.304, 19044.7486, 19314.4408, 19587.202, 19862.2576, 20135.924,
+          20417.0324, 20697.9788, 20979.6112, 21265.0274, 21550.723, 21841.6906, 22132.162,
+          22428.1406, 22722.127, 23020.5606, 23319.7394, 23620.4014, 23925.2728, 24226.9224,
+          24535.581, 24845.505, 25155.9618, 25470.3828, 25785.9702, 26103.7764, 26420.4132,
+          26742.0186, 27062.8852, 27388.415, 27714.6024, 28042.296, 28365.4494, 28701.1526,
+          29031.8008, 29364.2156, 29704.497, 30037.1458, 30380.111, 30723.8168, 31059.5114,
+          31404.9498, 31751.6752, 32095.2686, 32444.7792, 32794.767, 33145.204, 33498.4226,
+          33847.6502, 34209.006, 34560.849, 34919.4838, 35274.9778, 35635.1322, 35996.3266,
+          36359.1394, 36722.8266, 37082.8516, 37447.7354, 37815.9606, 38191.0692, 38559.4106,
+          38924.8112, 39294.6726, 39663.973, 40042.261, 40416.2036, 40779.2036, 41161.6436,
+          41540.9014, 41921.1998, 42294.7698, 42678.5264, 43061.3464, 43432.375, 43818.432,
+          44198.6598, 44583.0138, 44970.4794, 45353.924, 45729.858, 46118.2224, 46511.5724,
+          46900.7386, 47280.6964, 47668.1472, 48055.6796, 48446.9436, 48838.7146, 49217.7296,
+          49613.7796, 50010.7508, 50410.0208, 50793.7886, 51190.2456, 51583.1882, 51971.0796,
+          52376.5338, 52763.319, 53165.5534, 53556.5594, 53948.2702, 54346.352, 54748.7914,
+          55138.577, 55543.4824, 55941.1748, 56333.7746, 56745.1552, 57142.7944, 57545.2236,
+          57935.9956, 58348.5268, 58737.5474, 59158.5962, 59542.6896, 59958.8004, 60349.3788,
+          60755.0212, 61147.6144, 61548.194, 61946.0696, 62348.6042, 62763.603, 63162.781,
+          63560.635, 63974.3482, 64366.4908, 64771.5876, 65176.7346, 65597.3916, 65995.915,
+          66394.0384, 66822.9396, 67203.6336, 67612.2032, 68019.0078, 68420.0388, 68821.22,
+          69235.8388, 69640.0724, 70055.155, 70466.357, 70863.4266, 71276.2482, 71677.0306,
+          72080.2006, 72493.0214, 72893.5952, 73314.5856, 73714.9852, 74125.3022, 74521.2122,
+          74933.6814, 75341.5904, 75743.0244, 76166.0278, 76572.1322, 76973.1028, 77381.6284,
+          77800.6092, 78189.328, 78607.0962, 79012.2508, 79407.8358, 79825.725, 80238.701,
+          80646.891, 81035.6436, 81460.0448, 81876.3884,},
+      // precision 15
+      {23635.0036, 24030.8034, 24431.4744, 24837.1524, 25246.7928, 25661.326, 26081.3532,
+          26505.2806, 26933.9892, 27367.7098, 27805.318, 28248.799, 28696.4382, 29148.8244,
+          29605.5138, 30066.8668, 30534.2344, 31006.32, 31480.778, 31962.2418, 32447.3324,
+          32938.0232, 33432.731, 33930.728, 34433.9896, 34944.1402, 35457.5588, 35974.5958,
+          36497.3296, 37021.9096, 37554.326, 38088.0826, 38628.8816, 39171.3192, 39723.2326,
+          40274.5554, 40832.3142, 41390.613, 41959.5908, 42532.5466, 43102.0344, 43683.5072,
+          44266.694, 44851.2822, 45440.7862, 46038.0586, 46640.3164, 47241.064, 47846.155,
+          48454.7396, 49076.9168, 49692.542, 50317.4778, 50939.65, 51572.5596, 52210.2906,
+          52843.7396, 53481.3996, 54127.236, 54770.406, 55422.6598, 56078.7958, 56736.7174,
+          57397.6784, 58064.5784, 58730.308, 59404.9784, 60077.0864, 60751.9158, 61444.1386,
+          62115.817, 62808.7742, 63501.4774, 64187.5454, 64883.6622, 65582.7468, 66274.5318,
+          66976.9276, 67688.7764, 68402.138, 69109.6274, 69822.9706, 70543.6108, 71265.5202,
+          71983.3848, 72708.4656, 73433.384, 74158.4664, 74896.4868, 75620.9564, 76362.1434,
+          77098.3204, 77835.7662, 78582.6114, 79323.9902, 80067.8658, 80814.9246, 81567.0136,
+          82310.8536, 83061.9952, 83821.4096, 84580.8608, 85335.547, 86092.5802, 86851.6506,
+          87612.311, 88381.2016, 89146.3296, 89907.8974, 90676.846, 91451.4152, 92224.5518,
+          92995.8686, 93763.5066, 94551.2796, 95315.1944, 96096.1806, 96881.0918, 97665.679,
+          98442.68, 99229.3002, 100011.0994, 100790.6386, 101580.1564, 102377.7484, 103152.1392,
+          103944.2712, 104730.216, 105528.6336, 106324.9398, 107117.6706, 107890.3988, 108695.2266,
+          109485.238, 110294.7876, 111075.0958, 111878.0496, 112695.2864, 113464.5486, 114270.0474,
+          115068.608, 115884.3626, 116673.2588, 117483.3716, 118275.097, 119085.4092, 119879.2808,
+          120687.5868, 121499.9944, 122284.916, 123095.9254, 123912.5038, 124709.0454, 125503.7182,
+          126323.259, 127138.9412, 127943.8294, 128755.646, 129556.5354, 130375.3298, 131161.4734,
+          131971.1962, 132787.5458, 133588.1056, 134431.351, 135220.2906, 136023.398, 136846.6558,
+          137667.0004, 138463.663, 139283.7154, 140074.6146, 140901.3072, 141721.8548, 142543.2322,
+          143356.1096, 144173.7412, 144973.0948, 145794.3162, 146609.5714, 147420.003, 148237.9784,
+          149050.5696, 149854.761, 150663.1966, 151494.0754, 152313.1416, 153112.6902, 153935.7206,
+          154746.9262, 155559.547, 156401.9746, 157228.7036, 158008.7254, 158820.75, 159646.9184,
+          160470.4458, 161279.5348, 162093.3114, 162918.542, 163729.2842,},
+      // precision 16
+      {47271, 48062.3584, 48862.7074, 49673.152, 50492.8416, 51322.9514, 52161.03, 53009.407,
+          53867.6348, 54734.206, 55610.5144, 56496.2096, 57390.795, 58297.268, 59210.6448,
+          60134.665, 61068.0248, 62010.4472, 62962.5204, 63923.5742, 64895.0194, 65876.4182,
+          66862.6136, 67862.6968, 68868.8908, 69882.8544, 70911.271, 71944.0924, 72990.0326,
+          74040.692, 75100.6336, 76174.7826, 77252.5998, 78340.2974, 79438.2572, 80545.4976,
+          81657.2796, 82784.6336, 83915.515, 85059.7362, 86205.9368, 87364.4424, 88530.3358,
+          89707.3744, 90885.9638, 92080.197, 93275.5738, 94479.391, 95695.918, 96919.2236,
+          98148.4602, 99382.3474, 100625.6974, 101878.0284, 103141.6278, 104409.4588, 105686.2882,
+          106967.5402, 108261.6032, 109548.1578, 110852.0728, 112162.231, 113479.0072, 114806.2626,
+          116137.9072, 117469.5048, 118813.5186, 120165.4876, 121516.2556, 122875.766, 124250.5444,
+          125621.2222, 127003.2352, 128387.848, 129775.2644, 131181.7776, 132577.3086, 133979.9458,
+          135394.1132, 136800.9078, 138233.217, 139668.5308, 141085.212, 142535.2122, 143969.0684,
+          145420.2872, 146878.1542, 148332.7572, 149800.3202, 151269.66, 152743.6104, 154213.0948,
+          155690.288, 157169.4246, 158672.1756, 160160.059, 161650.6854, 163145.7772, 164645.6726,
+          166159.1952, 167682.1578, 169177.3328, 170700.0118, 172228.8964, 173732.6664, 175265.5556,
+          176787.799, 178317.111, 179856.6914, 181400.865, 182943.4612, 184486.742, 186033.4698,
+          187583.7886, 189148.1868, 190688.4526, 192250.1926, 193810.9042, 195354.2972, 196938.7682,
+          198493.5898, 200079.2824, 201618.912, 203205.5492, 204765.5798, 206356.1124, 207929.3064,
+          209498.7196, 211086.229, 212675.1324, 214256.7892, 215826.2392, 217412.8474, 218995.6724,
+          220618.6038, 222207.1166, 223781.0364, 225387.4332, 227005.7928, 228590.4336, 230217.8738,
+          231805.1054, 233408.9, 234995.3432, 236601.4956, 238190.7904, 239817.2548, 241411.2832,
+          243002.4066, 244640.1884, 246255.3128, 247849.3508, 249479.9734, 251106.8822, 252705.027,
+          254332.9242, 255935.129, 257526.9014, 259154.772, 260777.625, 262390.253, 264004.4906,
+          265643.59, 267255.4076, 268873.426, 270470.7252, 272106.4804, 273722.4456, 275337.794,
+          276945.7038, 278592.9154, 280204.3726, 281841.1606, 283489.171, 285130.1716, 286735.3362,
+          288364.7164, 289961.1814, 291595.5524, 293285.683, 294899.6668, 296499.3434, 298128.0462,
+          299761.8946, 301394.2424, 302997.6748, 304615.1478, 306269.7724, 307886.114, 309543.1028,
+          311153.2862, 312782.8546, 314421.2008, 316033.2438, 317692.9636, 319305.2648, 320948.7406,
+          322566.3364, 324228.4224, 325847.1542,},
+      // precision 17
+      {94542, 96125.811, 97728.019, 99348.558, 100987.9705, 102646.7565, 104324.5125, 106021.7435,
+          107736.7865, 109469.272, 111223.9465, 112995.219, 114787.432, 116593.152, 118422.71,
+          120267.2345, 122134.6765, 124020.937, 125927.2705, 127851.255, 129788.9485, 131751.016,
+          133726.8225, 135722.592, 137736.789, 139770.568, 141821.518, 143891.343, 145982.1415,
+          148095.387, 150207.526, 152355.649, 154515.6415, 156696.05, 158887.7575, 161098.159,
+          163329.852, 165569.053, 167837.4005, 170121.6165, 172420.4595, 174732.6265, 177062.77,
+          179412.502, 181774.035, 184151.939, 186551.6895, 188965.691, 191402.8095, 193857.949,
+          196305.0775, 198774.6715, 201271.2585, 203764.78, 206299.3695, 208818.1365, 211373.115,
+          213946.7465, 216532.076, 219105.541, 221714.5375, 224337.5135, 226977.5125, 229613.0655,
+          232270.2685, 234952.2065, 237645.3555, 240331.1925, 243034.517, 245756.0725, 248517.6865,
+          251232.737, 254011.3955, 256785.995, 259556.44, 262368.335, 265156.911, 267965.266,
+          270785.583, 273616.0495, 276487.4835, 279346.639, 282202.509, 285074.3885, 287942.2855,
+          290856.018, 293774.0345, 296678.5145, 299603.6355, 302552.6575, 305492.9785, 308466.8605,
+          311392.581, 314347.538, 317319.4295, 320285.9785, 323301.7325, 326298.3235, 329301.3105,
+          332301.987, 335309.791, 338370.762, 341382.923, 344431.1265, 347464.1545, 350507.28,
+          353619.2345, 356631.2005, 359685.203, 362776.7845, 365886.488, 368958.2255, 372060.6825,
+          375165.4335, 378237.935, 381328.311, 384430.5225, 387576.425, 390683.242, 393839.648,
+          396977.8425, 400101.9805, 403271.296, 406409.8425, 409529.5485, 412678.7, 415847.423,
+          419020.8035, 422157.081, 425337.749, 428479.6165, 431700.902, 434893.1915, 438049.582,
+          441210.5415, 444379.2545, 447577.356, 450741.931, 453959.548, 457137.0935, 460329.846,
+          463537.4815, 466732.3345, 469960.5615, 473164.681, 476347.6345, 479496.173, 482813.1645,
+          486025.6995, 489249.4885, 492460.1945, 495675.8805, 498908.0075, 502131.802, 505374.3855,
+          508550.9915, 511806.7305, 515026.776, 518217.0005, 521523.9855, 524705.9855, 527950.997,
+          531210.0265, 534472.497, 537750.7315, 540926.922, 544207.094, 547429.4345, 550666.3745,
+          553975.3475, 557150.7185, 560399.6165, 563662.697, 566916.7395, 570146.1215, 573447.425,
+          576689.6245, 579874.5745, 583202.337, 586503.0255, 589715.635, 592910.161, 596214.3885,
+          599488.035, 602740.92, 605983.0685, 609248.67, 612491.3605, 615787.912, 619107.5245,
+          622307.9555, 625577.333, 628840.4385, 632085.2155, 635317.6135, 638691.7195, 641887.467,
+          645139.9405, 648441.546, 651666.252, 654941.845,},
+      // precision 18
+      {189084, 192250.913, 195456.774, 198696.946, 201977.762, 205294.444, 208651.754, 212042.099,
+          215472.269, 218941.91, 222443.912, 225996.845, 229568.199, 233193.568, 236844.457,
+          240543.233, 244279.475, 248044.27, 251854.588, 255693.2, 259583.619, 263494.621,
+          267445.385, 271454.061, 275468.769, 279549.456, 283646.446, 287788.198, 291966.099,
+          296181.164, 300431.469, 304718.618, 309024.004, 313393.508, 317760.803, 322209.731,
+          326675.061, 331160.627, 335654.47, 340241.442, 344841.833, 349467.132, 354130.629,
+          358819.432, 363574.626, 368296.587, 373118.482, 377914.93, 382782.301, 387680.669,
+          392601.981, 397544.323, 402529.115, 407546.018, 412593.658, 417638.657, 422762.865,
+          427886.169, 433017.167, 438213.273, 443441.254, 448692.421, 453937.533, 459239.049,
+          464529.569, 469910.083, 475274.03, 480684.473, 486070.26, 491515.237, 496995.651,
+          502476.617, 507973.609, 513497.19, 519083.233, 524726.509, 530305.505, 535945.728,
+          541584.404, 547274.055, 552967.236, 558667.862, 564360.216, 570128.148, 575965.08,
+          581701.952, 587532.523, 593361.144, 599246.128, 605033.418, 610958.779, 616837.117,
+          622772.818, 628672.04, 634675.369, 640574.831, 646585.739, 652574.547, 658611.217,
+          664642.684, 670713.914, 676737.681, 682797.313, 688837.897, 694917.874, 701009.882,
+          707173.648, 713257.254, 719415.392, 725636.761, 731710.697, 737906.209, 744103.074,
+          750313.39, 756504.185, 762712.579, 768876.985, 775167.859, 781359, 787615.959, 793863.597,
+          800245.477, 806464.582, 812785.294, 819005.925, 825403.057, 831676.197, 837936.284,
+          844266.968, 850642.711, 856959.756, 863322.774, 869699.931, 876102.478, 882355.787,
+          888694.463, 895159.952, 901536.143, 907872.631, 914293.672, 920615.14, 927130.974,
+          933409.404, 939922.178, 946331.47, 952745.93, 959209.264, 965590.224, 972077.284,
+          978501.961, 984953.19, 991413.271, 997817.479, 1004222.658, 1010725.676, 1017177.138,
+          1023612.529, 1030098.236, 1036493.719, 1043112.207, 1049537.036, 1056008.096, 1062476.184,
+          1068942.337, 1075524.95, 1081932.864, 1088426.025, 1094776.005, 1101327.448, 1107901.673,
+          1114423.639, 1120884.602, 1127324.923, 1133794.24, 1140328.886, 1146849.376, 1153346.682,
+          1159836.502, 1166478.703, 1172953.304, 1179391.502, 1185950.982, 1192544.052, 1198913.41,
+          1205430.994, 1212015.525, 1218674.042, 1225121.683, 1231551.101, 1238126.379, 1244673.795,
+          1251260.649, 1257697.86, 1264320.983, 1270736.319, 1277274.694, 1283804.95, 1290211.514,
+          1296858.568, 1303455.691,}};
+
+  static final double[][] biasData = {
+      // precision 4
+      {10, 9.717, 9.207, 8.7896, 8.2882, 7.8204, 7.3772, 6.9342, 6.5202, 6.161, 5.7722, 5.4636,
+          5.0396, 4.6766, 4.3566, 4.0454, 3.7936, 3.4856, 3.2666, 2.9946, 2.766, 2.4692, 2.3638,
+          2.0764, 1.7864, 1.7602, 1.4814, 1.433, 1.2926, 1.0664, 0.999600000000001, 0.7956, 0.5366,
+          0.589399999999998, 0.573799999999999, 0.269799999999996, 0.368200000000002,
+          0.0544000000000011, 0.234200000000001, 0.0108000000000033, -0.203400000000002,
+          -0.0701999999999998, -0.129600000000003, -0.364199999999997, -0.480600000000003,
+          -0.226999999999997, -0.322800000000001, -0.382599999999996, -0.511200000000002,
+          -0.669600000000003, -0.749400000000001, -0.500399999999999, -0.617600000000003, -0.6922,
+          -0.601599999999998, -0.416200000000003, -0.338200000000001, -0.782600000000002,
+          -0.648600000000002, -0.919800000000002, -0.851799999999997, -0.962400000000002, -0.6402,
+          -1.1922, -1.0256, -1.086, -1.21899999999999, -0.819400000000002, -0.940600000000003,
+          -1.1554, -1.2072, -1.1752, -1.16759999999999, -1.14019999999999, -1.3754,
+          -1.29859999999999, -1.607, -1.3292, -1.7606,},
+      // precision 5
+      {22, 21.1194, 20.8208, 20.2318, 19.77, 19.2436, 18.7774, 18.2848, 17.8224, 17.3742, 16.9336,
+          16.503, 16.0494, 15.6292, 15.2124, 14.798, 14.367, 13.9728, 13.5944, 13.217, 12.8438,
+          12.3696, 12.0956, 11.7044, 11.324, 11.0668, 10.6698, 10.3644, 10.049, 9.6918, 9.4146,
+          9.082, 8.687, 8.5398, 8.2462, 7.857, 7.6606, 7.4168, 7.1248, 6.9222, 6.6804, 6.447,
+          6.3454, 5.9594, 5.7636, 5.5776, 5.331, 5.19, 4.9676, 4.7564, 4.5314, 4.4442, 4.3708,
+          3.9774, 3.9624, 3.8796, 3.755, 3.472, 3.2076, 3.1024, 2.8908, 2.7338, 2.7728, 2.629,
+          2.413, 2.3266, 2.1524, 2.2642, 2.1806, 2.0566, 1.9192, 1.7598, 1.3516, 1.5802,
+          1.43859999999999, 1.49160000000001, 1.1524, 1.1892, 0.841399999999993, 0.879800000000003,
+          0.837599999999995, 0.469800000000006, 0.765600000000006, 0.331000000000003,
+          0.591399999999993, 0.601200000000006, 0.701599999999999, 0.558199999999999,
+          0.339399999999998, 0.354399999999998, 0.491200000000006, 0.308000000000007,
+          0.355199999999996, -0.0254000000000048, 0.205200000000005, -0.272999999999996,
+          0.132199999999997, 0.394400000000005, -0.241200000000006, 0.242000000000004,
+          0.191400000000002, 0.253799999999998, -0.122399999999999, -0.370800000000003,
+          0.193200000000004, -0.0848000000000013, 0.0867999999999967, -0.327200000000005,
+          -0.285600000000002, 0.311400000000006, -0.128399999999999, -0.754999999999995,
+          -0.209199999999996, -0.293599999999998, -0.364000000000004, -0.253600000000006,
+          -0.821200000000005, -0.253600000000006, -0.510400000000004, -0.383399999999995,
+          -0.491799999999998, -0.220200000000006, -0.0972000000000008, -0.557400000000001,
+          -0.114599999999996, -0.295000000000002, -0.534800000000004, 0.346399999999988,
+          -0.65379999999999, 0.0398000000000138, 0.0341999999999985, -0.995800000000003,
+          -0.523400000000009, -0.489000000000004, -0.274799999999999, -0.574999999999989,
+          -0.482799999999997, 0.0571999999999946, -0.330600000000004, -0.628800000000012,
+          -0.140199999999993, -0.540600000000012, -0.445999999999998, -0.599400000000003,
+          -0.262599999999992, 0.163399999999996, -0.100599999999986, -0.39500000000001,
+          -1.06960000000001, -0.836399999999998, -0.753199999999993, -0.412399999999991,
+          -0.790400000000005, -0.29679999999999, -0.28540000000001, -0.193000000000012,
+          -0.0772000000000048, -0.962799999999987, -0.414800000000014,},
+      // precision 6
+      {45, 44.1902, 43.271, 42.8358, 41.8142, 41.2854, 40.317, 39.354, 38.8924, 37.9436, 37.4596,
+          36.5262, 35.6248, 35.1574, 34.2822, 33.837, 32.9636, 32.074, 31.7042, 30.7976, 30.4772,
+          29.6564, 28.7942, 28.5004, 27.686, 27.291, 26.5672, 25.8556, 25.4982, 24.8204, 24.4252,
+          23.7744, 23.0786, 22.8344, 22.0294, 21.8098, 21.0794, 20.5732, 20.1878, 19.5648, 19.2902,
+          18.6784, 18.3352, 17.8946, 17.3712, 17.0852, 16.499, 16.2686, 15.6844, 15.2234, 14.9732,
+          14.3356, 14.2286, 13.7262, 13.3284, 13.1048, 12.5962, 12.3562, 12.1272, 11.4184, 11.4974,
+          11.0822, 10.856, 10.48, 10.2834, 10.0208, 9.637, 9.51739999999999, 9.05759999999999,
+          8.74760000000001, 8.42700000000001, 8.1326, 8.2372, 8.2788, 7.6776, 7.79259999999999,
+          7.1952, 6.9564, 6.6454, 6.87, 6.5428, 6.19999999999999, 6.02940000000001,
+          5.62780000000001, 5.6782, 5.792, 5.35159999999999, 5.28319999999999, 5.0394,
+          5.07480000000001, 4.49119999999999, 4.84899999999999, 4.696, 4.54040000000001,
+          4.07300000000001, 4.37139999999999, 3.7216, 3.7328, 3.42080000000001, 3.41839999999999,
+          3.94239999999999, 3.27719999999999, 3.411, 3.13079999999999, 2.76900000000001,
+          2.92580000000001, 2.68279999999999, 2.75020000000001, 2.70599999999999, 2.3886,
+          3.01859999999999, 2.45179999999999, 2.92699999999999, 2.41720000000001, 2.41139999999999,
+          2.03299999999999, 2.51240000000001, 2.5564, 2.60079999999999, 2.41720000000001,
+          1.80439999999999, 1.99700000000001, 2.45480000000001, 1.8948, 2.2346, 2.30860000000001,
+          2.15479999999999, 1.88419999999999, 1.6508, 0.677199999999999, 1.72540000000001, 1.4752,
+          1.72280000000001, 1.66139999999999, 1.16759999999999, 1.79300000000001, 1.00059999999999,
+          0.905200000000008, 0.659999999999997, 1.55879999999999, 1.1636, 0.688199999999995,
+          0.712600000000009, 0.450199999999995, 1.1978, 0.975599999999986, 0.165400000000005, 1.727,
+          1.19739999999999, -0.252600000000001, 1.13460000000001, 1.3048, 1.19479999999999,
+          0.313400000000001, 0.878999999999991, 1.12039999999999, 0.853000000000009,
+          1.67920000000001, 0.856999999999999, 0.448599999999999, 1.2362, 0.953399999999988,
+          1.02859999999998, 0.563199999999995, 0.663000000000011, 0.723000000000013,
+          0.756599999999992, 0.256599999999992, -0.837600000000009, 0.620000000000005,
+          0.821599999999989, 0.216600000000028, 0.205600000000004, 0.220199999999977,
+          0.372599999999977, 0.334400000000016, 0.928400000000011, 0.972800000000007,
+          0.192400000000021, 0.487199999999973, -0.413000000000011, 0.807000000000016,
+          0.120600000000024, 0.769000000000005, 0.870799999999974, 0.66500000000002,
+          0.118200000000002, 0.401200000000017, 0.635199999999998, 0.135400000000004,
+          0.175599999999974, 1.16059999999999, 0.34620000000001, 0.521400000000028,
+          -0.586599999999976, -1.16480000000001, 0.968399999999974, 0.836999999999989,
+          0.779600000000016, 0.985799999999983,},
+      // precision 7
+      {91, 89.4934, 87.9758, 86.4574, 84.9718, 83.4954, 81.5302, 80.0756, 78.6374, 77.1782, 75.7888,
+          73.9522, 72.592, 71.2532, 69.9086, 68.5938, 66.9474, 65.6796, 64.4394, 63.2176, 61.9768,
+          60.4214, 59.2528, 58.0102, 56.8658, 55.7278, 54.3044, 53.1316, 52.093, 51.0032, 49.9092,
+          48.6306, 47.5294, 46.5756, 45.6508, 44.662, 43.552, 42.3724, 41.617, 40.5754, 39.7872,
+          38.8444, 37.7988, 36.8606, 36.2118, 35.3566, 34.4476, 33.5882, 32.6816, 32.0824, 31.0258,
+          30.6048, 29.4436, 28.7274, 27.957, 27.147, 26.4364, 25.7592, 25.3386, 24.781, 23.8028,
+          23.656, 22.6544, 21.996, 21.4718, 21.1544, 20.6098, 19.5956, 19.0616, 18.5758, 18.4878,
+          17.5244, 17.2146, 16.724, 15.8722, 15.5198, 15.0414, 14.941, 14.9048, 13.87, 13.4304,
+          13.028, 12.4708, 12.37, 12.0624, 11.4668, 11.5532, 11.4352, 11.2564, 10.2744, 10.2118,
+          9.74720000000002, 10.1456, 9.2928, 8.75040000000001, 8.55279999999999, 8.97899999999998,
+          8.21019999999999, 8.18340000000001, 7.3494, 7.32499999999999, 7.66140000000001,
+          6.90300000000002, 7.25439999999998, 6.9042, 7.21499999999997, 6.28640000000001,
+          6.08139999999997, 6.6764, 6.30099999999999, 5.13900000000001, 5.65800000000002,
+          5.17320000000001, 4.59019999999998, 4.9538, 5.08280000000002, 4.92200000000003,
+          4.99020000000002, 4.7328, 5.4538, 4.11360000000002, 4.22340000000003, 4.08780000000002,
+          3.70800000000003, 4.15559999999999, 4.18520000000001, 3.63720000000001, 3.68220000000002,
+          3.77960000000002, 3.6078, 2.49160000000001, 3.13099999999997, 2.5376, 3.19880000000001,
+          3.21100000000001, 2.4502, 3.52820000000003, 2.91199999999998, 3.04480000000001, 2.7432,
+          2.85239999999999, 2.79880000000003, 2.78579999999999, 1.88679999999999, 2.98860000000002,
+          2.50639999999999, 1.91239999999999, 2.66160000000002, 2.46820000000002, 1.58199999999999,
+          1.30399999999997, 2.27379999999999, 2.68939999999998, 1.32900000000001, 3.10599999999999,
+          1.69080000000002, 2.13740000000001, 2.53219999999999, 1.88479999999998, 1.33240000000001,
+          1.45119999999997, 1.17899999999997, 2.44119999999998, 1.60659999999996, 2.16700000000003,
+          0.77940000000001, 2.37900000000002, 2.06700000000001, 1.46000000000004, 2.91160000000002,
+          1.69200000000001, 0.954600000000028, 2.49300000000005, 2.2722, 1.33500000000004,
+          2.44899999999996, 1.20140000000004, 3.07380000000001, 2.09739999999999, 2.85640000000001,
+          2.29960000000005, 2.40899999999999, 1.97040000000004, 0.809799999999996, 1.65279999999996,
+          2.59979999999996, 0.95799999999997, 2.06799999999998, 2.32780000000002, 4.20159999999998,
+          1.96320000000003, 1.86400000000003, 1.42999999999995, 3.77940000000001, 1.27200000000005,
+          1.86440000000005, 2.20600000000002, 3.21900000000005, 1.5154, 2.61019999999996,},
+      // precision 8
+      {183.2152, 180.2454, 177.2096, 173.6652, 170.6312, 167.6822, 164.249, 161.3296, 158.0038,
+          155.2074, 152.4612, 149.27, 146.5178, 143.4412, 140.8032, 138.1634, 135.1688, 132.6074,
+          129.6946, 127.2664, 124.8228, 122.0432, 119.6824, 116.9464, 114.6268, 112.2626, 109.8376,
+          107.4034, 104.8956, 102.8522, 100.7638, 98.3552, 96.3556, 93.7526, 91.9292, 89.8954,
+          87.8198, 85.7668, 83.298, 81.6688, 79.9466, 77.9746, 76.1672, 74.3474, 72.3028, 70.8912,
+          69.114, 67.4646, 65.9744, 64.4092, 62.6022, 60.843, 59.5684, 58.1652, 56.5426, 55.4152,
+          53.5388, 52.3592, 51.1366, 49.486, 48.3918, 46.5076, 45.509, 44.3834, 43.3498, 42.0668,
+          40.7346, 40.1228, 38.4528, 37.7, 36.644, 36.0518, 34.5774, 33.9068, 32.432, 32.1666,
+          30.434, 29.6644, 28.4894, 27.6312, 26.3804, 26.292, 25.5496000000001, 25.0234, 24.8206,
+          22.6146, 22.4188, 22.117, 20.6762, 20.6576, 19.7864, 19.509, 18.5334, 17.9204, 17.772,
+          16.2924, 16.8654, 15.1836, 15.745, 15.1316, 15.0386, 14.0136, 13.6342, 12.6196, 12.1866,
+          12.4281999999999, 11.3324, 10.4794000000001, 11.5038, 10.129, 9.52800000000002,
+          10.3203999999999, 9.46299999999997, 9.79280000000006, 9.12300000000005, 8.74180000000001,
+          9.2192, 7.51020000000005, 7.60659999999996, 7.01840000000004, 7.22239999999999,
+          7.40139999999997, 6.76179999999999, 7.14359999999999, 5.65060000000005, 5.63779999999997,
+          5.76599999999996, 6.75139999999999, 5.57759999999996, 3.73220000000003, 5.8048,
+          5.63019999999995, 4.93359999999996, 3.47979999999995, 4.33879999999999, 3.98940000000005,
+          3.81960000000004, 3.31359999999995, 3.23080000000004, 3.4588, 3.08159999999998, 3.4076,
+          3.00639999999999, 2.38779999999997, 2.61900000000003, 1.99800000000005, 3.34820000000002,
+          2.95060000000001, 0.990999999999985, 2.11440000000005, 2.20299999999997, 2.82219999999995,
+          2.73239999999998, 2.7826, 3.76660000000004, 2.26480000000004, 2.31280000000004,
+          2.40819999999997, 2.75360000000001, 3.33759999999995, 2.71559999999999, 1.7478000000001,
+          1.42920000000004, 2.39300000000003, 2.22779999999989, 2.34339999999997, 0.87259999999992,
+          3.88400000000001, 1.80600000000004, 1.91759999999999, 1.16779999999994, 1.50320000000011,
+          2.52500000000009, 0.226400000000012, 2.31500000000005, 0.930000000000064,
+          1.25199999999995, 2.14959999999996, 0.0407999999999902, 2.5447999999999, 1.32960000000003,
+          0.197400000000016, 2.52620000000002, 3.33279999999991, -1.34300000000007,
+          0.422199999999975, 0.917200000000093, 1.12920000000008, 1.46060000000011,
+          1.45779999999991, 2.8728000000001, 3.33359999999993, -1.34079999999994, 1.57680000000005,
+          0.363000000000056, 1.40740000000005, 0.656600000000026, 0.801400000000058,
+          -0.454600000000028, 1.51919999999996,},
+      // precision 9
+      {368, 361.8294, 355.2452, 348.6698, 342.1464, 336.2024, 329.8782, 323.6598, 317.462, 311.2826,
+          305.7102, 299.7416, 293.9366, 288.1046, 282.285, 277.0668, 271.306, 265.8448, 260.301,
+          254.9886, 250.2422, 244.8138, 239.7074, 234.7428, 229.8402, 225.1664, 220.3534, 215.594,
+          210.6886, 205.7876, 201.65, 197.228, 192.8036, 188.1666, 184.0818, 180.0824, 176.2574,
+          172.302, 168.1644, 164.0056, 160.3802, 156.7192, 152.5234, 149.2084, 145.831, 142.485,
+          139.1112, 135.4764, 131.76, 129.3368, 126.5538, 122.5058, 119.2646, 116.5902, 113.3818,
+          110.8998, 107.9532, 105.2062, 102.2798, 99.4728, 96.9582, 94.3292, 92.171,
+          89.7809999999999, 87.5716, 84.7048, 82.5322, 79.875, 78.3972, 75.3464, 73.7274, 71.2834,
+          70.1444, 68.4263999999999, 66.0166, 64.018, 62.0437999999999, 60.3399999999999, 58.6856,
+          57.9836, 55.0311999999999, 54.6769999999999, 52.3188, 51.4846, 49.4423999999999, 47.739,
+          46.1487999999999, 44.9202, 43.4059999999999, 42.5342000000001, 41.2834, 38.8954000000001,
+          38.3286000000001, 36.2146, 36.6684, 35.9946, 33.123, 33.4338, 31.7378000000001, 29.076,
+          28.9692, 27.4964, 27.0998, 25.9864, 26.7754, 24.3208, 23.4838, 22.7388000000001,
+          24.0758000000001, 21.9097999999999, 20.9728, 19.9228000000001, 19.9292, 16.617, 17.05,
+          18.2996000000001, 15.6128000000001, 15.7392, 14.5174, 13.6322, 12.2583999999999,
+          13.3766000000001, 11.423, 13.1232, 9.51639999999998, 10.5938000000001, 9.59719999999993,
+          8.12220000000002, 9.76739999999995, 7.50440000000003, 7.56999999999994, 6.70440000000008,
+          6.41419999999994, 6.71019999999999, 5.60940000000005, 4.65219999999999, 6.84099999999989,
+          3.4072000000001, 3.97859999999991, 3.32760000000007, 5.52160000000003, 3.31860000000006,
+          2.06940000000009, 4.35400000000004, 1.57500000000005, 0.280799999999999, 2.12879999999996,
+          -0.214799999999968, -0.0378000000000611, -0.658200000000079, 0.654800000000023,
+          -0.0697999999999865, 0.858400000000074, -2.52700000000004, -2.1751999999999,
+          -3.35539999999992, -1.04019999999991, -0.651000000000067, -2.14439999999991,
+          -1.96659999999997, -3.97939999999994, -0.604400000000169, -3.08260000000018,
+          -3.39159999999993, -5.29640000000018, -5.38920000000007, -5.08759999999984,
+          -4.69900000000007, -5.23720000000003, -3.15779999999995, -4.97879999999986,
+          -4.89899999999989, -7.48880000000008, -5.94799999999987, -5.68060000000014,
+          -6.67180000000008, -4.70499999999993, -7.27779999999984, -4.6579999999999,
+          -4.4362000000001, -4.32139999999981, -5.18859999999995, -6.66879999999992,
+          -6.48399999999992, -5.1260000000002, -4.4032000000002, -6.13500000000022,
+          -5.80819999999994, -4.16719999999987, -4.15039999999999, -7.45600000000013,
+          -7.24080000000004, -9.83179999999993, -5.80420000000004, -8.6561999999999,
+          -6.99940000000015, -10.5473999999999, -7.34139999999979, -6.80999999999995,
+          -6.29719999999998, -6.23199999999997,},
+      // precision 10
+      {737.1256, 724.4234, 711.1064, 698.4732, 685.4636, 673.0644, 660.488, 647.9654, 636.0832,
+          623.7864, 612.1992, 600.2176, 588.5228, 577.1716, 565.7752, 554.899, 543.6126, 532.6492,
+          521.9474, 511.5214, 501.1064, 490.6364, 480.2468, 470.4588, 460.3832, 451.0584, 440.8606,
+          431.3868, 422.5062, 413.1862, 404.463, 395.339, 386.1936, 378.1292, 369.1854, 361.2908,
+          353.3324, 344.8518, 337.5204, 329.4854, 321.9318, 314.552, 306.4658, 299.4256, 292.849,
+          286.152, 278.8956, 271.8792, 265.118, 258.62, 252.5132, 245.9322, 239.7726, 233.6086,
+          227.5332, 222.5918, 216.4294, 210.7662, 205.4106, 199.7338, 194.9012, 188.4486, 183.1556,
+          178.6338, 173.7312, 169.6264, 163.9526, 159.8742, 155.8326, 151.1966, 147.5594, 143.07,
+          140.037, 134.1804, 131.071, 127.4884, 124.0848, 120.2944, 117.333, 112.9626, 110.2902,
+          107.0814, 103.0334, 99.4832000000001, 96.3899999999999, 93.7202000000002,
+          90.1714000000002, 87.2357999999999, 85.9346, 82.8910000000001, 80.0264000000002,
+          78.3834000000002, 75.1543999999999, 73.8683999999998, 70.9895999999999, 69.4367999999999,
+          64.8701999999998, 65.0408000000002, 61.6738, 59.5207999999998, 57.0158000000001, 54.2302,
+          53.0962, 50.4985999999999, 52.2588000000001, 47.3914, 45.6244000000002, 42.8377999999998,
+          43.0072, 40.6516000000001, 40.2453999999998, 35.2136, 36.4546, 33.7849999999999,
+          33.2294000000002, 32.4679999999998, 30.8670000000002, 28.6507999999999, 28.9099999999999,
+          27.5983999999999, 26.1619999999998, 24.5563999999999, 23.2328000000002, 21.9484000000002,
+          21.5902000000001, 21.3346000000001, 17.7031999999999, 20.6111999999998, 19.5545999999999,
+          15.7375999999999, 17.0720000000001, 16.9517999999998, 15.326, 13.1817999999998,
+          14.6925999999999, 13.0859999999998, 13.2754, 10.8697999999999, 11.248, 7.3768,
+          4.72339999999986, 7.97899999999981, 8.7503999999999, 7.68119999999999, 9.7199999999998,
+          7.73919999999998, 5.6224000000002, 7.44560000000001, 6.6601999999998, 5.9058,
+          4.00199999999995, 4.51699999999983, 4.68240000000014, 3.86220000000003, 5.13639999999987,
+          5.98500000000013, 2.47719999999981, 2.61999999999989, 1.62800000000016, 4.65000000000009,
+          0.225599999999758, 0.831000000000131, -0.359400000000278, 1.27599999999984,
+          -2.92559999999958, -0.0303999999996449, 2.37079999999969, -2.0033999999996,
+          0.804600000000391, 0.30199999999968, 1.1247999999996, -2.6880000000001,
+          0.0321999999996478, -1.18099999999959, -3.9402, -1.47940000000017, -0.188400000000001,
+          -2.10720000000038, -2.04159999999956, -3.12880000000041, -4.16160000000036,
+          -0.612799999999879, -3.48719999999958, -8.17900000000009, -5.37780000000021,
+          -4.01379999999972, -5.58259999999973, -5.73719999999958, -7.66799999999967,
+          -5.69520000000011, -1.1247999999996, -5.58520000000044, -8.04560000000038,
+          -4.64840000000004, -11.6468000000004, -7.97519999999986, -5.78300000000036,
+          -7.67420000000038, -10.6328000000003, -9.81720000000041,},
+      // precision 11
+      {1476, 1449.6014, 1423.5802, 1397.7942, 1372.3042, 1347.2062, 1321.8402, 1297.2292, 1272.9462,
+          1248.9926, 1225.3026, 1201.4252, 1178.0578, 1155.6092, 1132.626, 1110.5568, 1088.527,
+          1066.5154, 1045.1874, 1024.3878, 1003.37, 982.1972, 962.5728, 942.1012, 922.9668, 903.292,
+          884.0772, 864.8578, 846.6562, 828.041, 809.714, 792.3112, 775.1806, 757.9854, 740.656,
+          724.346, 707.5154, 691.8378, 675.7448, 659.6722, 645.5722, 630.1462, 614.4124, 600.8728,
+          585.898, 572.408, 558.4926, 544.4938, 531.6776, 517.282, 505.7704, 493.1012, 480.7388,
+          467.6876, 456.1872, 445.5048, 433.0214, 420.806, 411.409, 400.4144, 389.4294, 379.2286,
+          369.651, 360.6156, 350.337, 342.083, 332.1538, 322.5094, 315.01, 305.6686, 298.1678,
+          287.8116, 280.9978, 271.9204, 265.3286, 257.5706, 249.6014, 242.544, 235.5976, 229.583,
+          220.9438, 214.672, 208.2786, 201.8628, 195.1834, 191.505, 186.1816, 178.5188, 172.2294,
+          167.8908, 161.0194, 158.052, 151.4588, 148.1596, 143.4344, 138.5238, 133.13, 127.6374,
+          124.8162, 118.7894, 117.3984, 114.6078, 109.0858, 105.1036, 103.6258, 98.6018000000004,
+          95.7618000000002, 93.5821999999998, 88.5900000000001, 86.9992000000002, 82.8800000000001,
+          80.4539999999997, 74.6981999999998, 74.3644000000004, 73.2914000000001, 65.5709999999999,
+          66.9232000000002, 65.1913999999997, 62.5882000000001, 61.5702000000001, 55.7035999999998,
+          56.1764000000003, 52.7596000000003, 53.0302000000001, 49.0609999999997, 48.4694, 44.933,
+          46.0474000000004, 44.7165999999997, 41.9416000000001, 39.9207999999999, 35.6328000000003,
+          35.5276000000003, 33.1934000000001, 33.2371999999996, 33.3864000000003, 33.9228000000003,
+          30.2371999999996, 29.1373999999996, 25.2272000000003, 24.2942000000003, 19.8338000000003,
+          18.9005999999999, 23.0907999999999, 21.8544000000002, 19.5176000000001, 15.4147999999996,
+          16.9314000000004, 18.6737999999996, 12.9877999999999, 14.3688000000002, 12.0447999999997,
+          15.5219999999999, 12.5299999999997, 14.5940000000001, 14.3131999999996, 9.45499999999993,
+          12.9441999999999, 3.91139999999996, 13.1373999999996, 5.44720000000052, 9.82779999999912,
+          7.87279999999919, 3.67760000000089, 5.46980000000076, 5.55099999999948, 5.65979999999945,
+          3.89439999999922, 3.1275999999998, 5.65140000000065, 6.3062000000009, 3.90799999999945,
+          1.87060000000019, 5.17020000000048, 2.46680000000015, 0.770000000000437,
+          -3.72340000000077, 1.16400000000067, 8.05340000000069, 0.135399999999208,
+          2.15940000000046, 0.766999999999825, 1.0594000000001, 3.15500000000065,
+          -0.287399999999252, 2.37219999999979, -2.86620000000039, -1.63199999999961,
+          -2.22979999999916, -0.15519999999924, -1.46039999999994, -0.262199999999211,
+          -2.34460000000036, -2.8078000000005, -3.22179999999935, -5.60159999999996,
+          -8.42200000000048, -9.43740000000071, 0.161799999999857, -10.4755999999998,
+          -10.0823999999993,},
+      // precision 12
+      {2953, 2900.4782, 2848.3568, 2796.3666, 2745.324, 2694.9598, 2644.648, 2595.539, 2546.1474,
+          2498.2576, 2450.8376, 2403.6076, 2357.451, 2311.38, 2266.4104, 2221.5638, 2176.9676,
+          2134.193, 2090.838, 2048.8548, 2007.018, 1966.1742, 1925.4482, 1885.1294, 1846.4776,
+          1807.4044, 1768.8724, 1731.3732, 1693.4304, 1657.5326, 1621.949, 1586.5532, 1551.7256,
+          1517.6182, 1483.5186, 1450.4528, 1417.865, 1385.7164, 1352.6828, 1322.6708, 1291.8312,
+          1260.9036, 1231.476, 1201.8652, 1173.6718, 1145.757, 1119.2072, 1092.2828, 1065.0434,
+          1038.6264, 1014.3192, 988.5746, 965.0816, 940.1176, 917.9796, 894.5576, 871.1858,
+          849.9144, 827.1142, 805.0818, 783.9664, 763.9096, 742.0816, 724.3962, 706.3454, 688.018,
+          667.4214, 650.3106, 633.0686, 613.8094, 597.818, 581.4248, 563.834, 547.363, 531.5066,
+          520.455400000001, 505.583199999999, 488.366, 476.480799999999, 459.7682, 450.0522,
+          434.328799999999, 423.952799999999, 408.727000000001, 399.079400000001, 387.252200000001,
+          373.987999999999, 360.852000000001, 351.6394, 339.642, 330.902400000001, 322.661599999999,
+          311.662200000001, 301.3254, 291.7484, 279.939200000001, 276.7508, 263.215200000001,
+          254.811400000001, 245.5494, 242.306399999999, 234.8734, 223.787200000001, 217.7156,
+          212.0196, 200.793, 195.9748, 189.0702, 182.449199999999, 177.2772, 170.2336, 164.741,
+          158.613600000001, 155.311, 147.5964, 142.837, 137.3724, 132.0162, 130.0424, 121.9804,
+          120.451800000001, 114.8968, 111.585999999999, 105.933199999999, 101.705, 98.5141999999996,
+          95.0488000000005, 89.7880000000005, 91.4750000000004, 83.7764000000006, 80.9698000000008,
+          72.8574000000008, 73.1615999999995, 67.5838000000003, 62.6263999999992, 63.2638000000006,
+          66.0977999999996, 52.0843999999997, 58.9956000000002, 47.0912000000008, 46.4956000000002,
+          48.4383999999991, 47.1082000000006, 43.2392, 37.2759999999998, 40.0283999999992,
+          35.1864000000005, 35.8595999999998, 32.0998, 28.027, 23.6694000000007, 33.8266000000003,
+          26.3736000000008, 27.2008000000005, 21.3245999999999, 26.4115999999995, 23.4521999999997,
+          19.5013999999992, 19.8513999999996, 10.7492000000002, 18.6424000000006, 13.1265999999996,
+          18.2436000000016, 6.71860000000015, 3.39459999999963, 6.33759999999893, 7.76719999999841,
+          0.813999999998487, 3.82819999999992, 0.826199999999517, 8.07440000000133,
+          -1.59080000000176, 5.01780000000144, 0.455399999998917, -0.24199999999837,
+          0.174800000000687, -9.07640000000174, -4.20160000000033, -3.77520000000004,
+          -4.75179999999818, -5.3724000000002, -8.90680000000066, -6.10239999999976,
+          -5.74120000000039, -9.95339999999851, -3.86339999999836, -13.7304000000004,
+          -16.2710000000006, -7.51359999999841, -3.30679999999847, -13.1339999999982,
+          -10.0551999999989, -6.72019999999975, -8.59660000000076, -10.9307999999983,
+          -1.8775999999998, -4.82259999999951, -13.7788, -21.6470000000008, -10.6735999999983,
+          -15.7799999999988,},
+      // precision 13
+      {5907.5052, 5802.2672, 5697.347, 5593.5794, 5491.2622, 5390.5514, 5290.3376, 5191.6952,
+          5093.5988, 4997.3552, 4902.5972, 4808.3082, 4715.5646, 4624.109, 4533.8216, 4444.4344,
+          4356.3802, 4269.2962, 4183.3784, 4098.292, 4014.79, 3932.4574, 3850.6036, 3771.2712,
+          3691.7708, 3615.099, 3538.1858, 3463.4746, 3388.8496, 3315.6794, 3244.5448, 3173.7516,
+          3103.3106, 3033.6094, 2966.5642, 2900.794, 2833.7256, 2769.81, 2707.3196, 2644.0778,
+          2583.9916, 2523.4662, 2464.124, 2406.073, 2347.0362, 2292.1006, 2238.1716, 2182.7514,
+          2128.4884, 2077.1314, 2025.037, 1975.3756, 1928.933, 1879.311, 1831.0006, 1783.2144,
+          1738.3096, 1694.5144, 1649.024, 1606.847, 1564.7528, 1525.3168, 1482.5372, 1443.9668,
+          1406.5074, 1365.867, 1329.2186, 1295.4186, 1257.9716, 1225.339, 1193.2972, 1156.3578,
+          1125.8686, 1091.187, 1061.4094, 1029.4188, 1000.9126, 972.3272, 944.004199999999,
+          915.7592, 889.965, 862.834200000001, 840.4254, 812.598399999999, 785.924200000001,
+          763.050999999999, 741.793799999999, 721.466, 699.040799999999, 677.997200000002,
+          649.866999999998, 634.911800000002, 609.8694, 591.981599999999, 570.2922,
+          557.129199999999, 538.3858, 521.872599999999, 502.951400000002, 495.776399999999,
+          475.171399999999, 459.751, 439.995200000001, 426.708999999999, 413.7016, 402.3868,
+          387.262599999998, 372.0524, 357.050999999999, 342.5098, 334.849200000001,
+          322.529399999999, 311.613799999999, 295.848000000002, 289.273000000001, 274.093000000001,
+          263.329600000001, 251.389599999999, 245.7392, 231.9614, 229.7952, 217.155200000001,
+          208.9588, 199.016599999999, 190.839199999999, 180.6976, 176.272799999999,
+          166.976999999999, 162.5252, 151.196400000001, 149.386999999999, 133.981199999998,
+          130.0586, 130.164000000001, 122.053400000001, 110.7428, 108.1276, 106.232400000001,
+          100.381600000001, 98.7668000000012, 86.6440000000002, 79.9768000000004, 82.4722000000002,
+          68.7026000000005, 70.1186000000016, 71.9948000000004, 58.998599999999, 59.0492000000013,
+          56.9818000000014, 47.5338000000011, 42.9928, 51.1591999999982, 37.2740000000013,
+          42.7220000000016, 31.3734000000004, 26.8090000000011, 25.8934000000008, 26.5286000000015,
+          29.5442000000003, 19.3503999999994, 26.0760000000009, 17.9527999999991, 14.8419999999969,
+          10.4683999999979, 8.65899999999965, 9.86720000000059, 4.34139999999752,
+          -0.907800000000861, -3.32080000000133, -0.936199999996461, -11.9916000000012,
+          -8.87000000000262, -6.33099999999831, -11.3366000000024, -15.9207999999999,
+          -9.34659999999712, -15.5034000000014, -19.2097999999969, -15.357799999998,
+          -28.2235999999975, -30.6898000000001, -19.3271999999997, -25.6083999999973,
+          -24.409599999999, -13.6385999999984, -33.4473999999973, -32.6949999999997,
+          -28.9063999999998, -31.7483999999968, -32.2935999999972, -35.8329999999987,
+          -47.620600000002, -39.0855999999985, -33.1434000000008, -46.1371999999974,
+          -37.5892000000022, -46.8164000000033, -47.3142000000007, -60.2914000000019,
+          -37.7575999999972,},
+      // precision 14
+      {11816.475, 11605.0046, 11395.3792, 11188.7504, 10984.1814, 10782.0086, 10582.0072, 10384.503,
+          10189.178, 9996.2738, 9806.0344, 9617.9798, 9431.394, 9248.7784, 9067.6894, 8889.6824,
+          8712.9134, 8538.8624, 8368.4944, 8197.7956, 8031.8916, 7866.6316, 7703.733, 7544.5726,
+          7386.204, 7230.666, 7077.8516, 6926.7886, 6778.6902, 6631.9632, 6487.304, 6346.7486,
+          6206.4408, 6070.202, 5935.2576, 5799.924, 5671.0324, 5541.9788, 5414.6112, 5290.0274,
+          5166.723, 5047.6906, 4929.162, 4815.1406, 4699.127, 4588.5606, 4477.7394, 4369.4014,
+          4264.2728, 4155.9224, 4055.581, 3955.505, 3856.9618, 3761.3828, 3666.9702, 3575.7764,
+          3482.4132, 3395.0186, 3305.8852, 3221.415, 3138.6024, 3056.296, 2970.4494, 2896.1526,
+          2816.8008, 2740.2156, 2670.497, 2594.1458, 2527.111, 2460.8168, 2387.5114, 2322.9498,
+          2260.6752, 2194.2686, 2133.7792, 2074.767, 2015.204, 1959.4226, 1898.6502, 1850.006,
+          1792.849, 1741.4838, 1687.9778, 1638.1322, 1589.3266, 1543.1394, 1496.8266, 1447.8516,
+          1402.7354, 1361.9606, 1327.0692, 1285.4106, 1241.8112, 1201.6726, 1161.973, 1130.261,
+          1094.2036, 1048.2036, 1020.6436, 990.901400000002, 961.199800000002, 924.769800000002,
+          899.526400000002, 872.346400000002, 834.375, 810.432000000001, 780.659800000001,
+          756.013800000001, 733.479399999997, 707.923999999999, 673.858, 652.222399999999,
+          636.572399999997, 615.738599999997, 586.696400000001, 564.147199999999, 541.679600000003,
+          523.943599999999, 505.714599999999, 475.729599999999, 461.779600000002, 449.750800000002,
+          439.020799999998, 412.7886, 400.245600000002, 383.188199999997, 362.079599999997,
+          357.533799999997, 334.319000000003, 327.553399999997, 308.559399999998, 291.270199999999,
+          279.351999999999, 271.791400000002, 252.576999999997, 247.482400000001, 236.174800000001,
+          218.774599999997, 220.155200000001, 208.794399999999, 201.223599999998, 182.995600000002,
+          185.5268, 164.547400000003, 176.5962, 150.689599999998, 157.8004, 138.378799999999,
+          134.021200000003, 117.614399999999, 108.194000000003, 97.0696000000025, 89.6042000000016,
+          95.6030000000028, 84.7810000000027, 72.635000000002, 77.3482000000004, 59.4907999999996,
+          55.5875999999989, 50.7346000000034, 61.3916000000027, 50.9149999999936, 39.0384000000049,
+          58.9395999999979, 29.633600000001, 28.2032000000036, 26.0078000000067, 17.0387999999948,
+          9.22000000000116, 13.8387999999977, 8.07240000000456, 14.1549999999988, 15.3570000000036,
+          3.42660000000615, 6.24820000000182, -2.96940000000177, -8.79940000000352,
+          -5.97860000000219, -14.4048000000039, -3.4143999999942, -13.0148000000045,
+          -11.6977999999945, -25.7878000000055, -22.3185999999987, -24.409599999999,
+          -31.9756000000052, -18.9722000000038, -22.8678000000073, -30.8972000000067,
+          -32.3715999999986, -22.3907999999938, -43.6720000000059, -35.9038, -39.7492000000057,
+          -54.1641999999993, -45.2749999999942, -42.2989999999991, -44.1089999999967,
+          -64.3564000000042, -49.9551999999967, -42.6116000000038,},
+      // precision 15
+      {23634.0036, 23210.8034, 22792.4744, 22379.1524, 21969.7928, 21565.326, 21165.3532,
+          20770.2806, 20379.9892, 19994.7098, 19613.318, 19236.799, 18865.4382, 18498.8244,
+          18136.5138, 17778.8668, 17426.2344, 17079.32, 16734.778, 16397.2418, 16063.3324,
+          15734.0232, 15409.731, 15088.728, 14772.9896, 14464.1402, 14157.5588, 13855.5958,
+          13559.3296, 13264.9096, 12978.326, 12692.0826, 12413.8816, 12137.3192, 11870.2326,
+          11602.5554, 11340.3142, 11079.613, 10829.5908, 10583.5466, 10334.0344, 10095.5072,
+          9859.694, 9625.2822, 9395.7862, 9174.0586, 8957.3164, 8738.064, 8524.155, 8313.7396,
+          8116.9168, 7913.542, 7718.4778, 7521.65, 7335.5596, 7154.2906, 6968.7396, 6786.3996,
+          6613.236, 6437.406, 6270.6598, 6107.7958, 5945.7174, 5787.6784, 5635.5784, 5482.308,
+          5337.9784, 5190.0864, 5045.9158, 4919.1386, 4771.817, 4645.7742, 4518.4774, 4385.5454,
+          4262.6622, 4142.74679999999, 4015.5318, 3897.9276, 3790.7764, 3685.13800000001, 3573.6274,
+          3467.9706, 3368.61079999999, 3271.5202, 3170.3848, 3076.4656, 2982.38400000001, 2888.4664,
+          2806.4868, 2711.9564, 2634.1434, 2551.3204, 2469.7662, 2396.61139999999, 2318.9902,
+          2243.8658, 2171.9246, 2105.01360000001, 2028.8536, 1960.9952, 1901.4096, 1841.86079999999,
+          1777.54700000001, 1714.5802, 1654.65059999999, 1596.311, 1546.2016, 1492.3296, 1433.8974,
+          1383.84600000001, 1339.4152, 1293.5518, 1245.8686, 1193.50659999999, 1162.27959999999,
+          1107.19439999999, 1069.18060000001, 1035.09179999999, 999.679000000004, 957.679999999993,
+          925.300199999998, 888.099400000006, 848.638600000006, 818.156400000007, 796.748399999997,
+          752.139200000005, 725.271200000003, 692.216, 671.633600000001, 647.939799999993,
+          621.670599999998, 575.398799999995, 561.226599999995, 532.237999999998, 521.787599999996,
+          483.095799999996, 467.049599999998, 465.286399999997, 415.548599999995, 401.047399999996,
+          380.607999999993, 377.362599999993, 347.258799999996, 338.371599999999, 310.096999999994,
+          301.409199999995, 276.280799999993, 265.586800000005, 258.994399999996, 223.915999999997,
+          215.925399999993, 213.503800000006, 191.045400000003, 166.718200000003, 166.259000000005,
+          162.941200000001, 148.829400000002, 141.645999999993, 123.535399999993, 122.329800000007,
+          89.473399999988, 80.1962000000058, 77.5457999999926, 59.1056000000099, 83.3509999999951,
+          52.2906000000075, 36.3979999999865, 40.6558000000077, 42.0003999999899, 19.6630000000005,
+          19.7153999999864, -8.38539999999921, -0.692799999989802, 0.854800000000978,
+          3.23219999999856, -3.89040000000386, -5.25880000001052, -24.9052000000083,
+          -22.6837999999989, -26.4286000000138, -34.997000000003, -37.0216000000073,
+          -43.430400000012, -58.2390000000014, -68.8034000000043, -56.9245999999985,
+          -57.8583999999973, -77.3097999999882, -73.2793999999994, -81.0738000000129,
+          -87.4530000000086, -65.0254000000132, -57.296399999992, -96.2746000000043, -103.25,
+          -96.081600000005, -91.5542000000132, -102.465200000006, -107.688599999994,
+          -101.458000000013, -109.715800000005,},
+      // precision 16
+      {47270, 46423.3584, 45585.7074, 44757.152, 43938.8416, 43130.9514, 42330.03, 41540.407,
+          40759.6348, 39988.206, 39226.5144, 38473.2096, 37729.795, 36997.268, 36272.6448,
+          35558.665, 34853.0248, 34157.4472, 33470.5204, 32793.5742, 32127.0194, 31469.4182,
+          30817.6136, 30178.6968, 29546.8908, 28922.8544, 28312.271, 27707.0924, 27114.0326,
+          26526.692, 25948.6336, 25383.7826, 24823.5998, 24272.2974, 23732.2572, 23201.4976,
+          22674.2796, 22163.6336, 21656.515, 21161.7362, 20669.9368, 20189.4424, 19717.3358,
+          19256.3744, 18795.9638, 18352.197, 17908.5738, 17474.391, 17052.918, 16637.2236,
+          16228.4602, 15823.3474, 15428.6974, 15043.0284, 14667.6278, 14297.4588, 13935.2882,
+          13578.5402, 13234.6032, 12882.1578, 12548.0728, 12219.231, 11898.0072, 11587.2626,
+          11279.9072, 10973.5048, 10678.5186, 10392.4876, 10105.2556, 9825.766, 9562.5444,
+          9294.2222, 9038.2352, 8784.848, 8533.2644, 8301.7776, 8058.30859999999, 7822.94579999999,
+          7599.11319999999, 7366.90779999999, 7161.217, 6957.53080000001, 6736.212,
+          6548.21220000001, 6343.06839999999, 6156.28719999999, 5975.15419999999, 5791.75719999999,
+          5621.32019999999, 5451.66, 5287.61040000001, 5118.09479999999, 4957.288, 4798.4246,
+          4662.17559999999, 4512.05900000001, 4364.68539999999, 4220.77720000001, 4082.67259999999,
+          3957.19519999999, 3842.15779999999, 3699.3328, 3583.01180000001, 3473.8964,
+          3338.66639999999, 3233.55559999999, 3117.799, 3008.111, 2909.69140000001,
+          2814.86499999999, 2719.46119999999, 2624.742, 2532.46979999999, 2444.7886, 2370.1868,
+          2272.45259999999, 2196.19260000001, 2117.90419999999, 2023.2972, 1969.76819999999,
+          1885.58979999999, 1833.2824, 1733.91200000001, 1682.54920000001, 1604.57980000001,
+          1556.11240000001, 1491.3064, 1421.71960000001, 1371.22899999999, 1322.1324, 1264.7892,
+          1196.23920000001, 1143.8474, 1088.67240000001, 1073.60380000001, 1023.11660000001,
+          959.036400000012, 927.433199999999, 906.792799999996, 853.433599999989, 841.873800000001,
+          791.1054, 756.899999999994, 704.343200000003, 672.495599999995, 622.790399999998,
+          611.254799999995, 567.283200000005, 519.406599999988, 519.188400000014, 495.312800000014,
+          451.350799999986, 443.973399999988, 431.882199999993, 392.027000000002, 380.924200000009,
+          345.128999999986, 298.901400000002, 287.771999999997, 272.625, 247.253000000026,
+          222.490600000019, 223.590000000026, 196.407599999977, 176.425999999978, 134.725199999986,
+          132.4804, 110.445599999977, 86.7939999999944, 56.7038000000175, 64.915399999998,
+          38.3726000000024, 37.1606000000029, 46.170999999973, 49.1716000000015, 15.3362000000197,
+          6.71639999997569, -34.8185999999987, -39.4476000000141, 12.6830000000191,
+          -12.3331999999937, -50.6565999999875, -59.9538000000175, -65.1054000000004,
+          -70.7576000000117, -106.325200000021, -126.852200000023, -110.227599999984,
+          -132.885999999999, -113.897200000007, -142.713800000027, -151.145399999979,
+          -150.799200000009, -177.756200000003, -156.036399999983, -182.735199999996,
+          -177.259399999981, -198.663600000029, -174.577600000019, -193.84580000001,},
+      // precision 17
+      {94541, 92848.811, 91174.019, 89517.558, 87879.9705, 86262.7565, 84663.5125, 83083.7435,
+          81521.7865, 79977.272, 78455.9465, 76950.219, 75465.432, 73994.152, 72546.71, 71115.2345,
+          69705.6765, 68314.937, 66944.2705, 65591.255, 64252.9485, 62938.016, 61636.8225,
+          60355.592, 59092.789, 57850.568, 56624.518, 55417.343, 54231.1415, 53067.387, 51903.526,
+          50774.649, 49657.6415, 48561.05, 47475.7575, 46410.159, 45364.852, 44327.053, 43318.4005,
+          42325.6165, 41348.4595, 40383.6265, 39436.77, 38509.502, 37594.035, 36695.939, 35818.6895,
+          34955.691, 34115.8095, 33293.949, 32465.0775, 31657.6715, 30877.2585, 30093.78,
+          29351.3695, 28594.1365, 27872.115, 27168.7465, 26477.076, 25774.541, 25106.5375,
+          24452.5135, 23815.5125, 23174.0655, 22555.2685, 21960.2065, 21376.3555, 20785.1925,
+          20211.517, 19657.0725, 19141.6865, 18579.737, 18081.3955, 17578.995, 17073.44, 16608.335,
+          16119.911, 15651.266, 15194.583, 14749.0495, 14343.4835, 13925.639, 13504.509, 13099.3885,
+          12691.2855, 12328.018, 11969.0345, 11596.5145, 11245.6355, 10917.6575, 10580.9785,
+          10277.8605, 9926.58100000001, 9605.538, 9300.42950000003, 8989.97850000003,
+          8728.73249999998, 8448.3235, 8175.31050000002, 7898.98700000002, 7629.79100000003,
+          7413.76199999999, 7149.92300000001, 6921.12650000001, 6677.1545, 6443.28000000003,
+          6278.23450000002, 6014.20049999998, 5791.20299999998, 5605.78450000001, 5438.48800000001,
+          5234.2255, 5059.6825, 4887.43349999998, 4682.935, 4496.31099999999, 4322.52250000002,
+          4191.42499999999, 4021.24200000003, 3900.64799999999, 3762.84250000003, 3609.98050000001,
+          3502.29599999997, 3363.84250000003, 3206.54849999998, 3079.70000000001, 2971.42300000001,
+          2867.80349999998, 2727.08100000001, 2630.74900000001, 2496.6165, 2440.902,
+          2356.19150000002, 2235.58199999999, 2120.54149999999, 2012.25449999998, 1933.35600000003,
+          1820.93099999998, 1761.54800000001, 1663.09350000002, 1578.84600000002, 1509.48149999999,
+          1427.3345, 1379.56150000001, 1306.68099999998, 1212.63449999999, 1084.17300000001,
+          1124.16450000001, 1060.69949999999, 1007.48849999998, 941.194499999983, 879.880500000028,
+          836.007500000007, 782.802000000025, 748.385499999975, 647.991500000004, 626.730500000005,
+          570.776000000013, 484.000500000024, 513.98550000001, 418.985499999952, 386.996999999974,
+          370.026500000036, 355.496999999974, 356.731499999994, 255.92200000002, 259.094000000041,
+          205.434499999974, 165.374500000034, 197.347500000033, 95.718499999959, 67.6165000000037,
+          54.6970000000438, 31.7395000000251, -15.8784999999916, 8.42500000004657,
+          -26.3754999999655, -118.425500000012, -66.6629999999423, -42.9745000000112,
+          -107.364999999991, -189.839000000036, -162.611499999999, -164.964999999967,
+          -189.079999999958, -223.931499999948, -235.329999999958, -269.639500000048,
+          -249.087999999989, -206.475499999942, -283.04449999996, -290.667000000016,
+          -304.561499999953, -336.784499999951, -380.386500000022, -283.280499999993,
+          -364.533000000054, -389.059499999974, -364.454000000027, -415.748000000021,
+          -417.155000000028,},
+      // precision 18
+      {189083, 185696.913, 182348.774, 179035.946, 175762.762, 172526.444, 169329.754, 166166.099,
+          163043.269, 159958.91, 156907.912, 153906.845, 150924.199, 147996.568, 145093.457,
+          142239.233, 139421.475, 136632.27, 133889.588, 131174.2, 128511.619, 125868.621,
+          123265.385, 120721.061, 118181.769, 115709.456, 113252.446, 110840.198, 108465.099,
+          106126.164, 103823.469, 101556.618, 99308.004, 97124.508, 94937.803, 92833.731, 90745.061,
+          88677.627, 86617.47, 84650.442, 82697.833, 80769.132, 78879.629, 77014.432, 75215.626,
+          73384.587, 71652.482, 69895.93, 68209.301, 66553.669, 64921.981, 63310.323, 61742.115,
+          60205.018, 58698.658, 57190.657, 55760.865, 54331.169, 52908.167, 51550.273, 50225.254,
+          48922.421, 47614.533, 46362.049, 45098.569, 43926.083, 42736.03, 41593.473, 40425.26,
+          39316.237, 38243.651, 37170.617, 36114.609, 35084.19, 34117.233, 33206.509, 32231.505,
+          31318.728, 30403.404, 29540.0550000001, 28679.236, 27825.862, 26965.216, 26179.148,
+          25462.08, 24645.952, 23922.523, 23198.144, 22529.128, 21762.4179999999, 21134.779,
+          20459.117, 19840.818, 19187.04, 18636.3689999999, 17982.831, 17439.7389999999, 16874.547,
+          16358.2169999999, 15835.684, 15352.914, 14823.681, 14329.313, 13816.897, 13342.874,
+          12880.882, 12491.648, 12021.254, 11625.392, 11293.7610000001, 10813.697, 10456.209,
+          10099.074, 9755.39000000001, 9393.18500000006, 9047.57900000003, 8657.98499999999,
+          8395.85900000005, 8033, 7736.95900000003, 7430.59699999995, 7258.47699999996,
+          6924.58200000005, 6691.29399999999, 6357.92500000005, 6202.05700000003, 5921.19700000004,
+          5628.28399999999, 5404.96799999999, 5226.71100000001, 4990.75600000005, 4799.77399999998,
+          4622.93099999998, 4472.478, 4171.78700000001, 3957.46299999999, 3868.95200000005,
+          3691.14300000004, 3474.63100000005, 3341.67200000002, 3109.14000000001, 3071.97400000005,
+          2796.40399999998, 2756.17799999996, 2611.46999999997, 2471.93000000005, 2382.26399999997,
+          2209.22400000005, 2142.28399999999, 2013.96100000001, 1911.18999999994, 1818.27099999995,
+          1668.47900000005, 1519.65800000005, 1469.67599999998, 1367.13800000004, 1248.52899999998,
+          1181.23600000003, 1022.71900000004, 1088.20700000005, 959.03600000008, 876.095999999903,
+          791.183999999892, 703.337000000058, 731.949999999953, 586.86400000006, 526.024999999907,
+          323.004999999888, 320.448000000091, 340.672999999952, 309.638999999966, 216.601999999955,
+          102.922999999952, 19.2399999999907, -0.114000000059605, -32.6240000000689,
+          -89.3179999999702, -153.497999999905, -64.2970000000205, -143.695999999996,
+          -259.497999999905, -253.017999999924, -213.948000000091, -397.590000000084,
+          -434.006000000052, -403.475000000093, -297.958000000101, -404.317000000039,
+          -528.898999999976, -506.621000000043, -513.205000000075, -479.351000000024,
+          -596.139999999898, -527.016999999993, -664.681000000099, -680.306000000099,
+          -704.050000000047, -850.486000000034, -757.43200000003, -713.308999999892,}};
+
+  private Format format;
+  private RegisterSet registerSet;
+  private final int m;
+  private final int p;
+
+  // Sparse versions of m and p
+  private int sm;
+  private int sp;
+
+  private final double alphaMM;
+
+  // How big the sparse set is allowed to get before we convert to 'normal'
+  private int sparseSetThreshold;
+  // How big the temp list is allowed to get before we batch merge it into the sparse set
+  private int sortThreshold;
+
+  private int[] tmpSet;
+  private int tmpIndex = 0;
+  private int[] sparseSet;
+
+  /**
+   * This constructor disables the sparse set. If the counter is likely to exceed the sparse set
+   * thresholds than using this constructor will help avoid the extra memory pressure created by
+   * maintaining the sparse set until that threshold is breached.
+   *
+   * @param p - the precision value for the normal set
+   */
+  public HyperLogLogPlus(int p) {
+    this(p, 0);
+  }
+
+  /**
+   * Basic constructor for creating a instance that supports sparse and normal representations. The
+   * values of <code>p</code> and <code>sp</code> define the precision of the Normal and Sparse set
+   * representations for the data structure. <code>p</code> must be a value between 4 and
+   * <code>sp</code> and <code>sp</code> must be less than 32.
+   *
+   * @param p - the precision value for the normal set
+   * @param sp - the precision value for the sparse set
+   */
+  public HyperLogLogPlus(int p, int sp) {
+    this(p, sp, null, null);
+  }
+
+  /**
+   * Constructor to support instances serialized with the legacy sparse encoding scheme.
+   *
+   * @param p - the precision value for the normal set
+   * @param sp - the precision value for the sparse set
+   * @param deltaByteSet - a list of varint byte arrays encoded using a delta encoding scheme
+   */
+  public HyperLogLogPlus(int p, int sp, List<byte[]> deltaByteSet) {
+    this(p, sp);
+    sparseSet = new int[deltaByteSet.size()];
+    int previousValue = 0;
+    for (int i = 0; i < deltaByteSet.size(); i++) {
+      int nextValue = Varint.readUnsignedVarInt(deltaByteSet.get(i));
+      sparseSet[i] = nextValue + previousValue;
+      previousValue = sparseSet[i];
+    }
+  }
+
+  // for constructing a sparse mode hllp
+  private HyperLogLogPlus(int p, int sp, int[] sparseSet) {
+    this(p, sp, sparseSet, null);
+  }
+
+  // for constructing a normal mode hllp
+  private HyperLogLogPlus(int p, int sp, RegisterSet registerSet) {
+    this(p, sp, null, registerSet);
+  }
+
+  private HyperLogLogPlus(int p, int sp, int[] sparseSet, RegisterSet registerSet) {
+    if (p < 4 || (p > sp && sp != 0)) {
+      throw new IllegalArgumentException("p must be between 4 and sp (inclusive)");
+    }
+    if (sp > 32) {
+      throw new IllegalArgumentException("sp values greater than 32 not supported");
+    }
+
+    this.p = p;
+    m = (int) Math.pow(2, p);
+    format = Format.NORMAL;
+    this.registerSet = registerSet;
+    if (registerSet == null) {
+      if (sp > 0) // Use sparse representation
+      {
+        format = Format.SPARSE;
+        this.sp = sp;
+        sm = (int) Math.pow(2, sp);
+        this.sparseSet = sparseSet;
+        sparseSetThreshold = (int) (m * 0.75);
+        sortThreshold = sparseSetThreshold / 4;
+      } else {
+        this.registerSet = new RegisterSet((int) Math.pow(2, p));
+      }
+    }
+
+    this.alphaMM = HyperLogLog.getAlphaMM(p, m);
+  }
+
+  @Override
+  public boolean offerHashed(long hashedLong) {
+    switch (format) {
+      case NORMAL:
+        // find first p bits of x
+        final long idx = hashedLong >>> (64 - p);
+        // Ignore the first p bits (the idx), and then find the number of leading zeros
+        // Push a 1 to where the bit string would have ended if we didnt just push the idx out of
+        // the way
+        // A one is always added to runLength for estimation calculation purposes
+        final int runLength =
+            Long.numberOfLeadingZeros((hashedLong << this.p) | (1 << (this.p - 1))) + 1;
+        return registerSet.updateIfGreater((int) idx, runLength);
+      case SPARSE:
+        // Call the sparse encoding scheme which attempts to stuff as much helpful data into 32 bits
+        // as possible
+        int k = encodeHash(hashedLong, p, sp);
+        if (tmpSet == null) {
+          tmpSet = new int[sortThreshold + 1];
+        }
+        // Put the encoded data into the temp set
+        tmpSet[tmpIndex++] = k;
+        if (sparseSet != null && sparseSet.length > sparseSetThreshold) {
+          mergeTempList();
+          convertToNormal();
+        } else if (tmpIndex > sortThreshold) {
+          mergeTempList();
+        }
+        return true;
+    }
+    return false;
+  }
+
+  @Override
+  public boolean offerHashed(int hashedInt) {
+    throw new UnsupportedOperationException();
+  }
+
+  /**
+   * Add data to estimator based on the mode it is in
+   *
+   * @param o stream element
+   * @return Will almost always return true for sparse mode because the additions are batched in
+   */
+  @O

<TRUNCATED>

[05/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
new file mode 100644
index 0000000..8d0ecb2
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+public class ZRangeByScoreExecutor extends SortedSetExecutor implements Extendable {
+
+  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
+
+  private final String ERROR_LIMIT = "The offset and count cannot be negative";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    boolean withScores = false;
+    byte[] elem4Array = null;
+    int offset = 0;
+    int limit = -1;
+    if (commandElems.size() >= 5) {
+      elem4Array = commandElems.get(4);
+      String elem4 = Coder.bytesToString(elem4Array);
+      int limitIndex = 4;
+      if (elem4.equalsIgnoreCase("WITHSCORES")) {
+        withScores = true;
+        limitIndex++;
+      }
+
+      if (commandElems.size() >= limitIndex + 2) {
+        String limitString = Coder.bytesToString(commandElems.get(limitIndex));
+        if (limitString.equalsIgnoreCase("LIMIT")) {
+          try {
+            byte[] offsetArray = commandElems.get(limitIndex + 1);
+            byte[] limitArray = commandElems.get(limitIndex + 2);
+            offset = Coder.bytesToInt(offsetArray);
+            limit = Coder.bytesToInt(limitArray);
+          } catch (NumberFormatException e) {
+            command.setResponse(
+                Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+            return;
+          }
+        }
+
+        if (offset < 0 || limit < 0) {
+          command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_LIMIT));
+          return;
+        }
+
+        if (limitIndex == 4 && commandElems.size() >= 8) {
+          byte[] lastElemArray = commandElems.get(7);
+          String lastString = Coder.bytesToString(lastElemArray);
+          if (lastString.equalsIgnoreCase("WITHSCORES")) {
+            withScores = true;
+          }
+        }
+      }
+
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    int startIndex = isReverse() ? 3 : 2;
+    int stopIndex = isReverse() ? 2 : 3;
+    boolean startInclusive = true;
+    boolean stopInclusive = true;
+    double start;
+    double stop;
+
+    byte[] startArray = commandElems.get(startIndex);
+    byte[] stopArray = commandElems.get(stopIndex);
+    String startString = Coder.bytesToString(startArray);
+    String stopString = Coder.bytesToString(stopArray);
+
+    if (startArray[0] == Coder.OPEN_BRACE_ID) {
+      startString = startString.substring(1);
+      startInclusive = false;
+    }
+    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
+      stopString = stopString.substring(1);
+      stopInclusive = false;
+    }
+
+    try {
+      start = Coder.stringToDouble(startString);
+      stop = Coder.stringToDouble(stopString);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    Collection<?> list;
+    try {
+      list = getKeys(key, keyRegion, context, start, stop, startInclusive, stopInclusive, offset,
+          limit);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    if (list == null)
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+    else
+      command.setResponse(Coder.zRangeResponse(context.getByteBufAllocator(), list, withScores));
+  }
+
+  private Collection<?> getKeys(ByteArrayWrapper key,
+      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
+      double start, double stop, boolean startInclusive, boolean stopInclusive, int offset,
+      int limit) throws FunctionDomainException, TypeMismatchException, NameResolutionException,
+      QueryInvocationTargetException {
+    if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY || start > stop
+        || (start == stop && (!startInclusive || !stopInclusive)))
+      return null;
+    if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY)
+      return new HashSet(keyRegion.entrySet());
+
+    Query query;
+    Object[] params;
+    if (isReverse()) {
+      if (startInclusive) {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZREVRBSSTISI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZREVRBSSTI, context);
+        }
+      } else {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZREVRBSSI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZREVRBS, context);
+        }
+      }
+      params = new Object[] {start, stop, INFINITY_LIMIT};
+    } else {
+      if (startInclusive) {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZRBSSTISI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZRBSSTI, context);
+        }
+      } else {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZRBSSI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZRBS, context);
+        }
+      }
+      params = new Object[] {start, stop, INFINITY_LIMIT};
+    }
+    if (limit > 0)
+      params[params.length - 1] = (limit + offset);
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+    if (offset < results.size())
+      return (Collection<Struct>) results.asList().subList(offset, results.size());
+    else
+      return null;
+  }
+
+  protected boolean isReverse() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.ZRANGEBYSCORE;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
new file mode 100644
index 0000000..d316faa
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.List;
+
+public class ZRangeExecutor extends SortedSetExecutor implements Extendable {
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    boolean withScores = false;
+
+    if (commandElems.size() >= 5) {
+      byte[] fifthElem = commandElems.get(4);
+      withScores = Coder.bytesToString(fifthElem).equalsIgnoreCase("WITHSCORES");
+
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+
+    int start;
+    int stop;
+    int sSetSize = keyRegion.size();
+
+    try {
+      byte[] startArray = commandElems.get(2);
+      byte[] stopArray = commandElems.get(3);
+      start = Coder.bytesToInt(startArray);
+      stop = Coder.bytesToInt(stopArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    start = getBoundedStartIndex(start, sSetSize);
+    stop = getBoundedEndIndex(stop, sSetSize);
+
+    if (start > stop || start == sSetSize) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+    if (stop == sSetSize)
+      stop--;
+    List<?> list;
+    try {
+      list = getRange(context, key, start, stop);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    command.setResponse(Coder.zRangeResponse(context.getByteBufAllocator(), list, withScores));
+  }
+
+  private List<?> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
+      int stop) throws Exception {
+    Query query;
+
+    if (isReverse())
+      query = getQuery(key, SortedSetQuery.ZRANGE, context);
+    else
+      query = getQuery(key, SortedSetQuery.ZREVRANGE, context);
+
+    Object[] params = {stop + 1};
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    List<?> list = results.asList();
+
+    return list.subList(start, stop + 1);
+
+  }
+
+  protected boolean isReverse() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.ZRANGE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
new file mode 100644
index 0000000..d3b6bee
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.List;
+
+public class ZRankExecutor extends SortedSetExecutor implements Extendable {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
+
+    DoubleWrapper value = keyRegion.get(member);
+
+    if (value == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    int rank;
+    try {
+      rank = getRange(context, key, member, value);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), rank));
+  }
+
+  private int getRange(ExecutionHandlerContext context, ByteArrayWrapper key,
+      ByteArrayWrapper member, DoubleWrapper valueWrapper) throws Exception {
+    Query query;
+    if (isReverse())
+      query = getQuery(key, SortedSetQuery.ZREVRANK, context);
+    else
+      query = getQuery(key, SortedSetQuery.ZRANK, context);
+
+    Object[] params = {valueWrapper.score, valueWrapper.score, member};
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    return (Integer) results.asList().get(0);
+
+  }
+
+  protected boolean isReverse() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.ZRANK;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
new file mode 100644
index 0000000..93e0c32
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class ZRemExecutor extends SortedSetExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREM));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    int numDeletedMembers = 0;
+
+    for (int i = 2; i < commandElems.size(); i++) {
+      byte[] memberArray = commandElems.get(i);
+      ByteArrayWrapper member = new ByteArrayWrapper(memberArray);
+      Object oldVal = keyRegion.remove(member);
+      if (oldVal != null)
+        numDeletedMembers++;
+    }
+    if (keyRegion.isEmpty())
+      context.getRegionProvider().removeKey(key);
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeletedMembers));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java
new file mode 100644
index 0000000..73f380b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class ZRemRangeByLexExecutor extends SortedSetExecutor {
+
+  private final int ERROR_NOT_EXISTS = 0;
+
+  private final String ERROR_ILLEGAL_SYNTAX =
+      "The min and max strings must either start with a (, [ or be - or +";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREMRANGEBYLEX));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command
+          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), ERROR_NOT_EXISTS));
+      return;
+    }
+
+    boolean minInclusive = false;
+    boolean maxInclusive = false;
+
+    byte[] minArray = commandElems.get(2);
+    byte[] maxArray = commandElems.get(3);
+    String startString = Coder.bytesToString(minArray);
+    String stopString = Coder.bytesToString(maxArray);
+
+    if (minArray[0] == Coder.OPEN_BRACE_ID) {
+      startString = startString.substring(1);
+      minInclusive = false;
+    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
+      startString = startString.substring(1);
+      minInclusive = true;
+    } else if (minArray[0] != Coder.HYPHEN_ID) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
+      return;
+    }
+
+    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
+      stopString = stopString.substring(1);
+      maxInclusive = false;
+    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
+      stopString = stopString.substring(1);
+      maxInclusive = true;
+    } else if (maxArray[0] != Coder.PLUS_ID) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
+      return;
+    }
+
+    Collection<ByteArrayWrapper> removeList;
+    try {
+      removeList = getRange(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
+          Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    int numRemoved = 0;
+
+    for (ByteArrayWrapper entry : removeList) {
+      Object oldVal = keyRegion.remove(entry);
+      if (oldVal != null)
+        numRemoved++;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+  }
+
+  private Collection<ByteArrayWrapper> getRange(ByteArrayWrapper key,
+      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
+      ByteArrayWrapper start, ByteArrayWrapper stop, boolean startInclusive, boolean stopInclusive)
+      throws Exception {
+    if (start.equals("-") && stop.equals("+"))
+      return new ArrayList<ByteArrayWrapper>(keyRegion.keySet());
+    else if (start.equals("+") || stop.equals("-"))
+      return null;
+
+    Query query;
+    Object[] params;
+    if (start.equals("-")) {
+      if (stopInclusive) {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINF, context);
+      }
+      params = new Object[] {stop, INFINITY_LIMIT};
+    } else if (stop.equals("+")) {
+      if (startInclusive) {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINF, context);
+      }
+      params = new Object[] {start, INFINITY_LIMIT};
+    } else {
+      if (startInclusive) {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTISI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTI, context);
+        }
+      } else {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEX, context);
+        }
+      }
+      params = new Object[] {start, stop, INFINITY_LIMIT};
+    }
+
+    @SuppressWarnings("unchecked")
+    SelectResults<ByteArrayWrapper> results =
+        (SelectResults<ByteArrayWrapper>) query.execute(params);
+
+    return results.asList();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java
new file mode 100644
index 0000000..abd2a96
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.Region.Entry;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.List;
+
+public class ZRemRangeByRankExecutor extends SortedSetExecutor {
+
+  private final int NONE_REMOVED = 0;
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREMRANGEBYRANK));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NONE_REMOVED));
+      return;
+    }
+
+    int startRank;
+    int stopRank;
+
+    try {
+      startRank = Coder.bytesToInt(commandElems.get(2));
+      stopRank = Coder.bytesToInt(commandElems.get(3));
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    int sSetSize = keyRegion.size();
+
+    startRank = getBoundedStartIndex(startRank, sSetSize);
+    stopRank = getBoundedEndIndex(stopRank, sSetSize);
+    if (stopRank > sSetSize - 1)
+      stopRank = sSetSize - 1;
+
+    if (startRank > stopRank) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    int numRemoved = 0;
+    List<?> removeList = null;
+    try {
+      if (startRank == 0 && stopRank == sSetSize - 1) {
+        numRemoved = keyRegion.size();
+        context.getRegionProvider().removeKey(key);
+      } else {
+        removeList = getRemoveKeys(context, key, startRank, stopRank);
+      }
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    if (removeList != null) {
+      for (Object entry : removeList) {
+        ByteArrayWrapper removeKey;
+        if (entry instanceof Entry)
+          removeKey = (ByteArrayWrapper) ((Entry<?, ?>) entry).getKey();
+        else
+          removeKey = (ByteArrayWrapper) ((Struct) entry).getFieldValues()[0];
+        Object oldVal = keyRegion.remove(removeKey);
+        if (oldVal != null)
+          numRemoved++;
+      }
+      if (keyRegion.isEmpty())
+        context.getRegionProvider().removeKey(key);
+    }
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+  }
+
+  private List<?> getRemoveKeys(ExecutionHandlerContext context, ByteArrayWrapper key,
+      int startRank, int stopRank) throws Exception {
+    Query query = getQuery(key, SortedSetQuery.ZREMRANGEBYRANK, context);
+    Object[] params = {stopRank + 1};
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    return results.asList().subList(startRank, stopRank + 1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java
new file mode 100644
index 0000000..514748d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map.Entry;
+
+public class ZRemRangeByScoreExecutor extends SortedSetExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREMRANGEBYSCORE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    boolean startInclusive = true;
+    boolean stopInclusive = true;
+    double start;
+    double stop;
+
+    byte[] startArray = commandElems.get(2);
+    byte[] stopArray = commandElems.get(3);
+    String startString = Coder.bytesToString(startArray);
+    String stopString = Coder.bytesToString(stopArray);
+    if (startArray[0] == Coder.OPEN_BRACE_ID) {
+      startString = startString.substring(1);
+      startInclusive = false;
+    }
+    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
+      stopString = stopString.substring(1);
+      stopInclusive = false;
+    }
+
+    try {
+      start = Coder.stringToDouble(startString);
+      stop = Coder.stringToDouble(stopString);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    int numRemoved = 0;
+
+    Collection<?> removeList = null;
+    try {
+      if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY && startInclusive
+          && stopInclusive) {
+        numRemoved = keyRegion.size();
+        context.getRegionProvider().removeKey(key);
+      } else {
+        removeList = getKeys(context, key, keyRegion, start, stop, startInclusive, stopInclusive);
+      }
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    if (removeList != null) {
+      for (Object entry : removeList) {
+        ByteArrayWrapper remove = null;
+        if (entry instanceof Entry)
+          remove = (ByteArrayWrapper) ((Entry<?, ?>) entry).getKey();
+        else if (entry instanceof Struct)
+          remove = (ByteArrayWrapper) ((Struct) entry).getFieldValues()[0];
+        Object oldVal = keyRegion.remove(remove);
+        if (oldVal != null)
+          numRemoved++;
+        if (keyRegion.isEmpty())
+          context.getRegionProvider().removeKey(key);
+      }
+    }
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+  }
+
+  private Collection<?> getKeys(ExecutionHandlerContext context, ByteArrayWrapper key,
+      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, double start, double stop,
+      boolean startInclusive, boolean stopInclusive) throws Exception {
+    if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY || (start > stop))
+      return null;
+
+    Query query;
+    Object[] params;
+    if (startInclusive) {
+      if (stopInclusive) {
+        query = getQuery(key, SortedSetQuery.ZRBSSTISI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZRBSSTI, context);
+      }
+    } else {
+      if (stopInclusive) {
+        query = getQuery(key, SortedSetQuery.ZRBSSI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZRBS, context);
+      }
+    }
+    params = new Object[] {start, stop, INFINITY_LIMIT};
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    return (Collection<?>) results.asList();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java
new file mode 100644
index 0000000..652e784
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class ZRevRangeByScoreExecutor extends ZRangeByScoreExecutor {
+
+  @Override
+  protected boolean isReverse() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.ZREVRANGEBYSCORE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java
new file mode 100644
index 0000000..8154570
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class ZRevRangeExecutor extends ZRangeExecutor {
+
+  @Override
+  protected boolean isReverse() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.ZREVRANGE;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java
new file mode 100644
index 0000000..80ebfa4
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+public class ZRevRankExecutor extends ZRankExecutor {
+
+  @Override
+  protected boolean isReverse() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.ZREVRANK;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java
new file mode 100644
index 0000000..1d50f17
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.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 org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
+
+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;
+import java.util.regex.PatternSyntaxException;
+
+public class ZScanExecutor extends AbstractScanExecutor {
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZSCAN));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    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>()));
+      return;
+    }
+    byte[] cAr = commandElems.get(2);
+    // String cursorString = ResponseToByteEncoder.bytesToString(cAr);
+
+    int cursor = 0;
+    Pattern matchPattern = null;
+    String globMatchPattern = null;
+    int count = DEFUALT_COUNT;
+    try {
+      cursor = Coder.bytesToInt(cAr);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+    if (cursor < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+
+    if (commandElems.size() > 4) {
+      try {
+        byte[] bytes = commandElems.get(3);
+        if (Coder.bytesToString(bytes).equalsIgnoreCase("MATCH")) {
+          bytes = commandElems.get(4);
+          globMatchPattern = Coder.bytesToString(bytes);
+        } else if (Coder.bytesToString(bytes).equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(4);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (commandElems.size() > 6) {
+      try {
+        byte[] bytes = commandElems.get(5);
+        if (Coder.bytesToString(bytes).equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(6);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (count < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+      return;
+    }
+
+    try {
+      matchPattern = convertGlobToRegex(globMatchPattern);
+    } catch (PatternSyntaxException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
+      return;
+    }
+
+    List<ByteArrayWrapper> returnList =
+        (List<ByteArrayWrapper>) getIteration(new HashSet(keyRegion.entrySet()), matchPattern,
+            count, cursor);
+
+    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
+    List<Object> returnList = new ArrayList<Object>();
+    int size = list.size();
+    int beforeCursor = 0;
+    int numElements = 0;
+    int i = -1;
+    for (Entry<ByteArrayWrapper, DoubleWrapper> entry : (Collection<Entry<ByteArrayWrapper, DoubleWrapper>>) list) {
+      ByteArrayWrapper keyWrapper = entry.getKey();
+      String key = keyWrapper.toString();
+
+      DoubleWrapper value = entry.getValue();
+      i++;
+      if (beforeCursor < cursor) {
+        beforeCursor++;
+        continue;
+      } else if (numElements < count) {
+        if (matchPattern != null) {
+          if (matchPattern.matcher(key).matches()) {
+            returnList.add(keyWrapper);
+            returnList.add(value.toString());
+            numElements++;
+          }
+        } else {
+          returnList.add(keyWrapper);
+          returnList.add(value.toString());
+          numElements++;
+        }
+      } else
+        break;
+    }
+
+    if (i == size - 1)
+      returnList.add(0, String.valueOf(0));
+    else
+      returnList.add(0, String.valueOf(i));
+    return returnList;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java
new file mode 100644
index 0000000..dbdaa0d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class ZScoreExecutor extends SortedSetExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZSCORE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
+
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+    DoubleWrapper score = keyRegion.get(member);
+    if (score == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+    command
+        .setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), score.toString()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java
new file mode 100644
index 0000000..7bd12d6
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class AppendExecutor extends StringExecutor {
+
+  private final int VALUE_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();;
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.APPEND));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper string = r.get(key);
+
+    byte[] stringByteArray = commandElems.get(VALUE_INDEX);
+    if (string == null) {
+      r.put(key, new ByteArrayWrapper(stringByteArray));
+      command.setResponse(
+          Coder.getIntegerResponse(context.getByteBufAllocator(), stringByteArray.length));
+    } else {
+      byte[] newValue = concatArrays(string.toBytes(), stringByteArray);
+      string.setBytes(newValue);
+      r.put(key, string);
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), newValue.length));
+    }
+
+  }
+
+  private byte[] concatArrays(byte[] o, byte[] n) {
+    int oLen = o.length;
+    int nLen = n.length;
+    byte[] combined = new byte[oLen + nLen];
+    System.arraycopy(o, 0, combined, 0, oLen);
+    System.arraycopy(n, 0, combined, oLen, nLen);
+    return combined;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java
new file mode 100644
index 0000000..7461eea
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class BitCountExecutor extends StringExecutor {
+
+  private final String ERROR_NOT_INT = "The indexes provided must be numeric values";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() != 2 && commandElems.size() != 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITCOUNT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper wrapper = r.get(key);
+    if (wrapper == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+    byte[] value = wrapper.toBytes();
+
+    long startL = 0;
+    long endL = value.length - 1;
+
+    if (commandElems.size() == 4) {
+      try {
+        startL = Coder.bytesToLong(commandElems.get(2));
+        endL = Coder.bytesToLong(commandElems.get(3));
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+        return;
+      }
+    }
+    if (startL > Integer.MAX_VALUE || endL > Integer.MAX_VALUE) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_OUT_OF_RANGE));
+      return;
+    }
+
+    int start = (int) startL;
+    int end = (int) endL;
+    if (start < 0)
+      start += value.length;
+    if (end < 0)
+      end += value.length;
+
+    if (start < 0)
+      start = 0;
+    if (end < 0)
+      end = 0;
+
+    if (end > value.length - 1)
+      end = value.length - 1;
+
+    if (end < start || start >= value.length) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    long setBits = 0;
+    for (int j = start; j <= end; j++)
+      setBits += Integer.bitCount(0xFF & value[j]); // 0xFF keeps same bit sequence as the byte as
+                                                    // opposed to keeping the same value
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), setBits));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java
new file mode 100644
index 0000000..d32a996
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class BitOpExecutor extends StringExecutor {
+
+  private static final String ERROR_NO_SUCH_OP = "Please specify a legal operation";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITOP));
+      return;
+    }
+
+    String operation = command.getStringKey().toUpperCase();
+    ByteArrayWrapper destKey = new ByteArrayWrapper(commandElems.get(2));
+    checkDataType(destKey, context);
+
+    byte[][] values = new byte[commandElems.size() - 3][];
+    int maxLength = 0;
+    for (int i = 3; i < commandElems.size(); i++) {
+      ByteArrayWrapper key = new ByteArrayWrapper(commandElems.get(i));
+      checkDataType(key, context);
+      ByteArrayWrapper value = r.get(key);
+      if (value == null) {
+        values[i - 3] = null;
+        continue;
+      }
+
+      byte[] val = value.toBytes();
+      values[i - 3] = val;
+      if (val.length > maxLength) {
+        maxLength = val.length;
+        byte[] tmp = values[0];
+        values[0] = val;
+        values[i - 3] = tmp;
+      }
+      if (i == 3 && operation.equalsIgnoreCase("NOT"))
+        break;
+    }
+
+
+    if (operation.equals("AND"))
+      and(context, r, destKey, values, maxLength);
+    else if (operation.equals("OR"))
+      or(context, r, destKey, values, maxLength);
+    else if (operation.equals("XOR"))
+      xor(context, r, destKey, values, maxLength);
+    else if (operation.equals("NOT"))
+      not(context, r, destKey, values, maxLength);
+    else {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NO_SUCH_OP));
+      return;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), maxLength));
+  }
+
+  private void and(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
+      ByteArrayWrapper destKey, byte[][] values, int max) {
+    byte[] dest = new byte[max];
+    outer: for (int i = 0; i < max; i++) {
+      byte b = values[0][i];
+      for (int j = 1; j < values.length; j++) {
+        if (values[j] == null) {
+          break outer;
+        } else if (i < values[j].length)
+          b &= values[j][i];
+        else
+          b &= 0;
+      }
+      dest[i] = b;
+    }
+    checkAndSetDataType(destKey, context);
+    r.put(destKey, new ByteArrayWrapper(dest));
+  }
+
+  private void or(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
+      ByteArrayWrapper destKey, byte[][] values, int max) {
+    byte[] dest = new byte[max];
+    for (int i = 0; i < max; i++) {
+      byte b = values[0][i];
+      for (int j = 1; j < values.length; j++) {
+        byte[] cA = values[j];
+        if (cA != null && i < cA.length)
+          b |= cA[i];
+        else
+          b |= 0;
+      }
+      dest[i] = b;
+    }
+    checkAndSetDataType(destKey, context);
+    r.put(destKey, new ByteArrayWrapper(dest));
+  }
+
+  private void xor(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
+      ByteArrayWrapper destKey, byte[][] values, int max) {
+    byte[] dest = new byte[max];
+    for (int i = 0; i < max; i++) {
+      byte b = values[0][i];
+      for (int j = 1; j < values.length; j++) {
+        byte[] cA = values[j];
+        if (cA != null && i < cA.length)
+          b ^= cA[i];
+        else
+          b ^= 0;
+      }
+      dest[i] = b;
+    }
+    checkAndSetDataType(destKey, context);
+    r.put(destKey, new ByteArrayWrapper(dest));
+  }
+
+  private void not(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
+      ByteArrayWrapper destKey, byte[][] values, int max) {
+    byte[] dest = new byte[max];
+    byte[] cA = values[0];
+    for (int i = 0; i < max; i++) {
+      if (cA == null)
+        dest[i] = ~0;
+      else
+        dest[i] = (byte) (~cA[i] & 0xFF);
+    }
+    checkAndSetDataType(destKey, context);
+    r.put(destKey, new ByteArrayWrapper(dest));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
new file mode 100644
index 0000000..4ea633a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class BitPosExecutor extends StringExecutor {
+
+  private final String ERROR_NOT_INT = "The numbers provided must be numeric values";
+
+  private final String ERROR_BIT = "The bit must either be a 0 or 1";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITPOS));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper string = r.get(key);
+
+    int bit;
+    int bitPosition = -1;
+    boolean endSet = false;
+
+    try {
+      byte[] bitAr = commandElems.get(2);
+      bit = Coder.bytesToInt(bitAr);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+      return;
+    }
+
+    if (bit != 0 && bit != 1) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_BIT));
+      return;
+    }
+
+    if (string == null || string.length() == 0) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -bit)); // Redis
+                                                                                          // returns
+                                                                                          // 0 when
+                                                                                          // key
+                                                                                          // does
+                                                                                          // not
+                                                                                          // exists
+                                                                                          // for
+                                                                                          // this
+                                                                                          // command
+      return;
+    }
+    byte[] bytes = string.toBytes();
+    int start = 0;
+    int end = bytes.length - 1;
+    if (commandElems.size() > 3) {
+      try {
+        byte[] startAr = commandElems.get(3);
+        start = Coder.bytesToInt(startAr);
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+        return;
+      }
+    }
+
+
+    if (commandElems.size() > 4) {
+      try {
+        byte[] endAr = commandElems.get(4);
+        end = Coder.bytesToInt(endAr);
+        endSet = true;
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+        return;
+      }
+    }
+
+    if (start < 0)
+      start += bytes.length;
+    if (end < 0)
+      end += bytes.length;
+
+    if (start < 0)
+      start = 0;
+    if (end < 0)
+      end = 0;
+
+    if (start > bytes.length)
+      start = bytes.length - 1;
+    if (end > bytes.length)
+      end = bytes.length - 1;
+
+    if (end < start) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -1));
+      return;
+    }
+
+    outerLoop: for (int i = start; i <= end; i++) {
+      int cBit;
+      byte cByte = bytes[i];
+      for (int j = 0; j < 8; j++) {
+        cBit = (cByte & (0x80 >> j)) >> (7 - j);
+        if (cBit == bit) {
+          bitPosition = 8 * i + j;
+          break outerLoop;
+        }
+      }
+    }
+
+    if (bit == 0 && bitPosition == -1 && !endSet)
+      bitPosition = bytes.length * 8;
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bitPosition));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java
new file mode 100644
index 0000000..d632bc0
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class DecrByExecutor extends StringExecutor {
+
+  private final String ERROR_VALUE_NOT_USABLE =
+      "The value at this key cannot be decremented numerically";
+
+  private final String ERROR_DECREMENT_NOT_USABLE =
+      "The decrementation on this key must be numeric";
+
+  private final String ERROR_OVERFLOW = "This decrementation cannot be performed due to overflow";
+
+  private final int DECREMENT_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DECRBY));
+      return;
+    }
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+    /*
+     * Try increment
+     */
+
+    byte[] decrArray = commandElems.get(DECREMENT_INDEX);
+    String decrString = Coder.bytesToString(decrArray);
+    Long decrement;
+
+    try {
+      decrement = Long.parseLong(decrString);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_DECREMENT_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Value does not exist
+     */
+
+    if (valueWrapper == null) {
+      String negativeDecrString =
+          decrString.charAt(0) == Coder.HYPHEN_ID ? decrString.substring(1) : "-" + decrString;
+      r.put(key, new ByteArrayWrapper(Coder.stringToBytes(negativeDecrString)));
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -decrement));
+      return;
+    }
+
+    /*
+     * Value exists
+     */
+
+    String stringValue = Coder.bytesToString(valueWrapper.toBytes());
+
+    Long value;
+    try {
+      value = Long.parseLong(stringValue);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Check for overflow Negative decrement is used because the decrement is stored as a positive
+     * long
+     */
+    if (value <= 0 && -decrement < (Long.MIN_VALUE - value)) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
+      return;
+    }
+
+    value -= decrement;
+
+    stringValue = "" + value;
+    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java
new file mode 100644
index 0000000..8c73616
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RegionProvider;
+
+import java.util.List;
+
+public class DecrExecutor extends StringExecutor {
+
+  private final String ERROR_VALUE_NOT_USABLE =
+      "The value at this key cannot be decremented numerically";
+
+  private final String ERROR_OVERFLOW = "This decrementation cannot be performed due to overflow";
+
+  private final byte[] INIT_VALUE_BYTES = Coder.stringToBytes("-1");
+
+  private final int INIT_VALUE_INT = -1;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    RegionProvider rC = context.getRegionProvider();
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = rC.getStringsRegion();;
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DECR));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+    /*
+     * Value does not exist
+     */
+
+    if (valueWrapper == null) {
+      byte[] newValue = INIT_VALUE_BYTES;
+      r.put(key, new ByteArrayWrapper(newValue));
+      rC.metaPut(key, RedisDataType.REDIS_STRING);
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), INIT_VALUE_INT));
+      return;
+    }
+
+    /*
+     * Value exists
+     */
+
+    String stringValue = valueWrapper.toString();
+    Long value;
+    try {
+      value = Long.parseLong(stringValue);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
+      return;
+    }
+
+    if (value == Long.MIN_VALUE) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
+      return;
+    }
+
+    value--;
+
+    stringValue = "" + value;
+
+    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java
new file mode 100644
index 0000000..1220be1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class GetBitExecutor extends StringExecutor {
+
+  private final String ERROR_NOT_INT = "The offset provided must be numeric";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETBIT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper wrapper = r.get(key);
+    if (wrapper == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    int bit = 0;
+    byte[] bytes = wrapper.toBytes();
+    int offset;
+    try {
+      byte[] offAr = commandElems.get(2);
+      offset = Coder.bytesToInt(offAr);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+      return;
+    }
+    if (offset < 0)
+      offset += bytes.length * 8;
+
+    if (offset < 0 || offset > bytes.length * 8) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    int byteIndex = offset / 8;
+    offset %= 8;
+
+    if (byteIndex >= bytes.length) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    bit = (bytes[byteIndex] & (0x80 >> offset)) >> (7 - offset);
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bit));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java
new file mode 100644
index 0000000..31aac75
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+public class GetExecutor extends StringExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (command.getProcessedCommand().size() < 2) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETEXECUTOR));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_STRING, context);
+    ByteArrayWrapper wrapper = r.get(key);
+
+    if (wrapper == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    } else {
+      command.setResponse(
+          Coder.getBulkStringResponse(context.getByteBufAllocator(), wrapper.toBytes()));
+    }
+
+  }
+
+}


[15/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java
deleted file mode 100755
index da370ce..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hll;
-
-/**
- * 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.
- */
-
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-
-/**
- * <p>
- * Encodes signed and unsigned values using a common variable-length scheme, found for example in
- * <a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google's Protocol
- * Buffers</a>. It uses fewer bytes to encode smaller values, but will use slightly more bytes to
- * encode large values.
- * </p>
- * <p/>
- * <p>
- * Signed values are further encoded using so-called zig-zag encoding in order to make them
- * "compatible" with variable-length encoding.
- * </p>
- */
-public final class Varint {
-
-  private Varint() {}
-
-  /**
-   * Encodes a value using the variable-length encoding from
-   * <a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google Protocol
-   * Buffers</a>. It uses zig-zag encoding to efficiently encode signed values. If values are known
-   * to be nonnegative, {@link #writeUnsignedVarLong(long, DataOutput)} should be used.
-   *
-   * @param value value to encode
-   * @param out to write bytes to
-   * @throws IOException if {@link DataOutput} throws {@link IOException}
-   */
-  public static void writeSignedVarLong(long value, DataOutput out) throws IOException {
-    // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
-    writeUnsignedVarLong((value << 1) ^ (value >> 63), out);
-  }
-
-  /**
-   * Encodes a value using the variable-length encoding from
-   * <a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google Protocol
-   * Buffers</a>. Zig-zag is not used, so input must not be negative. If values can be negative, use
-   * {@link #writeSignedVarLong(long, DataOutput)} instead. This method treats negative input as
-   * like a large unsigned value.
-   *
-   * @param value value to encode
-   * @param out to write bytes to
-   * @throws IOException if {@link DataOutput} throws {@link IOException}
-   */
-  public static void writeUnsignedVarLong(long value, DataOutput out) throws IOException {
-    while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
-      out.writeByte(((int) value & 0x7F) | 0x80);
-      value >>>= 7;
-    }
-    out.writeByte((int) value & 0x7F);
-  }
-
-  /**
-   * @see #writeSignedVarLong(long, DataOutput)
-   */
-  public static void writeSignedVarInt(int value, DataOutput out) throws IOException {
-    // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
-    writeUnsignedVarInt((value << 1) ^ (value >> 31), out);
-  }
-
-  /**
-   * @see #writeUnsignedVarLong(long, DataOutput)
-   */
-  public static void writeUnsignedVarInt(int value, DataOutput out) throws IOException {
-    while ((value & 0xFFFFFF80) != 0L) {
-      out.writeByte((value & 0x7F) | 0x80);
-      value >>>= 7;
-    }
-    out.writeByte(value & 0x7F);
-  }
-
-  public static byte[] writeSignedVarInt(int value) {
-    // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
-    return writeUnsignedVarInt((value << 1) ^ (value >> 31));
-  }
-
-  /**
-   * @see #writeUnsignedVarLong(long, DataOutput)
-   *      <p/>
-   *      This one does not use streams and is much faster. Makes a single object each time, and
-   *      that object is a primitive array.
-   */
-  public static byte[] writeUnsignedVarInt(int value) {
-    byte[] byteArrayList = new byte[10];
-    int i = 0;
-    while ((value & 0xFFFFFF80) != 0L) {
-      byteArrayList[i++] = ((byte) ((value & 0x7F) | 0x80));
-      value >>>= 7;
-    }
-    byteArrayList[i] = ((byte) (value & 0x7F));
-    byte[] out = new byte[i + 1];
-    for (; i >= 0; i--) {
-      out[i] = byteArrayList[i];
-    }
-    return out;
-  }
-
-  /**
-   * @param in to read bytes from
-   * @return decode value
-   * @throws IOException if {@link DataInput} throws {@link IOException}
-   * @throws IllegalArgumentException if variable-length value does not terminate after 9 bytes have
-   *         been read
-   * @see #writeSignedVarLong(long, DataOutput)
-   */
-  public static long readSignedVarLong(DataInput in) throws IOException {
-    long raw = readUnsignedVarLong(in);
-    // This undoes the trick in writeSignedVarLong()
-    long temp = (((raw << 63) >> 63) ^ raw) >> 1;
-    // This extra step lets us deal with the largest signed values by treating
-    // negative results from read unsigned methods as like unsigned values
-    // Must re-flip the top bit if the original read value had it set.
-    return temp ^ (raw & (1L << 63));
-  }
-
-  /**
-   * @param in to read bytes from
-   * @return decode value
-   * @throws IOException if {@link DataInput} throws {@link IOException}
-   * @throws IllegalArgumentException if variable-length value does not terminate after 9 bytes have
-   *         been read
-   * @see #writeUnsignedVarLong(long, DataOutput)
-   */
-  public static long readUnsignedVarLong(DataInput in) throws IOException {
-    long value = 0L;
-    int i = 0;
-    long b;
-    while (((b = in.readByte()) & 0x80L) != 0) {
-      value |= (b & 0x7F) << i;
-      i += 7;
-      if (i > 63) {
-        throw new IllegalArgumentException("Variable length quantity is too long");
-      }
-    }
-    return value | (b << i);
-  }
-
-  /**
-   * @throws IllegalArgumentException if variable-length value does not terminate after 5 bytes have
-   *         been read
-   * @throws IOException if {@link DataInput} throws {@link IOException}
-   * @see #readSignedVarLong(DataInput)
-   */
-  public static int readSignedVarInt(DataInput in) throws IOException {
-    int raw = readUnsignedVarInt(in);
-    // This undoes the trick in writeSignedVarInt()
-    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
-    // This extra step lets us deal with the largest signed values by treating
-    // negative results from read unsigned methods as like unsigned values.
-    // Must re-flip the top bit if the original read value had it set.
-    return temp ^ (raw & (1 << 31));
-  }
-
-  /**
-   * @throws IllegalArgumentException if variable-length value does not terminate after 5 bytes have
-   *         been read
-   * @throws IOException if {@link DataInput} throws {@link IOException}
-   * @see #readUnsignedVarLong(DataInput)
-   */
-  public static int readUnsignedVarInt(DataInput in) throws IOException {
-    int value = 0;
-    int i = 0;
-    int b;
-    while (((b = in.readByte()) & 0x80) != 0) {
-      value |= (b & 0x7F) << i;
-      i += 7;
-      if (i > 35) {
-        throw new IllegalArgumentException("Variable length quantity is too long");
-      }
-    }
-    return value | (b << i);
-  }
-
-  public static int readSignedVarInt(byte[] bytes) {
-    int raw = readUnsignedVarInt(bytes);
-    // This undoes the trick in writeSignedVarInt()
-    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
-    // This extra step lets us deal with the largest signed values by treating
-    // negative results from read unsigned methods as like unsigned values.
-    // Must re-flip the top bit if the original read value had it set.
-    return temp ^ (raw & (1 << 31));
-  }
-
-  public static int readUnsignedVarInt(byte[] bytes) {
-    int value = 0;
-    int i = 0;
-    byte rb = Byte.MIN_VALUE;
-    for (byte b : bytes) {
-      rb = b;
-      if ((b & 0x80) == 0) {
-        break;
-      }
-      value |= (b & 0x7f) << i;
-      i += 7;
-      if (i > 35) {
-        throw new IllegalArgumentException("Variable length quantity is too long");
-      }
-    }
-    return value | (rb << i);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java
deleted file mode 100755
index c80a505..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.ListQuery;
-
-public class LIndexExecutor extends ListExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LINDEX));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    byte[] indexArray = commandElems.get(2);
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-
-    Integer redisIndex;
-
-    try {
-      redisIndex = Coder.bytesToInt(indexArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    /*
-     * Now the fun part, converting the redis index into our index. The redis index is 0 based but
-     * negative values count from the tail
-     */
-
-    if (redisIndex < 0)
-      // Since the redisIndex is negative here, this will reset it to be a standard 0 based index
-      redisIndex = listSize + redisIndex;
-
-    /*
-     * If the index is still less than 0 that means the index has shot off back past the beginning,
-     * which means the index isn't real and a nil is returned
-     */
-    if (redisIndex < 0) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    /*
-     * Now we must get that element from the region
-     */
-    Struct entry;
-    try {
-      entry = getEntryAtIndex(context, key, redisIndex);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    if (entry == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Object[] entryArray = entry.getFieldValues();
-    ByteArrayWrapper valueWrapper = (ByteArrayWrapper) entryArray[1];
-    command.setResponse(
-        Coder.getBulkStringResponse(context.getByteBufAllocator(), valueWrapper.toBytes()));
-  }
-
-  private Struct getEntryAtIndex(ExecutionHandlerContext context, ByteArrayWrapper key, int index)
-      throws Exception {
-
-    Query query = getQuery(key, ListQuery.LINDEX, context);
-
-    Object[] params = {Integer.valueOf(index + 1)};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    if (results == null || results.size() == 0 || results.size() <= index)
-      return null;
-    else
-      return (Struct) results.asList().get(index);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java
deleted file mode 100755
index ac9f653..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-
-public class LInsertExecutor extends ListExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
-        "Unfortunately GemFireRedis server does not support LINSERT"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java
deleted file mode 100755
index f9e685f..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class LLenExecutor extends ListExecutor {
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LLEN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    int listSize = 0;
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java
deleted file mode 100755
index 40736c8..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class LPopExecutor extends PopExecutor {
-
-  @Override
-  protected ListDirection popType() {
-    return ListDirection.LEFT;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.LPOP;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java
deleted file mode 100755
index 6624a61..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class LPushExecutor extends PushExecutor {
-
-  @Override
-  protected ListDirection pushType() {
-    return ListDirection.LEFT;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.LPUSH;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java
deleted file mode 100755
index dc84896..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class LPushXExecutor extends PushXExecutor {
-
-  @Override
-  protected ListDirection pushType() {
-    return ListDirection.LEFT;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.LPUSHX;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java
deleted file mode 100755
index fc36408..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.ListQuery;
-
-public class LRangeExecutor extends ListExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LRANGE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    byte[] startArray = commandElems.get(2);
-    byte[] stopArray = commandElems.get(3);
-
-    int redisStart;
-    int redisStop;
-
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-    if (listSize == 0) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    try {
-      redisStart = Coder.bytesToInt(startArray);
-      redisStop = Coder.bytesToInt(stopArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-
-    redisStart = getBoundedStartIndex(redisStart, listSize);
-    redisStop = getBoundedEndIndex(redisStop, listSize);
-    if (redisStart > redisStop) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-    redisStart = Math.min(redisStart, listSize - 1);
-    redisStop = Math.min(redisStop, listSize - 1);
-
-
-    List<Struct> range;
-    try {
-      range = getRange(context, key, redisStart, redisStop, keyRegion);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    if (range == null)
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-    else
-      command.setResponse(
-          Coder.getBulkStringArrayResponseOfValues(context.getByteBufAllocator(), range));
-  }
-
-  private List<Struct> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
-      int stop, Region r) throws Exception {
-
-    Query query = getQuery(key, ListQuery.LRANGE, context);
-
-    Object[] params = {Integer.valueOf(stop + 1)};
-    SelectResults<Struct> results = (SelectResults<Struct>) query.execute(params);
-    int size = results.size();
-    if (results == null || size <= start) {
-      return null;
-    }
-
-    return results.asList().subList(start, size);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java
deleted file mode 100755
index be0793e..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.ListQuery;
-
-public class LRemExecutor extends ListExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The count provided is not numeric";
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LREM));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    byte[] countArray = commandElems.get(2);
-    byte[] value = commandElems.get(3);
-
-    int count;
-
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    try {
-      count = Coder.bytesToInt(countArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    List<Struct> removeList;
-    try {
-      removeList = getRemoveList(context, key, new ByteArrayWrapper(value), count);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    int numRemoved = 0;
-
-    if (removeList == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-      return;
-    }
-
-    for (Struct entry : removeList) {
-      Integer removeKey = (Integer) entry.getFieldValues()[0];
-      Object oldVal = keyRegion.remove(removeKey);
-      if (oldVal != null)
-        numRemoved++;
-    }
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-
-  private List<Struct> getRemoveList(ExecutionHandlerContext context, ByteArrayWrapper key,
-      ByteArrayWrapper value, int count) throws Exception {
-    Object[] params;
-    Query query;
-    if (count > 0) {
-      query = getQuery(key, ListQuery.LREMG, context);
-      params = new Object[] {value, Integer.valueOf(count)};
-    } else if (count < 0) {
-      query = getQuery(key, ListQuery.LREML, context);
-      params = new Object[] {value, Integer.valueOf(-count)};
-    } else {
-      query = getQuery(key, ListQuery.LREME, context);
-      params = new Object[] {value};
-    }
-
-
-    SelectResults<Struct> results = (SelectResults<Struct>) query.execute(params);
-
-    if (results == null || results.isEmpty()) {
-      return null;
-    }
-
-    return results.asList();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java
deleted file mode 100755
index 0a53041..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.ListQuery;
-
-public class LSetExecutor extends ListExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  private final String ERROR_INDEX =
-      "The index provided is not within range of this list or the key does not exist";
-
-  private final String SUCCESS = "OK";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LSET));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    byte[] indexArray = commandElems.get(2);
-    byte[] value = commandElems.get(3);
-
-    int index;
-
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INDEX));
-      return;
-    }
-
-    try {
-      index = Coder.bytesToInt(indexArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-    if (index < 0)
-      index += listSize;
-    if (index < 0 || index > listSize) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INDEX));
-      return;
-    }
-
-    Integer indexKey;
-    try {
-      indexKey = getIndexKey(context, key, index);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    if (indexKey == null) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INDEX));
-      return;
-    }
-    if (index == listSize)
-      indexKey++;
-    keyRegion.put(indexKey, new ByteArrayWrapper(value));
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-  }
-
-  private Integer getIndexKey(ExecutionHandlerContext context, ByteArrayWrapper key, int index)
-      throws Exception {
-    Query query = getQuery(key, ListQuery.LSET, context);
-
-    Object[] params = {Integer.valueOf(index + 1)};
-
-    SelectResults<Integer> results = (SelectResults<Integer>) query.execute(params);
-    int size = results.size();
-    if (results == null || size == 0) {
-      return null;
-    }
-
-    return results.asList().get(size - 1);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java
deleted file mode 100755
index de5804f..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.ListQuery;
-
-public class LTrimExecutor extends ListExecutor {
-
-  private final String ERROR_KEY_NOT_EXISTS = "The key does not exists on this server";
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  private final String SUCCESS = "OK";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LTRIM));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    byte[] startArray = commandElems.get(2);
-    byte[] stopArray = commandElems.get(3);
-
-    int redisStart;
-    int redisStop;
-
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_KEY_NOT_EXISTS));
-      return;
-    }
-
-    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-    if (listSize == 0) {
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-      return;
-    }
-
-    try {
-      redisStart = Coder.bytesToInt(startArray);
-      redisStop = Coder.bytesToInt(stopArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    redisStart = getBoundedStartIndex(redisStart, listSize);
-    redisStop = getBoundedEndIndex(redisStop, listSize);
-    redisStart = Math.min(redisStart, listSize - 1);
-    redisStop = Math.min(redisStop, listSize - 1);
-
-    if (redisStart == 0 && redisStop == listSize - 1) {
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-      return;
-    } else if (redisStart == 0 && redisStop < redisStart) {
-      context.getRegionProvider().removeKey(key, RedisDataType.REDIS_LIST);
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-      return;
-    }
-
-    List<Integer> keepList;
-    try {
-      keepList = getRange(context, key, redisStart, redisStop, keyRegion);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    for (Object keyElement : keyRegion.keySet()) {
-      if (!keepList.contains(keyElement) && keyElement instanceof Integer)
-        keyRegion.remove(keyElement);
-    }
-
-    // Reset indexes in meta data region
-    keyRegion.put("head", keepList.get(0));
-    keyRegion.put("tail", keepList.get(keepList.size() - 1));
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-  }
-
-  private List<Integer> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
-      int stop, Region r) throws Exception {
-    Query query = getQuery(key, ListQuery.LTRIM, context);
-
-    Object[] params = {Integer.valueOf(stop + 1)};
-
-    SelectResults<Integer> results = (SelectResults<Integer>) query.execute(params);
-    if (results == null || results.size() <= start) {
-      return null;
-    }
-
-    return results.asList().subList(start, results.size());
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
deleted file mode 100755
index ab80a36..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.QueryService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-
-public abstract class ListExecutor extends AbstractExecutor {
-
-  protected static final int LIST_EMPTY_SIZE = 2;
-
-  protected static enum ListDirection {
-    LEFT, RIGHT
-  };
-
-  protected final static QueryService getQueryService() {
-    return GemFireCacheImpl.getInstance().getQueryService();
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  protected Region<Integer, ByteArrayWrapper> getOrCreateRegion(ExecutionHandlerContext context,
-      ByteArrayWrapper key, RedisDataType type) {
-    return (Region<Integer, ByteArrayWrapper>) context.getRegionProvider().getOrCreateRegion(key,
-        type, context);
-  }
-
-  @SuppressWarnings("unchecked")
-  protected Region<Integer, ByteArrayWrapper> getRegion(ExecutionHandlerContext context,
-      ByteArrayWrapper key) {
-    return (Region<Integer, ByteArrayWrapper>) context.getRegionProvider().getRegion(key);
-  }
-
-  /**
-   * Helper method to be used by the push commands to push elements onto a list. Because our current
-   * setup requires non trivial code to push elements in to a Region, I wanted all the push code to
-   * reside in one place.
-   * 
-   * @param key Name of the list
-   * @param commandElems Pieces of the command, this is where the elements that need to be pushed
-   *        live
-   * @param startIndex The index to start with in the commandElems list, inclusive
-   * @param endIndex The index to end with in the commandElems list, exclusive
-   * @param keyRegion Region of list
-   * @param pushType ListDirection.LEFT || ListDirection.RIGHT
-   * @param context Context of this push
-   */
-  protected void pushElements(ByteArrayWrapper key, List<byte[]> commandElems, int startIndex,
-      int endIndex, Region keyRegion, ListDirection pushType, ExecutionHandlerContext context) {
-
-    String indexKey = pushType == ListDirection.LEFT ? "head" : "tail";
-    String oppositeKey = pushType == ListDirection.RIGHT ? "head" : "tail";
-    Integer index = (Integer) keyRegion.get(indexKey);
-    Integer opp = (Integer) keyRegion.get(oppositeKey);
-    if (index != opp)
-      index += pushType == ListDirection.LEFT ? -1 : 1; // Subtract index if left push, add if right
-                                                        // push
-
-    /**
-     * Multi push command
-     * 
-     * For every element that needs to be added
-     */
-
-    for (int i = startIndex; i < endIndex; i++) {
-      byte[] value = commandElems.get(i);
-      ByteArrayWrapper wrapper = new ByteArrayWrapper(value);
-
-      /**
-       * 
-       * First, use the start index to attempt to insert the value into the Region
-       * 
-       */
-
-      Object oldValue;
-      do {
-        oldValue = keyRegion.putIfAbsent(index, wrapper);
-        if (oldValue != null) {
-          index += pushType == ListDirection.LEFT ? -1 : 1; // Subtract index if left push, add if
-                                                            // right push
-        }
-      } while (oldValue != null);
-
-      /**
-       * 
-       * Next, update the index in the meta data region. Keep trying to replace the existing index
-       * unless the index is further out than previously inserted, that's ok. Example below:
-       * 
-       * ********************** LPUSH/LPUSH *************************** Push occurring at the same
-       * time, further index update first | This push | | | | V V [-4] [-3] [-2] [-1] [0] [1] [2]
-       * 
-       * In this case, -4 would already exist in the meta data region, therefore we do not try to
-       * put -3 in the meta data region because a further index is already there.
-       * ***************************************************************
-       * 
-       * Another example
-       * 
-       * ********************** LPUSH/LPOP ***************************** This push | Simultaneous
-       * LPOP, meta data head index already updated to -2 | | | | V V [-4] [X] [-2] [-1] [0] [1] [2]
-       * 
-       * In this case, -2 would already exist in the meta data region, but we need to make sure the
-       * element at -4 is visible to all other threads so we will attempt to change the index to -4
-       * as long as it is greater than -4
-       * ***************************************************************
-       * 
-       */
-
-      boolean indexSet = false;
-      do {
-        Integer existingIndex = (Integer) keyRegion.get(indexKey);
-        if ((pushType == ListDirection.RIGHT && existingIndex < index)
-            || (pushType == ListDirection.LEFT && existingIndex > index))
-          indexSet = keyRegion.replace(indexKey, existingIndex, index);
-        else
-          break;
-      } while (!indexSet);
-
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java
deleted file mode 100755
index d5c6e01..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public abstract class PopExecutor extends ListExecutor implements Extendable {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    Region keyRegion = getRegion(context, key);
-
-    if (keyRegion == null || keyRegion.size() == LIST_EMPTY_SIZE) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    String indexKey = popType() == ListDirection.LEFT ? "head" : "tail";
-    String oppositeKey = popType() == ListDirection.RIGHT ? "head" : "tail";
-    Integer index = 0;
-    int originalIndex = index;
-    int incr = popType() == ListDirection.LEFT ? 1 : -1;
-    ByteArrayWrapper valueWrapper = null;
-
-    /**
-     * 
-     * First attempt to hop over an index by moving the index down one in the meta data region. The
-     * desired index to remove is held within the field index
-     * 
-     */
-
-    boolean indexChanged = false;
-    do {
-      index = (Integer) keyRegion.get(indexKey);
-      Integer opp = (Integer) keyRegion.get(oppositeKey);
-      if (index.equals(opp))
-        break;
-      indexChanged = keyRegion.replace(indexKey, index, index + incr);
-    } while (!indexChanged);
-
-    /**
-     * 
-     * Now attempt to remove the value of the index. We must do a get to ensure a returned value and
-     * then call remove with the value to ensure no one else has removed it first. Otherwise, try
-     * other indexes
-     * 
-     */
-
-    boolean removed = false;
-    int i = 0;
-    do {
-      valueWrapper = (ByteArrayWrapper) keyRegion.get(index);
-      if (valueWrapper != null)
-        removed = keyRegion.remove(index, valueWrapper);
-
-      /**
-       * 
-       * If remove has passed, our job is done and we can break and stop looking for a value
-       * 
-       */
-
-      if (removed)
-        break;
-
-      /**
-       * 
-       * If the index has not been removed, we need to look at other indexes. Two cases exist:
-       * 
-       * ************************** FIRST MISS *********************************** Push occurring at
-       * the same time, further index update first | This is location of miss | | | | V V [-4] [X]
-       * [-2] [-1] [0] [1] [2] <-- Direction of index update If this is the first miss, the index is
-       * re obtained from the meta region and that index is trying. However, if the index in the
-       * meta data region is not further out, that index is not used and moves on to the second case
-       * **************************************************************************
-       * 
-       * ************************* SUBSEQUENT MISSES ****************************** Push occurring
-       * at the same time, further index update first | This is location of miss | | | | V V [-4]
-       * [X] [-2] [-1] [0] [1] [2] Direction of index update --> If this is not the first miss then
-       * we move down to the other end of the list which means the next not empty index will be
-       * attempted to be removed
-       * **************************************************************************
-       * 
-       * If it is the case that the list is empty, it will exit this loop
-       * 
-       */
-
-      index += incr;
-      Integer metaIndex = (Integer) keyRegion.get(indexKey);
-      if (i < 1 && (popType() == ListDirection.LEFT && metaIndex < originalIndex
-          || popType() == ListDirection.RIGHT && metaIndex > originalIndex))
-        index = metaIndex;
-      i++;
-    } while (!removed && keyRegion.size() != LIST_EMPTY_SIZE);
-    if (valueWrapper != null)
-      command.setResponse(
-          Coder.getBulkStringResponse(context.getByteBufAllocator(), valueWrapper.toBytes()));
-    else
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-  }
-
-  protected abstract ListDirection popType();
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java
deleted file mode 100755
index b6017a5..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-
-public abstract class PushExecutor extends PushXExecutor implements Extendable {
-
-  private final int START_VALUES_INDEX = 2;
-  static volatile AtomicInteger puts = new AtomicInteger(0);
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<Integer, ByteArrayWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_LIST);
-    pushElements(key, commandElems, START_VALUES_INDEX, commandElems.size(), keyRegion, pushType(),
-        context);
-    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize));
-  }
-
-  protected abstract ListDirection pushType();
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java
deleted file mode 100755
index 3123f92..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public abstract class PushXExecutor extends ListExecutor implements Extendable {
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-    checkDataType(key, RedisDataType.REDIS_LIST, context);
-    pushElements(key, commandElems, 2, 3, keyRegion, pushType(), context);
-
-    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize));
-  }
-
-  protected abstract ListDirection pushType();
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java
deleted file mode 100755
index 3d25ae6..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class RPopExecutor extends PopExecutor {
-
-  @Override
-  protected ListDirection popType() {
-    return ListDirection.RIGHT;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.RPOP;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java
deleted file mode 100755
index 04f6bfd..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class RPushExecutor extends PushExecutor {
-
-  @Override
-  protected ListDirection pushType() {
-    return ListDirection.RIGHT;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.RPUSH;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java
deleted file mode 100755
index 8d1a007..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.list;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class RPushXExecutor extends PushXExecutor {
-
-  @Override
-  protected ListDirection pushType() {
-    return ListDirection.RIGHT;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.RPUSHX;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java
deleted file mode 100755
index 2226a55..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class SAddExecutor extends SetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SADD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion = (Region<ByteArrayWrapper, Boolean>) context
-        .getRegionProvider().getOrCreateRegion(key, RedisDataType.REDIS_SET, context);
-
-    if (commandElems.size() >= 4) {
-      Map<ByteArrayWrapper, Boolean> entries = new HashMap<ByteArrayWrapper, Boolean>();
-      for (int i = 2; i < commandElems.size(); i++)
-        entries.put(new ByteArrayWrapper(commandElems.get(i)), true);
-
-      keyRegion.putAll(entries);
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), entries.size()));
-    } else {
-      Object v = keyRegion.put(new ByteArrayWrapper(commandElems.get(2)), true);
-      command
-          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), v == null ? 1 : 0));
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java
deleted file mode 100755
index c1d3a4c..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-
-public class SCardExecutor extends SetExecutor {
-
-  private final int NOT_EXISTS = 0;
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SCARD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java
deleted file mode 100755
index ef61a93..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SDiffExecutor extends SetOpExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return false;
-  }
-
-  @Override
-  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
-      List<Set<ByteArrayWrapper>> setList) {
-    if (firstSet == null)
-      return null;
-    for (Set<ByteArrayWrapper> set : setList)
-      firstSet.removeAll(set);
-    return firstSet;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SDIFF;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java
deleted file mode 100755
index 63064da..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class SDiffStoreExecutor extends SDiffExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SDIFFSTORE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java
deleted file mode 100755
index e51fa2c..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SInterExecutor extends SetOpExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return false;
-  }
-
-  @Override
-  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
-      List<Set<ByteArrayWrapper>> setList) {
-    if (firstSet == null)
-      return null;
-    for (Set<ByteArrayWrapper> set : setList) {
-      if (set == null || set.isEmpty())
-        return null;
-      firstSet.retainAll(set);
-    }
-    return firstSet;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SINTER;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java
deleted file mode 100755
index bef36ff..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class SInterStoreExecutor extends SInterExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SINTERSTORE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java
deleted file mode 100755
index 62ff597..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-
-public class SIsMemberExecutor extends SetExecutor {
-
-  private final int EXISTS = 1;
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SISMEMBER));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
-
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    if (keyRegion.containsKey(member))
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTS));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java
deleted file mode 100755
index dc94897..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class SMembersExecutor extends SetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SMEMBERS));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Set<ByteArrayWrapper> members = new HashSet(keyRegion.keySet()); // Emulate copy on read
-
-    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), members));
-  }
-}


[10/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java
new file mode 100644
index 0000000..460a330
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import org.apache.geode.DataSerializable;
+import org.apache.geode.DataSerializer;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+/**
+ * This is a wrapper class for doubles, similar to {@link ByteArrayWrapper}
+ * 
+ *
+ */
+public class DoubleWrapper implements DataSerializable, Comparable<Object> {
+
+  private static final long serialVersionUID = 6946858357297398633L;
+
+  public Double score;
+  private String toString;
+
+  public DoubleWrapper() {}
+
+  public DoubleWrapper(Double dubs) {
+    this.score = dubs;
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeDouble(score, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.score = DataSerializer.readDouble(in);
+  }
+
+  @Override
+  public int compareTo(Object arg0) {
+    Double other;
+    if (arg0 instanceof DoubleWrapper) {
+      other = ((DoubleWrapper) arg0).score;
+    } else if (arg0 instanceof Double) {
+      other = (Double) arg0;
+    } else
+      return 0;
+    Double diff = this.score - other;
+    if (diff > 0)
+      return 1;
+    else if (diff < 0)
+      return -1;
+    else
+      return 0;
+  }
+
+  public String toString() {
+    if (this.toString == null)
+      this.toString = Coder.doubleToString(score);
+    return this.toString;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java
new file mode 100644
index 0000000..8202b10
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java
@@ -0,0 +1,392 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.handler.codec.DecoderException;
+import io.netty.util.concurrent.EventExecutor;
+import org.apache.geode.LogWriter;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.TransactionException;
+import org.apache.geode.cache.TransactionId;
+import org.apache.geode.cache.UnsupportedOperationInTransactionException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.RegionNotFoundException;
+import org.apache.geode.redis.GeodeRedisServiceImpl;
+import org.apache.geode.redis.internal.executor.transactions.TransactionExecutor;
+
+import java.io.IOException;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * This class extends {@link ChannelInboundHandlerAdapter} from Netty and it is the last part of the
+ * channel pipeline. The {@link ByteToCommandDecoder} forwards a {@link Command} to this class which
+ * executes it and sends the result back to the client. Additionally, all exception handling is done
+ * by this class.
+ * <p>
+ * Besides being part of Netty's pipeline, this class also serves as a context to the execution of a
+ * command. It abstracts transactions, provides access to the {@link RegionProvider} and anything
+ * else an executing {@link Command} may need.
+ * 
+ *
+ */
+public class ExecutionHandlerContext extends ChannelInboundHandlerAdapter {
+
+  private static final int WAIT_REGION_DSTRYD_MILLIS = 100;
+  private static final int MAXIMUM_NUM_RETRIES = (1000 * 60) / WAIT_REGION_DSTRYD_MILLIS; // 60
+                                                                                          // seconds
+                                                                                          // total
+
+  private final Cache cache;
+  private final GeodeRedisServiceImpl server;
+  private final LogWriter logger;
+  private final Channel channel;
+  private final AtomicBoolean needChannelFlush;
+  private final Runnable flusher;
+  private final EventExecutor lastExecutor;
+  private final ByteBufAllocator byteBufAllocator;
+  /**
+   * TransactionId for any transactions started by this client
+   */
+  private TransactionId transactionID;
+
+  /**
+   * Queue of commands for a given transaction
+   */
+  private Queue<Command> transactionQueue;
+  private final RegionProvider regionProvider;
+  private final byte[] authPwd;
+
+  private boolean isAuthenticated;
+
+  /**
+   * Default constructor for execution contexts.
+   * 
+   * @param ch Channel used by this context, should be one to one
+   * @param cache The Geode cache instance of this vm
+   * @param regionProvider The region provider of this context
+   * @param server Instance of the server it is attached to, only used so that any execution can
+   *        initiate a shutdwon
+   * @param pwd Authentication password for each context, can be null
+   */
+  public ExecutionHandlerContext(Channel ch, Cache cache, RegionProvider regionProvider,
+      GeodeRedisServiceImpl server, byte[] pwd) {
+    if (ch == null || cache == null || regionProvider == null || server == null)
+      throw new IllegalArgumentException("Only the authentication password may be null");
+    this.cache = cache;
+    this.server = server;
+    this.logger = cache.getLogger();
+    this.channel = ch;
+    this.needChannelFlush = new AtomicBoolean(false);
+    this.flusher = new Runnable() {
+
+      @Override
+      public void run() {
+        flushChannel();
+      }
+
+    };
+    this.lastExecutor = channel.pipeline().lastContext().executor();
+    this.byteBufAllocator = channel.alloc();
+    this.transactionID = null;
+    this.transactionQueue = null; // Lazy
+    this.regionProvider = regionProvider;
+    this.authPwd = pwd;
+    this.isAuthenticated = pwd != null ? false : true;
+  }
+
+  private void flushChannel() {
+    while (needChannelFlush.getAndSet(false)) {
+      channel.flush();
+    }
+  }
+
+  private void writeToChannel(ByteBuf message) {
+    channel.write(message, channel.voidPromise());
+    if (!needChannelFlush.getAndSet(true)) {
+      this.lastExecutor.execute(flusher);
+    }
+  }
+
+  /**
+   * This will handle the execution of received commands
+   */
+  @Override
+  public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+    Command command = (Command) msg;
+    executeCommand(ctx, command);
+  }
+
+  /**
+   * Exception handler for the entire pipeline
+   */
+  @Override
+  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
+    if (cause instanceof IOException) {
+      channelInactive(ctx);
+      return;
+    }
+    ByteBuf response = getExceptionResponse(ctx, cause);
+    writeToChannel(response);
+  }
+
+  private ByteBuf getExceptionResponse(ChannelHandlerContext ctx, Throwable cause) {
+    ByteBuf response;
+    if (cause instanceof RedisDataTypeMismatchException)
+      response = Coder.getWrongTypeResponse(this.byteBufAllocator, cause.getMessage());
+    else if (cause instanceof DecoderException
+        && cause.getCause() instanceof RedisCommandParserException)
+      response =
+          Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.PARSING_EXCEPTION_MESSAGE);
+    else if (cause instanceof RegionCreationException) {
+      this.logger.error(cause);
+      response =
+          Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.ERROR_REGION_CREATION);
+    } else if (cause instanceof InterruptedException || cause instanceof CacheClosedException)
+      response =
+          Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.SERVER_ERROR_SHUTDOWN);
+    else if (cause instanceof IllegalStateException) {
+      response = Coder.getErrorResponse(this.byteBufAllocator, cause.getMessage());
+    } else {
+      if (this.logger.errorEnabled())
+        this.logger.error("GeodeRedisServiceImpl-Unexpected error handler for " + ctx.channel(),
+            cause);
+      response = Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.SERVER_ERROR_MESSAGE);
+    }
+    return response;
+  }
+
+  @Override
+  public void channelInactive(ChannelHandlerContext ctx) {
+    if (logger.fineEnabled())
+      logger.fine("GeodeRedisServiceImpl-Connection closing with " + ctx.channel().remoteAddress());
+    ctx.channel().close();
+    ctx.close();
+  }
+
+  private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception {
+    RedisCommandType type = command.getCommandType();
+    Executor exec = type.getExecutor();
+    if (isAuthenticated) {
+      if (type == RedisCommandType.SHUTDOWN) {
+        this.server.stop();
+        return;
+      }
+      if (hasTransaction() && !(exec instanceof TransactionExecutor))
+        executeWithTransaction(ctx, exec, command);
+      else
+        executeWithoutTransaction(exec, command);
+
+      if (hasTransaction() && command.getCommandType() != RedisCommandType.MULTI) {
+        writeToChannel(
+            Coder.getSimpleStringResponse(this.byteBufAllocator, RedisConstants.COMMAND_QUEUED));
+      } else {
+        ByteBuf response = command.getResponse();
+        writeToChannel(response);
+      }
+    } else if (type == RedisCommandType.QUIT) {
+      exec.executeCommand(command, this);
+      ByteBuf response = command.getResponse();
+      writeToChannel(response);
+      channelInactive(ctx);
+    } else if (type == RedisCommandType.AUTH) {
+      exec.executeCommand(command, this);
+      ByteBuf response = command.getResponse();
+      writeToChannel(response);
+    } else {
+      ByteBuf r = Coder.getNoAuthResponse(this.byteBufAllocator, RedisConstants.ERROR_NOT_AUTH);
+      writeToChannel(r);
+    }
+  }
+
+  /**
+   * Private helper method to execute a command without a transaction, done for special exception
+   * handling neatness
+   * 
+   * @param exec Executor to use
+   * @param command Command to execute
+   * @throws Exception Throws exception if exception is from within execution and not to be handled
+   */
+  private void executeWithoutTransaction(final Executor exec, Command command) throws Exception {
+    Exception cause = null;
+    for (int i = 0; i < MAXIMUM_NUM_RETRIES; i++) {
+      try {
+        exec.executeCommand(command, this);
+        return;
+      } catch (Exception e) {
+        cause = e;
+        if (e instanceof RegionDestroyedException || e instanceof RegionNotFoundException
+            || e.getCause() instanceof QueryInvocationTargetException)
+          Thread.sleep(WAIT_REGION_DSTRYD_MILLIS);
+      }
+    }
+    throw cause;
+  }
+
+  private void executeWithTransaction(ChannelHandlerContext ctx, final Executor exec,
+      Command command) throws Exception {
+    CacheTransactionManager txm = cache.getCacheTransactionManager();
+    TransactionId transactionId = getTransactionID();
+    txm.resume(transactionId);
+    try {
+      exec.executeCommand(command, this);
+    } catch (UnsupportedOperationInTransactionException e) {
+      command.setResponse(Coder.getErrorResponse(this.byteBufAllocator,
+          RedisConstants.ERROR_UNSUPPORTED_OPERATION_IN_TRANSACTION));
+    } catch (TransactionException e) {
+      command.setResponse(Coder.getErrorResponse(this.byteBufAllocator,
+          RedisConstants.ERROR_TRANSACTION_EXCEPTION));
+    } catch (Exception e) {
+      ByteBuf response = getExceptionResponse(ctx, e);
+      command.setResponse(response);
+    }
+    getTransactionQueue().add(command);
+    transactionId = txm.suspend();
+    setTransactionID(transactionId);
+  }
+
+  /**
+   * Get the current transacationId
+   * 
+   * @return The current transactionId, null if one doesn't exist
+   */
+  public TransactionId getTransactionID() {
+    return this.transactionID;
+  }
+
+  /**
+   * Check if client has transaction
+   * 
+   * @return True if client has transaction, false otherwise
+   */
+  public boolean hasTransaction() {
+    return transactionID != null;
+  }
+
+  /**
+   * Setter method for transaction
+   * 
+   * @param id TransactionId of current transaction for client
+   */
+  public void setTransactionID(TransactionId id) {
+    this.transactionID = id;
+  }
+
+  /**
+   * Reset the transaction of client
+   */
+  public void clearTransaction() {
+    this.transactionID = null;
+    if (this.transactionQueue != null) {
+      for (Command c : this.transactionQueue) {
+        ByteBuf r = c.getResponse();
+        if (r != null)
+          r.release();
+      }
+      this.transactionQueue.clear();
+    }
+  }
+
+  /**
+   * Getter for transaction command queue
+   * 
+   * @return Command queue
+   */
+  public Queue<Command> getTransactionQueue() {
+    if (this.transactionQueue == null)
+      this.transactionQueue = new ConcurrentLinkedQueue<Command>();
+    return this.transactionQueue;
+  }
+
+  /**
+   * {@link ByteBuf} allocator for this context. All executors must use this pooled allocator as
+   * opposed to having unpooled buffers for maximum performance
+   * 
+   * @return allocator instance
+   */
+  public ByteBufAllocator getByteBufAllocator() {
+    return this.byteBufAllocator;
+  }
+
+  /**
+   * Gets the provider of Regions
+   * 
+   * @return Provider
+   */
+  public RegionProvider getRegionProvider() {
+    return this.regionProvider;
+  }
+
+  /**
+   * Getter for manager to allow pausing and resuming transactions
+   * 
+   * @return Instance
+   */
+  public CacheTransactionManager getCacheTransactionManager() {
+    return this.cache.getCacheTransactionManager();
+  }
+
+  /**
+   * Getter for logger
+   * 
+   * @return instance
+   */
+  public LogWriter getLogger() {
+    return this.cache.getLogger();
+  }
+
+  /**
+   * Get the channel for this context
+   * 
+   * @return instance
+   *
+   *         public Channel getChannel() { return this.channel; }
+   */
+
+  /**
+   * Get the authentication password, this will be same server wide. It is exposed here as opposed
+   * to {@link GeodeRedisServiceImpl}.
+   * 
+   * @return password
+   */
+  public byte[] getAuthPwd() {
+    return this.authPwd;
+  }
+
+  /**
+   * Checker if user has authenticated themselves
+   * 
+   * @return True if no authentication required or authentication complete, false otherwise
+   */
+  public boolean isAuthenticated() {
+    return this.isAuthenticated;
+  }
+
+  /**
+   * Lets this context know the authentication is complete
+   */
+  public void setAuthenticationVerified() {
+    this.isAuthenticated = true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/Executor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/Executor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/Executor.java
new file mode 100644
index 0000000..7698535
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/Executor.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+
+/**
+ * Interface for executors of a {@link Command}
+ * 
+ *
+ */
+public interface Executor {
+
+  /**
+   * This method executes the command and sets the response. Any runtime errors from this execution
+   * should be handled by caller to ensure the client gets a response
+   * 
+   * @param command The command to be executed
+   * @param context The execution context by which this command is to be executed
+   */
+  public void executeCommand(Command command, ExecutionHandlerContext context);
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/Extendable.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/Extendable.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/Extendable.java
new file mode 100644
index 0000000..ed36030
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/Extendable.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+/**
+ * This defines a command that can be extended, and there may need some level of abstraction
+ * 
+ *
+ */
+public interface Extendable {
+
+  /**
+   * Getter for error message in case of argument arity mismatch
+   * 
+   * @return Error string
+   */
+  public String getArgsError();
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java
new file mode 100644
index 0000000..4ec154a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+/**
+ * Exception thrown by CommandParser (non-existent class) when a command has illegal syntax
+ * 
+ *
+ */
+public class RedisCommandParserException extends Exception {
+
+  private static final long serialVersionUID = 4707944288714910949L;
+
+  public RedisCommandParserException() {
+    super();
+  }
+
+  public RedisCommandParserException(String message) {
+    super(message);
+  }
+
+  public RedisCommandParserException(Throwable cause) {
+    super(cause);
+  }
+
+  public RedisCommandParserException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
new file mode 100644
index 0000000..acacd12
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
@@ -0,0 +1,2896 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal;
+
+import org.apache.geode.redis.internal.executor.AuthExecutor;
+import org.apache.geode.redis.internal.executor.DBSizeExecutor;
+import org.apache.geode.redis.internal.executor.DelExecutor;
+import org.apache.geode.redis.internal.executor.EchoExecutor;
+import org.apache.geode.redis.internal.executor.ExistsExecutor;
+import org.apache.geode.redis.internal.executor.ExpireAtExecutor;
+import org.apache.geode.redis.internal.executor.ExpireExecutor;
+import org.apache.geode.redis.internal.executor.FlushAllExecutor;
+import org.apache.geode.redis.internal.executor.KeysExecutor;
+import org.apache.geode.redis.internal.executor.PExpireAtExecutor;
+import org.apache.geode.redis.internal.executor.PExpireExecutor;
+import org.apache.geode.redis.internal.executor.PTTLExecutor;
+import org.apache.geode.redis.internal.executor.PersistExecutor;
+import org.apache.geode.redis.internal.executor.PingExecutor;
+import org.apache.geode.redis.internal.executor.QuitExecutor;
+import org.apache.geode.redis.internal.executor.ScanExecutor;
+import org.apache.geode.redis.internal.executor.ShutDownExecutor;
+import org.apache.geode.redis.internal.executor.TTLExecutor;
+import org.apache.geode.redis.internal.executor.TimeExecutor;
+import org.apache.geode.redis.internal.executor.TypeExecutor;
+import org.apache.geode.redis.internal.executor.UnkownExecutor;
+import org.apache.geode.redis.internal.executor.hash.HDelExecutor;
+import org.apache.geode.redis.internal.executor.hash.HExistsExecutor;
+import org.apache.geode.redis.internal.executor.hash.HGetAllExecutor;
+import org.apache.geode.redis.internal.executor.hash.HGetExecutor;
+import org.apache.geode.redis.internal.executor.hash.HIncrByExecutor;
+import org.apache.geode.redis.internal.executor.hash.HIncrByFloatExecutor;
+import org.apache.geode.redis.internal.executor.hash.HKeysExecutor;
+import org.apache.geode.redis.internal.executor.hash.HLenExecutor;
+import org.apache.geode.redis.internal.executor.hash.HMGetExecutor;
+import org.apache.geode.redis.internal.executor.hash.HMSetExecutor;
+import org.apache.geode.redis.internal.executor.hash.HScanExecutor;
+import org.apache.geode.redis.internal.executor.hash.HSetExecutor;
+import org.apache.geode.redis.internal.executor.hash.HSetNXExecutor;
+import org.apache.geode.redis.internal.executor.hash.HValsExecutor;
+import org.apache.geode.redis.internal.executor.hll.PFAddExecutor;
+import org.apache.geode.redis.internal.executor.hll.PFCountExecutor;
+import org.apache.geode.redis.internal.executor.hll.PFMergeExecutor;
+import org.apache.geode.redis.internal.executor.list.LIndexExecutor;
+import org.apache.geode.redis.internal.executor.list.LInsertExecutor;
+import org.apache.geode.redis.internal.executor.list.LLenExecutor;
+import org.apache.geode.redis.internal.executor.list.LPopExecutor;
+import org.apache.geode.redis.internal.executor.list.LPushExecutor;
+import org.apache.geode.redis.internal.executor.list.LPushXExecutor;
+import org.apache.geode.redis.internal.executor.list.LRangeExecutor;
+import org.apache.geode.redis.internal.executor.list.LRemExecutor;
+import org.apache.geode.redis.internal.executor.list.LSetExecutor;
+import org.apache.geode.redis.internal.executor.list.LTrimExecutor;
+import org.apache.geode.redis.internal.executor.list.RPopExecutor;
+import org.apache.geode.redis.internal.executor.list.RPushExecutor;
+import org.apache.geode.redis.internal.executor.list.RPushXExecutor;
+import org.apache.geode.redis.internal.executor.set.SAddExecutor;
+import org.apache.geode.redis.internal.executor.set.SCardExecutor;
+import org.apache.geode.redis.internal.executor.set.SDiffExecutor;
+import org.apache.geode.redis.internal.executor.set.SDiffStoreExecutor;
+import org.apache.geode.redis.internal.executor.set.SInterExecutor;
+import org.apache.geode.redis.internal.executor.set.SInterStoreExecutor;
+import org.apache.geode.redis.internal.executor.set.SIsMemberExecutor;
+import org.apache.geode.redis.internal.executor.set.SMembersExecutor;
+import org.apache.geode.redis.internal.executor.set.SMoveExecutor;
+import org.apache.geode.redis.internal.executor.set.SPopExecutor;
+import org.apache.geode.redis.internal.executor.set.SRandMemberExecutor;
+import org.apache.geode.redis.internal.executor.set.SRemExecutor;
+import org.apache.geode.redis.internal.executor.set.SScanExecutor;
+import org.apache.geode.redis.internal.executor.set.SUnionExecutor;
+import org.apache.geode.redis.internal.executor.set.SUnionStoreExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZAddExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZCardExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZCountExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZIncrByExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZLexCountExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRangeByLexExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRangeByScoreExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRangeExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRankExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRemExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRemRangeByLexExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRemRangeByRankExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRemRangeByScoreExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRevRangeByScoreExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRevRangeExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZRevRankExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZScanExecutor;
+import org.apache.geode.redis.internal.executor.sortedset.ZScoreExecutor;
+import org.apache.geode.redis.internal.executor.string.AppendExecutor;
+import org.apache.geode.redis.internal.executor.string.BitCountExecutor;
+import org.apache.geode.redis.internal.executor.string.BitOpExecutor;
+import org.apache.geode.redis.internal.executor.string.BitPosExecutor;
+import org.apache.geode.redis.internal.executor.string.DecrByExecutor;
+import org.apache.geode.redis.internal.executor.string.DecrExecutor;
+import org.apache.geode.redis.internal.executor.string.GetBitExecutor;
+import org.apache.geode.redis.internal.executor.string.GetExecutor;
+import org.apache.geode.redis.internal.executor.string.GetRangeExecutor;
+import org.apache.geode.redis.internal.executor.string.GetSetExecutor;
+import org.apache.geode.redis.internal.executor.string.IncrByExecutor;
+import org.apache.geode.redis.internal.executor.string.IncrByFloatExecutor;
+import org.apache.geode.redis.internal.executor.string.IncrExecutor;
+import org.apache.geode.redis.internal.executor.string.MGetExecutor;
+import org.apache.geode.redis.internal.executor.string.MSetExecutor;
+import org.apache.geode.redis.internal.executor.string.MSetNXExecutor;
+import org.apache.geode.redis.internal.executor.string.PSetEXExecutor;
+import org.apache.geode.redis.internal.executor.string.SetBitExecutor;
+import org.apache.geode.redis.internal.executor.string.SetEXExecutor;
+import org.apache.geode.redis.internal.executor.string.SetExecutor;
+import org.apache.geode.redis.internal.executor.string.SetNXExecutor;
+import org.apache.geode.redis.internal.executor.string.SetRangeExecutor;
+import org.apache.geode.redis.internal.executor.string.StrlenExecutor;
+import org.apache.geode.redis.internal.executor.transactions.DiscardExecutor;
+import org.apache.geode.redis.internal.executor.transactions.ExecExecutor;
+import org.apache.geode.redis.internal.executor.transactions.MultiExecutor;
+import org.apache.geode.redis.internal.executor.transactions.UnwatchExecutor;
+import org.apache.geode.redis.internal.executor.transactions.WatchExecutor;
+
+/**
+ * The redis command type used by the server. Each command is directly from the redis protocol and
+ * calling {@link #getExecutor()} on a type returns the executor class for that command.
+ * 
+ *
+ */
+public enum RedisCommandType {
+
+  /***************************************
+   *************** Keys ******************
+   ***************************************/
+
+  /**
+   * AUTH password
+   * <p>
+   * Authenticate to the server
+   */
+  AUTH {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new AuthExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * DEL key [key ...]
+   * <p>
+   * Delete a key
+   */
+  DEL {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new DelExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * EXISTS key
+   * <p>
+   * Determine if a key exists
+   */
+  EXISTS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ExistsExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * EXPIRE key seconds
+   * <p>
+   * Set a key's time to live in seconds
+   */
+  EXPIRE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ExpireExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * EXPIREAT key timestamp
+   * <p>
+   * Set the expiration for a key as a UNIX timestamp
+   */
+  EXPIREAT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ExpireAtExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * FLUSHALL
+   * <p>
+   * Remove all keys from all databases
+   */
+  FLUSHALL {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new FlushAllExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * FLUSHDB
+   * <p>
+   * Remove all keys from the current database
+   * <p>
+   * Same as FLUSHALL for this implementation
+   */
+  FLUSHDB {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new FlushAllExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * KEYS pattern
+   * <p>
+   * Find all keys matching the given pattern
+   */
+  KEYS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new KeysExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PERSIST key
+   * <p>
+   * Remove the expiration from a key
+   */
+  PERSIST {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PersistExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PEXPIRE key milliseconds
+   * <p>
+   * Set a key's time to live in milliseconds
+   */
+  PEXPIRE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PExpireExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PEXPIREAT key milliseconds-timestamp
+   * <p>
+   * Set the expiration for a key as a UNIX timestamp specified in milliseconds
+   */
+  PEXPIREAT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PExpireAtExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PTTL key
+   * <p>
+   * Get the time to live for a key in milliseconds
+   */
+  PTTL {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PTTLExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SCAN cursor [MATCH pattern] [COUNT count]
+   * <p>
+   * Incrementally iterate the keys space
+   */
+  SCAN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ScanExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * TTL key
+   * <p>
+   * Get the time to live for a key
+   */
+  TTL {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new TTLExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * TYPE key
+   * <p>
+   * Determine the type stored at key
+   */
+  TYPE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new TypeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   ************** Strings ****************
+   ***************************************/
+
+  /**
+   * APPEND key value
+   * <p>
+   * Append a value to a key
+   */
+  APPEND {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new AppendExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * BITCOUNT key start end [start end ...]
+   * <p>
+   * Count set bits in a string
+   */
+  BITCOUNT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new BitCountExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * BITOP operation destkey key [key ...]
+   * <p>
+   * Perform bitwise operations between strings
+   */
+  BITOP {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new BitOpExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * BITPOS key bit [start] [end]
+   * <p>
+   * Find first bit set or clear in a string
+   */
+  BITPOS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new BitPosExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * DECR key
+   * <p>
+   * Decrement the integer value of a key by one
+   */
+  DECR {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new DecrExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * DECRBY key decrement
+   * <p>
+   * Decrement the integer value of a key by the given number
+   */
+  DECRBY {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new DecrByExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * GET key
+   * <p>
+   * Get the value of a key
+   */
+  GET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new GetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * GETBIT key offset
+   * <p>
+   * Returns the bit value at offset in the string value stored at key
+   */
+  GETBIT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new GetBitExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * GETRANGE key start end
+   * <p>
+   * Get a substring of the string stored at a key
+   */
+  GETRANGE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new GetRangeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * GETSET key value
+   * <p>
+   * Set the string value of a key and return its old value
+   */
+  GETSET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new GetSetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * INCR key
+   * <p>
+   * Increment the integer value of a key by one
+   */
+  INCR {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new IncrExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * INCRBY key increment
+   * <p>
+   * Increment the integer value of a key by the given amount
+   */
+  INCRBY {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new IncrByExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * INCRBYFLOAT key increment
+   * <p>
+   * Increment the float value of a key by the given amount
+   */
+  INCRBYFLOAT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new IncrByFloatExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * MGET key [key ...]
+   * <p>
+   * Get the values of all the given keys
+   */
+  MGET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new MGetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * MSET key value [key value ...]
+   * <p>
+   * Set multiple keys to multiple values
+   */
+  MSET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new MSetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * MSETNX key value [key value ...]
+   * <p>
+   * Set multiple keys to multiple values, only if none of the keys exist
+   */
+  MSETNX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new MSetNXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PSETEX key milliseconds value
+   * <p>
+   * Set the value and expiration in milliseconds of a key
+   */
+  PSETEX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PSetEXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SETEX key seconds value
+   * <p>
+   * Set the value and expiration of a key
+   */
+  SETEX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SetEXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SET key value [EX seconds] [PX milliseconds] [NX|XX]
+   * <p>
+   * Set the string value of a key
+   */
+  SET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SETBIT key offset value
+   * <P>
+   * Sets or clears the bit at offset in the string value stored at key
+   */
+  SETBIT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SetBitExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SETNX key value
+   * <p>
+   * Set the value of a key, only if the key does not exist
+   */
+  SETNX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SetNXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SETRANGE key offset value
+   * <p>
+   * Overwrite part of a string at key starting at the specified offset
+   */
+  SETRANGE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SetRangeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * STRLEN key
+   * <p>
+   * Get the length of the value stored in a key
+   */
+  STRLEN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new StrlenExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   **************** Hashes ***************
+   ***************************************/
+  /**
+   * HDEL key field [field ...]
+   * <p>
+   * Delete one or more hash fields
+   */
+  HDEL {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HDelExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HEXISTS key field
+   * <p>
+   * Determine if a hash field exists
+   */
+  HEXISTS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HExistsExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HGET key field
+   * <p>
+   * Get the value of a hash field
+   */
+  HGET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HGetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HGETALL key
+   * <p>
+   * Get all the fields and values in a hash
+   */
+  HGETALL {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HGetAllExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HINCRBY key field increment
+   * <p>
+   * Increment the integer value of a hash field by the given number
+   */
+  HINCRBY {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HIncrByExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HINCRBYFLOAT key field increment
+   * <p>
+   * Increment the float value of a hash field by the given amount
+   */
+  HINCRBYFLOAT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HIncrByFloatExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HKEYS key
+   * <p>
+   * Get all the fields in a hash
+   */
+  HKEYS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HKeysExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HLEN key
+   * <p>
+   * Get the number of fields in a hash
+   */
+  HLEN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HLenExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HMGET key field [field ...]
+   * <p>
+   * Get the values of all the given hash fields
+   */
+  HMGET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HMGetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HMSET key field value [field value ...]
+   * <p>
+   * Set multiple hash fields to multiple values
+   */
+  HMSET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HMSetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HSCAN key cursor [MATCH pattern] [COUNT count]
+   * <p>
+   * Incrementally iterate hash fields and associated values
+   */
+  HSCAN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HScanExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HSET key field value
+   * <p>
+   * Set the string value of a hash field
+   */
+  HSET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HSetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HSETNX key field value
+   * <p>
+   * Set the value of a hash field, only if the field does not exist
+   */
+  HSETNX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HSetNXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * HVALS key
+   * <p>
+   * Get all the values in a hash
+   */
+  HVALS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new HValsExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   *********** HyperLogLogs **************
+   ***************************************/
+
+  /**
+   * PFADD key element [element ...]
+   * <p>
+   * Adds the specified elements to the specified HyperLogLog
+   */
+  PFADD {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PFAddExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HLL;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PFCOUNT key [key ...]
+   * <p>
+   * Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s)
+   */
+  PFCOUNT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PFCountExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HLL;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PFMERGE destkey sourcekey [sourcekey ...]
+   * <p>
+   * Merge N different HyperLogLogs into a single one
+   */
+  PFMERGE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PFMergeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_HLL;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   *************** Lists *****************
+   ***************************************/
+
+  /**
+   * LINDEX key index
+   * <p>
+   * Get an element from a list by its index
+   */
+  LINDEX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LIndexExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LINSERT key BEFORE|AFTER pivot value
+   * <p>
+   * Insert an element before or after another element in a list
+   */
+  LINSERT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LInsertExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LLEN key
+   * <p>
+   * Get the length of a list
+   */
+  LLEN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LLenExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LPOP key
+   * <p>
+   * Remove and get the first element in a list
+   */
+  LPOP {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LPopExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LPUSH key value [value ...]
+   * <p>
+   * Prepend one or multiple values to a list
+   */
+  LPUSH {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LPushExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LPUSHX key value
+   * <p>
+   * Prepend a value to a list, only if the list exists
+   */
+  LPUSHX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LPushXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LRANGE key start stop
+   * <p>
+   * Get a range of elements from a list
+   */
+  LRANGE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LRangeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LREM key count value
+   * <p>
+   * Remove elements from a list
+   */
+  LREM {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LRemExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LSET key index value
+   * <p>
+   * Set the value of an element in a list by its index
+   */
+  LSET {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LSetExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * LTRIM key start stop
+   * <p>
+   * Trim a list to the specified range
+   */
+  LTRIM {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new LTrimExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * RPOP key
+   * <p>
+   * Remove and get the last element in a list
+   */
+  RPOP {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new RPopExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * RPUSH key value [value ...]
+   * <p>
+   * Append one or multiple values to a list
+   */
+  RPUSH {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new RPushExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * RPUSHX key value
+   * <p>
+   * Append a value to a list, only if the list exists
+   */
+  RPUSHX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new RPushXExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   **************** Sets *****************
+   ***************************************/
+
+  /**
+   * SADD key member [member ...]
+   * <p>
+   * Add one or more members to a set
+   */
+  SADD {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SAddExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SCARD key
+   * <p>
+   * Get the number of members in a set
+   */
+  SCARD {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SCardExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SDIFF key [key ...]
+   * <p>
+   * Subtract multiple sets
+   */
+  SDIFF {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SDiffExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SDIFFSTORE destination key [key ...]
+   * <p>
+   * Subtract multiple sets and store the resulting set in a key
+   */
+  SDIFFSTORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SDiffStoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SISMEMBER key member
+   * <p>
+   * Determine if a given value is a member of a set
+   */
+  SISMEMBER {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SIsMemberExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SINTER key [key ...]
+   * <p>
+   * Intersect multiple sets
+   */
+  SINTER {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SInterExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SINTERSTORE destination key [key ...]
+   * <p>
+   * Intersect multiple sets and store the resulting set in a key
+   */
+  SINTERSTORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SInterStoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SMEMBERS key
+   * <p>
+   * Get all the members in a set
+   */
+  SMEMBERS {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SMembersExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SMOVE source destination member
+   * <p>
+   * Move a member from one set to another
+   */
+  SMOVE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SMoveExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SPOP key
+   * <p>
+   * Remove and return a random member from a set
+   */
+  SPOP {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SPopExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SRANDMEMBER key [count]
+   * <p>
+   * Get one or multiple random members from a set
+   */
+  SRANDMEMBER {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SRandMemberExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SUNION key [key ...]
+   * <p>
+   * Add multiple sets
+   */
+  SUNION {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SUnionExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SUNIONSTORE destination key [key ...]
+   * <p>
+   * Add multiple sets and store the resulting set in a key
+   */
+  SUNIONSTORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SUnionStoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SSCAN key cursor [MATCH pattern] [COUNT count]
+   * <p>
+   * Incrementally iterate Set elements
+   */
+  SSCAN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SScanExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SREM key member [member ...]
+   * <p>
+   * Remove one or more members from a set
+   */
+  SREM {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new SRemExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   ************* Sorted Sets *************
+   ***************************************/
+
+  /**
+   * ZADD key score member [score member ...]
+   * <p>
+   * Add one or more members to a sorted set, or update its score if it already exists
+   */
+  ZADD {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZAddExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZCARD key
+   * <p>
+   * Get the number of members in a sorted set
+   */
+  ZCARD {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZCardExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZCOUNT key min max
+   * <p>
+   * Count the members in a sorted set with scores within the given values
+   */
+  ZCOUNT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZCountExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZINCRBY key increment member
+   * <p>
+   * Increment the score of a member in a sorted set
+   */
+  ZINCRBY {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZIncrByExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZLEXCOUNT key min max
+   * <p>
+   * Count the number of members in a sorted set between a given lexicographical range
+   */
+  ZLEXCOUNT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZLexCountExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZRANGE key start stop [WITHSCORES]
+   * <p>
+   * Return a range of members in a sorted set, by index
+   */
+  ZRANGE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRangeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZRANGEBYLEX key min max [LIMIT offset count]
+   * <p>
+   * Return a range of members in a sorted set, by lexicographical range
+   */
+  ZRANGEBYLEX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRangeByLexExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
+   * <p>
+   * Return a range of members in a sorted set, by score
+   */
+  ZRANGEBYSCORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRangeByScoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREVRANGE key start stop [WITHSCORES]
+   * <p>
+   * Return a range of members in a sorted set, by index, with scores ordered from high to low
+   */
+  ZREVRANGE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRevRangeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZRANK key member
+   * <p>
+   * Determine the index of a member in a sorted set
+   */
+  ZRANK {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRankExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREM key member [member ...]
+   * <p>
+   * Remove one or more members from a sorted set
+   */
+  ZREM {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRemExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREMRANGEBYLEX key min max
+   * <p>
+   * Remove all members in a sorted set between the given lexicographical range
+   */
+  ZREMRANGEBYLEX {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRemRangeByLexExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREMRANGEBYRANK key start stop
+   * <p>
+   * Remove all members in a sorted set within the given indexes
+   */
+  ZREMRANGEBYRANK {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRemRangeByRankExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREMRANGEBYSCORE key min max
+   * <p>
+   * Remove all members in a sorted set within the given scores
+   */
+  ZREMRANGEBYSCORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRemRangeByScoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]
+   * <p>
+   * Return a range of members in a sorted set, by score, with scores ordered from high to low
+   */
+  ZREVRANGEBYSCORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRevRangeByScoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZREVRANK key member
+   * <p>
+   * Determine the index of a member in a sorted set, with scores ordered from high to low
+   */
+  ZREVRANK {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZRevRankExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZSCAN key cursor [MATCH pattern] [COUNT count]
+   * <P>
+   * Incrementally iterate sorted sets elements and associated scores
+   */
+  ZSCAN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZScanExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ZSCORE key member
+   * <p>
+   * Get the score associated with the given member in a sorted set
+   */
+  ZSCORE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ZScoreExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   ************ Transactions *************
+   ***************************************/
+
+  /**
+   * DISCARD
+   * <p>
+   * Discard all commands issued after MULTI
+   */
+  DISCARD {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new DiscardExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * EXEC
+   * <p>
+   * Execute all commands issued after MULTI
+   */
+  EXEC {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ExecExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * MULTI
+   * <p>
+   * Mark the start of a transaction block
+   */
+  MULTI {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new MultiExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * UNWATCH
+   * <p>
+   * Forget about all watched keys
+   */
+  UNWATCH {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new UnwatchExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * WATCH key [key ...]
+   * <p>
+   * Watch the given keys to determine execution of the MULTI/EXEC block
+   */
+  WATCH {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new WatchExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /***************************************
+   *************** Server ****************
+   ***************************************/
+
+  /**
+   * DBSIZE
+   * <p>
+   * Return the number of keys in the selected database
+   */
+  DBSIZE {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new DBSizeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * ECHO message
+   * <p>
+   * Echo the given string
+   */
+  ECHO {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new EchoExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * TIME
+   * <p>
+   * Return the current server time
+   */
+  TIME {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new TimeExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * PING
+   * <p>
+   * Ping the server
+   */
+  PING {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new PingExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * QUIT
+   * <p>
+   * Close the connection
+   */
+  QUIT {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new QuitExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  /**
+   * SHUTDOWN
+   * <p>
+   * Shut down the server
+   */
+  SHUTDOWN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new ShutDownExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  },
+
+  // UNKNOWN
+  UNKNOWN {
+    private Executor executor;
+
+    @Override
+    public Executor getExecutor() {
+      if (executor == null) {
+        executor = new UnkownExecutor();
+      }
+      return executor;
+    }
+
+    private final RedisDataType dataType = RedisDataType.NONE;
+
+    @Override
+    public RedisDataType getDataType() {
+      return this.dataType;
+    }
+  };
+
+  /**
+   * Abstract method overridden by each value in enum to get the executor associated with that
+   * command type
+   * 
+   * @return {@link Executor} for command type
+   */
+  public abstract Executor getExecutor();
+
+  public abstract RedisDataType getDataType();
+  /*
+   * private RedisCommandType (RedisDataType dataType) { this.dataType = dataType; }
+   */
+}


[02/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/IBuilder.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/IBuilder.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/IBuilder.java
new file mode 100644
index 0000000..28340c6
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/IBuilder.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2011 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+
+public interface IBuilder<T> {
+
+  T build();
+
+  int sizeof();
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/ICardinality.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/ICardinality.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/ICardinality.java
new file mode 100644
index 0000000..71369b1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/ICardinality.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2011 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+
+import java.io.IOException;
+
+
+public interface ICardinality {
+
+  /**
+   * @param o stream element
+   * @return false if the value returned by cardinality() is unaffected by the appearance of o in
+   *         the stream.
+   */
+  boolean offer(Object o);
+
+  /**
+   * Offer the value as a hashed long value
+   *
+   * @param hashedLong - the hash of the item to offer to the estimator
+   * @return false if the value returned by cardinality() is unaffected by the appearance of
+   *         hashedLong in the stream
+   */
+  boolean offerHashed(long hashedLong);
+
+  /**
+   * Offer the value as a hashed long value
+   *
+   * @param hashedInt - the hash of the item to offer to the estimator
+   * @return false if the value returned by cardinality() is unaffected by the appearance of
+   *         hashedInt in the stream
+   */
+  boolean offerHashed(int hashedInt);
+
+  /**
+   * @return the number of unique elements in the stream or an estimate thereof
+   */
+  long cardinality();
+
+  /**
+   * @return size in bytes needed for serialization
+   */
+  int sizeof();
+
+  /**
+   * @return byte[]
+   * @throws IOException
+   */
+  byte[] getBytes() throws IOException;
+
+  /**
+   * Merges estimators to produce a new estimator for the combined streams of this estimator and
+   * those passed as arguments.
+   * <p/>
+   * Nor this estimator nor the one passed as parameters are modified.
+   *
+   * @param estimators Zero or more compatible estimators
+   * @throws CardinalityMergeException If at least one of the estimators is not compatible with this
+   *         one
+   */
+  ICardinality merge(ICardinality... estimators) throws CardinalityMergeException;
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/MurmurHash.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/MurmurHash.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/MurmurHash.java
new file mode 100644
index 0000000..e5c1b1a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/MurmurHash.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+
+/**
+ * This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See
+ * http://murmurhash.googlepages.com/ for more details.
+ * <p/>
+ * <p>
+ * The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at
+ * getopt org).
+ * </p>
+ */
+public class MurmurHash {
+  public static int hash(Object o) {
+    if (o == null) {
+      return 0;
+    }
+    if (o instanceof Long) {
+      return hashLong((Long) o);
+    }
+    if (o instanceof Integer) {
+      return hashLong((Integer) o);
+    }
+    if (o instanceof Double) {
+      return hashLong(Double.doubleToRawLongBits((Double) o));
+    }
+    if (o instanceof Float) {
+      return hashLong(Float.floatToRawIntBits((Float) o));
+    }
+    if (o instanceof String) {
+      return hash(((String) o).getBytes());
+    }
+    if (o instanceof byte[]) {
+      return hash((byte[]) o);
+    }
+    return hash(o.toString());
+  }
+
+  public static int hash(byte[] data) {
+    return hash(data, 0, data.length, -1);
+  }
+
+  public static int hash(byte[] data, int seed) {
+    return hash(data, 0, data.length, seed);
+  }
+
+  public static int hash(byte[] data, int offset, int length, int seed) {
+    int m = 0x5bd1e995;
+    int r = 24;
+
+    int h = seed ^ length;
+
+    int len_4 = length >> 2;
+
+    for (int i = 0; i < len_4; i++) {
+      int i_4 = i << 2;
+      int k = data[offset + i_4 + 3];
+      k = k << 8;
+      k = k | (data[offset + i_4 + 2] & 0xff);
+      k = k << 8;
+      k = k | (data[offset + i_4 + 1] & 0xff);
+      k = k << 8;
+      k = k | (data[offset + i_4 + 0] & 0xff);
+      k *= m;
+      k ^= k >>> r;
+      k *= m;
+      h *= m;
+      h ^= k;
+    }
+
+    // avoid calculating modulo
+    int len_m = len_4 << 2;
+    int left = length - len_m;
+
+    if (left != 0) {
+      if (left >= 3) {
+        h ^= (int) data[offset + length - 3] << 16;
+      }
+      if (left >= 2) {
+        h ^= (int) data[offset + length - 2] << 8;
+      }
+      if (left >= 1) {
+        h ^= (int) data[offset + length - 1];
+      }
+
+      h *= m;
+    }
+
+    h ^= h >>> 13;
+    h *= m;
+    h ^= h >>> 15;
+
+    return h;
+  }
+
+  public static int hashLong(long data) {
+    int m = 0x5bd1e995;
+    int r = 24;
+
+    int h = 0;
+
+    int k = (int) data * m;
+    k ^= k >>> r;
+    h ^= k * m;
+
+    k = (int) (data >> 32) * m;
+    k ^= k >>> r;
+    h *= m;
+    h ^= k * m;
+
+    h ^= h >>> 13;
+    h *= m;
+    h ^= h >>> 15;
+
+    return h;
+  }
+
+  public static long hash64(Object o) {
+    if (o == null) {
+      return 0l;
+    } else if (o instanceof String) {
+      final byte[] bytes = ((String) o).getBytes();
+      return hash64(bytes, bytes.length);
+    } else if (o instanceof byte[]) {
+      final byte[] bytes = (byte[]) o;
+      return hash64(bytes, bytes.length);
+    }
+    return hash64(o.toString());
+  }
+
+  // 64 bit implementation copied from here: https://github.com/tnm/murmurhash-java
+
+  /**
+   * Generates 64 bit hash from byte array with default seed value.
+   *
+   * @param data byte array to hash
+   * @param length length of the array to hash
+   * @return 64 bit hash of the given string
+   */
+  public static long hash64(final byte[] data, int length) {
+    return hash64(data, length, 0xe17a1465);
+  }
+
+
+  /**
+   * Generates 64 bit hash from byte array of the given length and seed.
+   *
+   * @param data byte array to hash
+   * @param length length of the array to hash
+   * @param seed initial seed value
+   * @return 64 bit hash of the given array
+   */
+  public static long hash64(final byte[] data, int length, int seed) {
+    final long m = 0xc6a4a7935bd1e995L;
+    final int r = 47;
+
+    long h = (seed & 0xffffffffl) ^ (length * m);
+
+    int length8 = length / 8;
+
+    for (int i = 0; i < length8; i++) {
+      final int i8 = i * 8;
+      long k = ((long) data[i8 + 0] & 0xff) + (((long) data[i8 + 1] & 0xff) << 8)
+          + (((long) data[i8 + 2] & 0xff) << 16) + (((long) data[i8 + 3] & 0xff) << 24)
+          + (((long) data[i8 + 4] & 0xff) << 32) + (((long) data[i8 + 5] & 0xff) << 40)
+          + (((long) data[i8 + 6] & 0xff) << 48) + (((long) data[i8 + 7] & 0xff) << 56);
+
+      k *= m;
+      k ^= k >>> r;
+      k *= m;
+
+      h ^= k;
+      h *= m;
+    }
+
+    switch (length % 8) {
+      case 7:
+        h ^= (long) (data[(length & ~7) + 6] & 0xff) << 48;
+      case 6:
+        h ^= (long) (data[(length & ~7) + 5] & 0xff) << 40;
+      case 5:
+        h ^= (long) (data[(length & ~7) + 4] & 0xff) << 32;
+      case 4:
+        h ^= (long) (data[(length & ~7) + 3] & 0xff) << 24;
+      case 3:
+        h ^= (long) (data[(length & ~7) + 2] & 0xff) << 16;
+      case 2:
+        h ^= (long) (data[(length & ~7) + 1] & 0xff) << 8;
+      case 1:
+        h ^= (long) (data[length & ~7] & 0xff);
+        h *= m;
+    };
+
+    h ^= h >>> r;
+    h *= m;
+    h ^= h >>> r;
+
+    return h;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/RegisterSet.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/RegisterSet.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/RegisterSet.java
new file mode 100644
index 0000000..97ac98d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/RegisterSet.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+
+public class RegisterSet {
+
+  public final static int LOG2_BITS_PER_WORD = 6;
+  public final static int REGISTER_SIZE = 5;
+
+  public final int count;
+  public final int size;
+
+  private final int[] M;
+
+  public RegisterSet(int count) {
+    this(count, null);
+  }
+
+  public RegisterSet(int count, int[] initialValues) {
+    this.count = count;
+
+    if (initialValues == null) {
+      this.M = new int[getSizeForCount(count)];
+    } else {
+      this.M = initialValues;
+    }
+    this.size = this.M.length;
+  }
+
+  public static int getBits(int count) {
+    return count / LOG2_BITS_PER_WORD;
+  }
+
+  public static int getSizeForCount(int count) {
+    int bits = getBits(count);
+    if (bits == 0) {
+      return 1;
+    } else if (bits % Integer.SIZE == 0) {
+      return bits;
+    } else {
+      return bits + 1;
+    }
+  }
+
+  public void set(int position, int value) {
+    int bucketPos = position / LOG2_BITS_PER_WORD;
+    int shift = REGISTER_SIZE * (position - (bucketPos * LOG2_BITS_PER_WORD));
+    this.M[bucketPos] = (this.M[bucketPos] & ~(0x1f << shift)) | (value << shift);
+  }
+
+  public int get(int position) {
+    int bucketPos = position / LOG2_BITS_PER_WORD;
+    int shift = REGISTER_SIZE * (position - (bucketPos * LOG2_BITS_PER_WORD));
+    return (this.M[bucketPos] & (0x1f << shift)) >>> shift;
+  }
+
+  public boolean updateIfGreater(int position, int value) {
+    int bucket = position / LOG2_BITS_PER_WORD;
+    int shift = REGISTER_SIZE * (position - (bucket * LOG2_BITS_PER_WORD));
+    int mask = 0x1f << shift;
+
+    // Use long to avoid sign issues with the left-most shift
+    long curVal = this.M[bucket] & mask;
+    long newVal = value << shift;
+    if (curVal < newVal) {
+      this.M[bucket] = (int) ((this.M[bucket] & ~mask) | newVal);
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  public void merge(RegisterSet that) {
+    for (int bucket = 0; bucket < M.length; bucket++) {
+      int word = 0;
+      for (int j = 0; j < LOG2_BITS_PER_WORD; j++) {
+        int mask = 0x1f << (REGISTER_SIZE * j);
+
+        int thisVal = (this.M[bucket] & mask);
+        int thatVal = (that.M[bucket] & mask);
+        word |= (thisVal < thatVal) ? thatVal : thisVal;
+      }
+      this.M[bucket] = word;
+    }
+  }
+
+  int[] readOnlyBits() {
+    return M;
+  }
+
+  public int[] bits() {
+    int[] copy = new int[size];
+    System.arraycopy(M, 0, copy, 0, M.length);
+    return copy;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java
new file mode 100644
index 0000000..b0190f6
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java
@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.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);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.cache.CacheService
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.cache.CacheService b/geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.cache.CacheService
new file mode 100644
index 0000000..efda3a9
--- /dev/null
+++ b/geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.cache.CacheService
@@ -0,0 +1 @@
+org.apache.geode.redis.GeodeRedisServiceImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java
new file mode 100644
index 0000000..753bc9e
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/AuthJUnitTest.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.exceptions.JedisConnectionException;
+import redis.clients.jedis.exceptions.JedisDataException;
+
+@Category(IntegrationTest.class)
+public class AuthJUnitTest extends RedisTestBase {
+
+  private static final String PASSWORD = "pwd";
+
+  private void setupCacheWithPassword() {
+    if (cache != null) {
+      cache.close();
+    }
+    Properties redisCacheProperties = getDefaultRedisCacheProperties();
+    redisCacheProperties.setProperty(ConfigurationProperties.REDIS_PASSWORD, PASSWORD);
+    cache = (GemFireCacheImpl) createCacheInstance(redisCacheProperties);
+  }
+
+  @Test
+  public void testAuthConfig() {
+    setupCacheWithPassword();
+    InternalDistributedSystem distributedSystem = cache.getDistributedSystem();
+    assert (distributedSystem.getConfig().getRedisPassword().equals(PASSWORD));
+    cache.close();
+  }
+
+  @Test
+  public void testAuthRejectAccept() {
+    setupCacheWithPassword();
+    try (Jedis jedis = defaultJedisInstance()) {
+      Exception ex = null;
+      try {
+        jedis.auth("wrongpwd");
+      } catch (JedisDataException e) {
+        ex = e;
+      }
+      assertNotNull(ex);
+
+      String res = jedis.auth(PASSWORD);
+      assertEquals(res, "OK");
+    }
+  }
+
+  @Test
+  public void testAuthNoPwd() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      jedis.auth(PASSWORD);
+      fail(
+          "We expecting either a JedisConnectionException or JedisDataException to be thrown here");
+    } catch (JedisConnectionException | JedisDataException exception) {
+    }
+  }
+
+  @Test
+  public void testAuthAcceptRequests() {
+    setupCacheWithPassword();
+    Exception ex = null;
+    try (Jedis jedis = defaultJedisInstance()) {
+      try {
+        jedis.set("foo", "bar");
+      } catch (JedisDataException e) {
+        ex = e;
+      }
+      assertNotNull(ex);
+
+      String res = jedis.auth(PASSWORD);
+      assertEquals(res, "OK");
+
+      jedis.set("foo", "bar"); // No exception
+    }
+  }
+
+  @Test
+  public void testSeparateClientRequests() {
+    setupCacheWithPassword();
+    try (Jedis authorizedJedis = new Jedis(hostName, Integer.parseInt(redisPort), 100000);
+         Jedis nonAuthorizedJedis = new Jedis(hostName, Integer.parseInt(redisPort), 100000)) {
+      String res = authorizedJedis.auth(PASSWORD);
+      assertEquals(res, "OK");
+      authorizedJedis.set("foo", "bar"); // No exception for authorized client
+
+      authorizedJedis.auth(PASSWORD);
+      Exception ex = null;
+      try {
+        nonAuthorizedJedis.set("foo", "bar");
+      } catch (JedisDataException e) {
+        ex = e;
+      }
+      assertNotNull(ex);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java b/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java
new file mode 100644
index 0000000..7ada70c
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.experimental.categories.Category;
+
+//TODO I think this test can now be removed
+@Category(IntegrationTest.class)
+public class ConcurrentStartTest extends RedisTestBase {
+
+//  private Cache cache;
+//  private int numServers = 10;
+//
+//  @Rule
+//  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+//
+//  @Before
+//  public void setUp() {
+//    System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY,
+//        getClass().getSimpleName() + ".properties");
+//  }
+//
+//  @After
+//  public void tearDown() {
+//    if (this.cache != null) {
+//      this.cache.close();
+//      this.cache = null;
+//    }
+//  }
+//
+//  @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, "");
+//    this.cache = cf.create();
+//
+//    runNServers(numServers);
+//  }
+//
+//  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() {
+//          GeodeRedisServiceImpl s = new GeodeRedisServiceImpl(ports[j]);
+//          s.start();
+//          s.stop();
+//        }
+//      };
+//
+//      Thread t = new Thread(r);
+//      t.setDaemon(true);
+//      t.start();
+//      threads[i] = t;
+//    }
+//    for (Thread t : threads)
+//      t.join();
+//    this.cache = GemFireCacheImpl.getInstance();
+//    assertFalse(this.cache.isClosed());
+//  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/HashesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/HashesJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/HashesJUnitTest.java
new file mode 100644
index 0000000..f8fad9e
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/HashesJUnitTest.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.test.junit.categories.FlakyTest;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import redis.clients.jedis.Jedis;
+
+@Category(IntegrationTest.class)
+public class HashesJUnitTest extends RedisTestBase {
+
+  @Test
+  public void testHMSetHSetHLen() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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));
+    }
+  }
+
+  @Category(FlakyTest.class) // GEODE-1942
+  @Test
+  public void testHIncrBy() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/ListsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/ListsJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/ListsJUnitTest.java
new file mode 100644
index 0000000..484224f
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/ListsJUnitTest.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+import redis.clients.jedis.Jedis;
+
+@Category(IntegrationTest.class)
+public class ListsJUnitTest extends RedisTestBase {
+  @Test
+  public void testLindex() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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);
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java
new file mode 100644
index 0000000..f76b4f8
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.test.dunit.AsyncInvocation;
+import org.apache.geode.test.dunit.DistributedTestUtils;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.IgnoredException;
+import org.apache.geode.test.dunit.LogWriterUtils;
+import org.apache.geode.test.dunit.SerializableCallable;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Random;
+import redis.clients.jedis.Jedis;
+
+@Category(DistributedTest.class)
+public class RedisDistDUnitTest extends JUnit4DistributedTestCase {
+
+  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 String localHost;
+
+  private static final int JEDIS_TIMEOUT = 20 * 1000;
+
+  private abstract class ClientTestBase extends SerializableCallable {
+
+    int port;
+
+    protected ClientTestBase(int port) {
+      this.port = port;
+    }
+  }
+
+  @Override
+  public final void postSetUp() throws Exception {
+    disconnectAllFromDS();
+
+    localHost = SocketCreator.getLocalHost().getHostName();
+
+    host = Host.getHost(0);
+    server1 = host.getVM(0);
+    server2 = host.getVM(1);
+    client1 = host.getVM(2);
+    client2 = host.getVM(3);
+    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+    final int locatorPort = DistributedTestUtils.getDUnitLocatorPort();
+    final SerializableCallable<Object> startRedisAdapter = new SerializableCallable<Object>() {
+
+      @Override
+      public Object call() throws Exception {
+        int port = ports[VM.getCurrentVMNum()];
+        CacheFactory cF = new CacheFactory();
+        String locator = SocketCreator.getLocalHost().getHostName() + "[" + locatorPort + "]";
+        cF.set(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
+        cF.set(ConfigurationProperties.REDIS_BIND_ADDRESS, localHost);
+        cF.set(ConfigurationProperties.REDIS_PORT, "" + port);
+        cF.set(MCAST_PORT, "0");
+        cF.set(LOCATORS, locator);
+        cF.create();
+        return Integer.valueOf(port);
+      }
+    };
+    AsyncInvocation i = server1.invokeAsync(startRedisAdapter);
+    server2Port = (Integer) server2.invoke(startRedisAdapter);
+    server1Port = (Integer) i.getResult();
+  }
+
+  @Override
+  public final void preTearDown() throws Exception {
+    disconnectAllFromDS();
+  }
+
+  @Category(FlakyTest.class) // GEODE-1092: random ports, failure stack involves TCPTransport
+                             // ConnectionHandler (are we eating BindExceptions somewhere?), uses
+                             // Random, async actions
+  @Test
+  public void testConcListOps() throws Exception {
+    final Jedis jedis1 = new Jedis(localHost, server1Port, JEDIS_TIMEOUT);
+    final Jedis jedis2 = new Jedis(localHost, server2Port, JEDIS_TIMEOUT);
+    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, JEDIS_TIMEOUT);
+        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);
+  }
+
+  @Category(FlakyTest.class) // GEODE-717: random ports, BindException in failure stack, async
+                             // actions
+  @Test
+  public void testConcCreateDestroy() throws Exception {
+    IgnoredException.addIgnoredException("RegionDestroyedException");
+    IgnoredException.addIgnoredException("IndexInvalidException");
+    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, JEDIS_TIMEOUT);
+        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
+   */
+  @Category(FlakyTest.class) // GEODE-1697
+  @Test
+  public void testConcOps() throws Exception {
+
+    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, JEDIS_TIMEOUT);
+        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/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/RedisServerTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/RedisServerTest.java b/geode-redis/src/test/java/org/apache/geode/redis/RedisServerTest.java
new file mode 100644
index 0000000..b8387e1
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/RedisServerTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.Region;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+
+
+@Category(IntegrationTest.class)
+public class RedisServerTest extends RedisTestBase {
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+  @Test
+  public void initializeRedisCreatesThreeRegions() {
+    Assert.assertEquals(2, cache.rootRegions().size());
+    Assert.assertTrue(cache.getRegion(GeodeRedisServiceImpl.REDIS_META_DATA_REGION) != null);
+  }
+
+  @Test
+  public void initializeRedisCreatesPartitionedRegionByDefault() {
+    Region redisStringRegion = cache.getRegion(GeodeRedisServiceImpl.STRING_REGION);
+    Assert.assertEquals(DataPolicy.PARTITION, redisStringRegion.getAttributes().getDataPolicy());
+  }
+
+  @Test
+  public void initializeRedisCreatesRegionsUsingSystemProperty() {
+    shutdownCache();
+    System.setProperty("gemfireredis.regiontype", "REPLICATE");
+    cache = (GemFireCacheImpl) createCacheInstance(getDefaultRedisCacheProperties());
+    Region redisStringRegion = cache.getRegion(GeodeRedisServiceImpl.STRING_REGION);
+    Assert.assertEquals(DataPolicy.REPLICATE, redisStringRegion.getAttributes().getDataPolicy());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java b/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java
new file mode 100644
index 0000000..b111fbc
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/RedisTestBase.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geode.redis;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.net.SocketCreator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.io.IOException;
+import java.util.Properties;
+import java.util.Random;
+import redis.clients.jedis.Jedis;
+
+public class RedisTestBase {
+  //  protected Jedis jedis;
+  protected GemFireCacheImpl cache;
+  protected static String redisPort;
+  protected Random rand;
+  protected String hostName;
+
+  @BeforeClass
+  public static void setupBeforeClass() {
+    redisPort = String.valueOf(AvailablePortHelper.getRandomAvailableTCPPort());
+  }
+
+  protected Jedis defaultJedisInstance() {
+    return new Jedis(hostName, Integer.parseInt(redisPort), 100000);
+  }
+
+  @Before
+  public void setUp() throws IOException {
+    hostName = SocketCreator.getLocalHost().getHostName();
+    cache = (GemFireCacheImpl) createCacheInstance(getDefaultRedisCacheProperties());
+    rand = new Random(System.nanoTime());
+  }
+
+  protected Properties getDefaultRedisCacheProperties() {
+    Properties properties = new Properties();
+    properties.setProperty(LOG_LEVEL, "config");
+    properties.setProperty(MCAST_PORT, "0");
+    properties.setProperty(LOCATORS, "");
+    properties.setProperty(REDIS_PORT, redisPort);
+    return properties;
+  }
+
+  protected Cache createCacheInstance(Properties properties) {
+    CacheFactory cacheFactory = new CacheFactory(properties);
+    return cacheFactory.create();
+  }
+
+  @After
+  public void tearDown() throws InterruptedException {
+//    if (jedis != null) {
+//      jedis.flushAll();
+//      jedis.shutdown();
+//    }
+//    GeodeRedisService service = cache.getService(GeodeRedisService.class);
+//    service.stop();
+    if (cache != null) {
+      cache.close();
+    }
+  }
+
+  protected 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()));
+  }
+
+  protected void shutdownCache() {
+    if (cache != null) {
+      cache.close();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
new file mode 100644
index 0000000..d979947
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+import redis.clients.jedis.Jedis;
+
+@Category(IntegrationTest.class)
+public class SetsJUnitTest extends RedisTestBase {
+
+  @Test
+  public void testSAddScard() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int numSets = 3;
+      int elements = 10;
+      String[] keys = new String[numSets];
+      ArrayList<Set<String>> sets = new ArrayList<Set<String>>();
+      populateListRandomData(numSets, elements, keys, sets);
+
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int numSets = 3;
+      int elements = 10;
+      String[] keys = new String[numSets];
+      ArrayList<Set<String>> sets = new ArrayList<Set<String>>();
+      populateListRandomData(numSets, elements, keys, sets);
+
+      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() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int numSets = 3;
+      int elements = 10;
+      String[] keys = new String[numSets];
+      ArrayList<Set<String>> sets = new ArrayList<Set<String>>();
+      populateListRandomData(numSets, elements, keys, sets);
+
+      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 void populateListRandomData(int numSets, int elements, String[] keys,
+                                      ArrayList<Set<String>> sets) {
+    for (int j = 0; j < numSets; j++) {
+      keys[j] = randString();
+      Set<String> newSet = new HashSet<>();
+      for (int i = 0; i < elements; i++) {
+        newSet.add(randString());
+      }
+      sets.add(newSet);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
new file mode 100644
index 0000000..9f07f00
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
@@ -0,0 +1,417 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.Tuple;
+
+@Category(IntegrationTest.class)
+public class SortedSetsJUnitTest extends RedisTestBase {
+
+  @Test
+  public void testZAddZRange() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int numMembers = 10;
+      String key = randString();
+      Map<String, Double> scoreMembers = new HashMap<String, Double>();
+
+      for (int i = 0; i < numMembers; i++) {
+        scoreMembers.put(randString(), rand.nextDouble());
+      }
+
+      jedis.zadd(key, scoreMembers);
+      int k = 0;
+      for (String entry : scoreMembers.keySet()) {
+        assertNotNull(jedis.zscore(key, entry));
+      }
+
+      Set<Tuple> results = jedis.zrangeWithScores(key, 0, -1);
+      Map<String, Double> resultMap = new HashMap<String, Double>();
+      for (Tuple t : results) {
+        resultMap.put(t.getElement(), t.getScore());
+      }
+
+      assertEquals(scoreMembers, resultMap);
+
+      for (int i = 0; i < 10; i++) {
+        int start;
+        int stop;
+        do {
+          start = rand.nextInt(numMembers);
+          stop = rand.nextInt(numMembers);
+        } while (start > stop);
+        results = jedis.zrangeWithScores(key, start, stop);
+        List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
+        for (Tuple t : results) {
+          resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
+        }
+        List<Entry<String, Double>> list =
+            new ArrayList<Entry<String, Double>>(scoreMembers.entrySet());
+        Collections.sort(list, new EntryCmp());
+        list = list.subList(start, stop + 1);
+        assertEquals(list, resultList);
+      }
+    }
+  }
+
+  @Test
+  public void testZRevRange() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int numMembers = 10;
+      String key = randString();
+
+      Map<String, Double> scoreMembers = new HashMap<String, Double>();
+
+      for (int i = 0; i < numMembers; i++) {
+        scoreMembers.put(randString(), rand.nextDouble());
+      }
+
+      jedis.zadd(key, scoreMembers);
+
+      Set<Tuple> results;
+
+      for (int i = 0; i < 10; i++) {
+        int start;
+        int stop;
+        do {
+          start = rand.nextInt(numMembers);
+          stop = rand.nextInt(numMembers);
+        } while (start > stop);
+        results = jedis.zrevrangeWithScores(key, start, stop);
+        List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
+        for (Tuple t : results) {
+          resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
+        }
+        List<Entry<String, Double>> list =
+            new ArrayList<Entry<String, Double>>(scoreMembers.entrySet());
+        Collections.sort(list, new EntryRevCmp());
+        list = list.subList(start, stop + 1);
+        assertEquals(list, resultList);
+      }
+    }
+  }
+
+  @Test
+  public void testZCount() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int num = 10;
+      int runs = 2;
+      for (int i = 0; i < runs; i++) {
+        Double min;
+        Double max;
+        do {
+          min = rand.nextDouble();
+          max = rand.nextDouble();
+        } while (min > max);
+
+        int count = 0;
+
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+
+        for (int j = 0; j < num; j++) {
+          Double nextDouble = rand.nextDouble();
+          if (nextDouble >= min && nextDouble <= max) {
+            count++;
+          }
+          scoreMembers.put(randString(), nextDouble);
+        }
+
+        jedis.zadd(key, scoreMembers);
+        Long countResult = jedis.zcount(key, min, max);
+        assertTrue(count == countResult);
+      }
+    }
+  }
+
+  @Test
+  public void testZIncrBy() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key = randString();
+      String member = randString();
+      Double score = 0.0;
+      for (int i = 0; i < 20; i++) {
+        Double incr = rand.nextDouble();
+        Double result = jedis.zincrby(key, incr, member);
+        score += incr;
+        assertEquals(score, result, 1.0 / 100000000.0);
+      }
+
+      jedis.zincrby(key, Double.MAX_VALUE, member);
+      Double infResult = jedis.zincrby(key, Double.MAX_VALUE, member);
+
+      assertEquals(infResult, Double.valueOf(Double.POSITIVE_INFINITY));
+    }
+  }
+
+  public void testZRangeByScore() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      Double min;
+      Double max;
+      for (int j = 0; j < 2; j++) {
+        do {
+          min = rand.nextDouble();
+          max = rand.nextDouble();
+        } while (min > max);
+        int numMembers = 500;
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+        List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
+        for (int i = 0; i < numMembers; i++) {
+          String s = randString();
+          Double d = rand.nextDouble();
+          scoreMembers.put(s, d);
+          if (d > min && d < max) {
+            expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+          }
+        }
+        jedis.zadd(key, scoreMembers);
+        Set<Tuple> results = jedis.zrangeByScoreWithScores(key, min, max);
+        List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
+        for (Tuple t : results) {
+          resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
+        }
+        Collections.sort(expected, new EntryCmp());
+
+        assertEquals(expected, resultList);
+        jedis.del(key);
+      }
+    }
+  }
+
+  public void testZRevRangeByScore() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      Double min;
+      Double max;
+      for (int j = 0; j < 2; j++) {
+        do {
+          min = rand.nextDouble();
+          max = rand.nextDouble();
+        } while (min > max);
+        int numMembers = 500;
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+        List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
+        for (int i = 0; i < numMembers; i++) {
+          String s = randString();
+          Double d = rand.nextDouble();
+          scoreMembers.put(s, d);
+          if (d > min && d < max) {
+            expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+          }
+        }
+        jedis.zadd(key, scoreMembers);
+        Set<Tuple> results = jedis.zrevrangeByScoreWithScores(key, max, min);
+        List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
+        for (Tuple t : results) {
+          resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
+        }
+        Collections.sort(expected, new EntryRevCmp());
+
+        assertEquals(expected, resultList);
+        jedis.del(key);
+      }
+    }
+  }
+
+  @Test
+  public void testZRemZScore() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      Double min;
+      Double max;
+      for (int j = 0; j < 2; j++) {
+        do {
+          min = rand.nextDouble();
+          max = rand.nextDouble();
+        } while (min > max);
+        int numMembers = 5000;
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+        List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
+        for (int i = 0; i < numMembers; i++) {
+          String s = randString();
+          Double d = rand.nextDouble();
+          scoreMembers.put(s, d);
+          if (d > min && d < max) {
+            expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+          }
+        }
+        jedis.zadd(key, scoreMembers);
+        Collections.sort(expected, new EntryCmp());
+        for (int i = expected.size(); i > 0; i--) {
+          Entry<String, Double> remEntry = expected.remove(i - 1);
+          String rem = remEntry.getKey();
+          Double val = remEntry.getValue();
+          assertEquals(val, jedis.zscore(key, rem));
+
+          assertTrue(jedis.zrem(key, rem) == 1);
+        }
+        String s = randString();
+        if (!expected.contains(s)) {
+          assertTrue(jedis.zrem(key, s) == 0);
+        }
+        jedis.del(key);
+      }
+    }
+  }
+
+  @Test
+  public void testZRank() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      for (int j = 0; j < 2; j++) {
+        int numMembers = 10;
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+        List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
+        for (int i = 0; i < numMembers; i++) {
+          String s = randString();
+          Double d = rand.nextDouble();
+          scoreMembers.put(s, d);
+          expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+        }
+        Collections.sort(expected, new EntryCmp());
+        jedis.zadd(key, scoreMembers);
+        for (int i = 0; i < expected.size(); i++) {
+          Entry<String, Double> en = expected.get(i);
+          String field = en.getKey();
+          Long rank = jedis.zrank(key, field);
+          assertEquals(new Long(i), rank);
+        }
+        String field = randString();
+        if (!expected.contains(field)) {
+          assertNull(jedis.zrank(key, field));
+        }
+        jedis.del(key);
+      }
+    }
+  }
+
+  @Test
+  public void testZRevRank() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      for (int j = 0; j < 2; j++) {
+        int numMembers = 10;
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+        List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
+        for (int i = 0; i < numMembers; i++) {
+          String s = randString();
+          Double d = rand.nextDouble();
+          scoreMembers.put(s, d);
+          expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+        }
+        Collections.sort(expected, new EntryRevCmp());
+        jedis.zadd(key, scoreMembers);
+        for (int i = 0; i < expected.size(); i++) {
+          Entry<String, Double> en = expected.get(i);
+          String field = en.getKey();
+          Long rank = jedis.zrevrank(key, field);
+          assertEquals(new Long(i), rank);
+        }
+        String field = randString();
+        if (!expected.contains(field)) {
+          assertNull(jedis.zrank(key, field));
+        }
+        jedis.del(key);
+      }
+    }
+  }
+
+  private class EntryCmp implements Comparator<Entry<String, Double>> {
+
+    @Override
+    public int compare(Entry<String, Double> o1, Entry<String, Double> o2) {
+      Double diff = o1.getValue() - o2.getValue();
+      if (diff == 0) {
+        return o2.getKey().compareTo(o1.getKey());
+      } else {
+        return diff > 0 ? 1 : -1;
+      }
+    }
+
+  }
+
+  private class EntryRevCmp implements Comparator<Entry<String, Double>> {
+
+    @Override
+    public int compare(Entry<String, Double> o1, Entry<String, Double> o2) {
+      Double diff = o2.getValue() - o1.getValue();
+      if (diff == 0) {
+        return o1.getKey().compareTo(o2.getKey());
+      } else {
+        return diff > 0 ? 1 : -1;
+      }
+    }
+
+  }
+
+  @Test
+  public void testZRemRangeByScore() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      Double min;
+      Double max;
+      for (int j = 0; j < 3; j++) {
+        do {
+          min = rand.nextDouble();
+          max = rand.nextDouble();
+        } while (min > max);
+        int numMembers = 10;
+        String key = randString();
+        Map<String, Double> scoreMembers = new HashMap<String, Double>();
+        List<Entry<String, Double>> fullList = new ArrayList<Entry<String, Double>>();
+        List<Entry<String, Double>> toRemoveList = new ArrayList<Entry<String, Double>>();
+        for (int i = 0; i < numMembers; i++) {
+          String s = randString();
+          Double d = rand.nextDouble();
+          scoreMembers.put(s, d);
+          fullList.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+          if (d > min && d < max) {
+            toRemoveList.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
+          }
+        }
+        jedis.zadd(key, scoreMembers);
+        Long numRemoved = jedis.zremrangeByScore(key, min, max);
+        List<Entry<String, Double>> expectedList = new ArrayList<Entry<String, Double>>(fullList);
+        expectedList.removeAll(toRemoveList);
+        Collections.sort(expectedList, new EntryCmp());
+        Set<Tuple> result = jedis.zrangeWithScores(key, 0, -1);
+        List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
+        for (Tuple t : result) {
+          resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
+        }
+        assertEquals(expectedList, resultList);
+        jedis.del(key);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/test/java/org/apache/geode/redis/StringsJunitTest.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/StringsJunitTest.java b/geode-redis/src/test/java/org/apache/geode/redis/StringsJunitTest.java
new file mode 100644
index 0000000..7465576
--- /dev/null
+++ b/geode-redis/src/test/java/org/apache/geode/redis/StringsJunitTest.java
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import redis.clients.jedis.Jedis;
+
+@Category(IntegrationTest.class)
+public class StringsJunitTest extends RedisTestBase {
+
+  @Test
+  public void testAppendAndStrlen() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key = randString();
+      int len = key.length();
+      String full = key;
+      jedis.set(key, key);
+      for (int i = 0; i < 15; i++) {
+        String rand = randString();
+        jedis.append(key, rand);
+        len += rand.length();
+        full += rand;
+      }
+      String ret = jedis.get(key);
+      assertTrue(ret.length() == len);
+      assertTrue(full.equals(ret));
+      assertTrue(full.length() == jedis.strlen(key));
+    }
+  }
+
+  @Test
+  public void testDecr() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key1 = randString();
+      String key2 = randString();
+      String key3 = randString();
+      int num1 = 100;
+      int num2 = -100;
+      jedis.set(key1, "" + num1);
+      // jedis.set(key3, "-100");
+      jedis.set(key2, "" + num2);
+
+      jedis.decr(key1);
+      jedis.decr(key3);
+      jedis.decr(key2);
+      assertTrue(jedis.get(key1).equals("" + (num1 - 1)));
+      assertTrue(jedis.get(key2).equals("" + (num2 - 1)));
+      assertTrue(jedis.get(key3).equals("" + (-1)));
+    }
+  }
+
+  @Test
+  public void testIncr() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key1 = randString();
+      String key2 = randString();
+      String key3 = randString();
+      int num1 = 100;
+      int num2 = -100;
+      jedis.set(key1, "" + num1);
+      // jedis.set(key3, "-100");
+      jedis.set(key2, "" + num2);
+
+      jedis.incr(key1);
+      jedis.incr(key3);
+      jedis.incr(key2);
+
+      assertTrue(jedis.get(key1).equals("" + (num1 + 1)));
+      assertTrue(jedis.get(key2).equals("" + (num2 + 1)));
+      assertTrue(jedis.get(key3).equals("" + (+1)));
+    }
+  }
+
+  @Test
+  public void testDecrBy() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key1 = randString();
+      String key2 = randString();
+      String key3 = randString();
+      int decr1 = rand.nextInt(100);
+      int decr2 = rand.nextInt(100);
+      Long decr3 = Long.MAX_VALUE / 2;
+      int num1 = 100;
+      int num2 = -100;
+      jedis.set(key1, "" + num1);
+      jedis.set(key2, "" + num2);
+      jedis.set(key3, "" + Long.MIN_VALUE);
+
+      jedis.decrBy(key1, decr1);
+      jedis.decrBy(key2, decr2);
+
+      assertTrue(jedis.get(key1).equals("" + (num1 - decr1 * 1)));
+      assertTrue(jedis.get(key2).equals("" + (num2 - decr2 * 1)));
+
+      Exception ex = null;
+      try {
+        jedis.decrBy(key3, decr3);
+      } catch (Exception e) {
+        ex = e;
+      }
+      assertNotNull(ex);
+    }
+  }
+
+  @Test
+  public void testIncrBy() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key1 = randString();
+      String key2 = randString();
+      String key3 = randString();
+      int incr1 = rand.nextInt(100);
+      int incr2 = rand.nextInt(100);
+      Long incr3 = Long.MAX_VALUE / 2;
+      int num1 = 100;
+      int num2 = -100;
+      jedis.set(key1, "" + num1);
+      jedis.set(key2, "" + num2);
+      jedis.set(key3, "" + Long.MAX_VALUE);
+
+      jedis.incrBy(key1, incr1);
+      jedis.incrBy(key2, incr2);
+      assertTrue(jedis.get(key1).equals("" + (num1 + incr1 * 1)));
+      assertTrue(jedis.get(key2).equals("" + (num2 + incr2 * 1)));
+
+      Exception ex = null;
+      try {
+        jedis.incrBy(key3, incr3);
+      } catch (Exception e) {
+        ex = e;
+      }
+      assertNotNull(ex);
+    }
+  }
+
+  @Test
+  public void testGetRange() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String sent = randString();
+      String contents = randString();
+      jedis.set(sent, contents);
+      for (int i = 0; i < sent.length(); i++) {
+        String range = jedis.getrange(sent, i, -1);
+        assertTrue(contents.substring(i).equals(range));
+      }
+      assertNull(jedis.getrange(sent, 2, 0));
+    }
+  }
+
+  @Test
+  public void testGetSet() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key = randString();
+      String contents = randString();
+      jedis.set(key, contents);
+      String newContents = randString();
+      String oldContents = jedis.getSet(key, newContents);
+      assertTrue(oldContents.equals(contents));
+      contents = newContents;
+    }
+  }
+
+  @Test
+  public void testMSetAndGet() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      int r = 5;
+      String[] keyvals = new String[(r * 2)];
+      String[] keys = new String[r];
+      String[] vals = new String[r];
+      for (int i = 0; i < r; i++) {
+        String key = randString();
+        String val = randString();
+        keyvals[2 * i] = key;
+        keyvals[2 * i + 1] = val;
+        keys[i] = key;
+        vals[i] = val;
+      }
+
+      jedis.mset(keyvals);
+
+      List<String> ret = jedis.mget(keys);
+      Object[] retArray = ret.toArray();
+
+      assertTrue(Arrays.equals(vals, retArray));
+    }
+  }
+
+  @Test
+  public void testMSetNX() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      Set<String> strings = new HashSet<String>();
+      for (int i = 0; i < 2 * 5; i++) {
+        strings.add(randString());
+      }
+      String[] array = strings.toArray(new String[0]);
+      long response = jedis.msetnx(array);
+
+      assertTrue(response == 1);
+
+      long response2 = jedis.msetnx(array[0], randString());
+
+      assertTrue(response2 == 0);
+      assertEquals(array[1], jedis.get(array[0]));
+    }
+  }
+
+  @Test
+  public void testSetNX() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      String key1 = randString();
+      String key2;
+      do {
+        key2 = randString();
+      } while (key2.equals(key1));
+
+      long response1 = jedis.setnx(key1, key1);
+      long response2 = jedis.setnx(key2, key2);
+      long response3 = jedis.setnx(key1, key2);
+
+      assertTrue(response1 == 1);
+      assertTrue(response2 == 1);
+      assertTrue(response3 == 0);
+    }
+  }
+
+  @Test
+  public void testPAndSetex() {
+    try (Jedis jedis = defaultJedisInstance()) {
+      Random r = new Random();
+      int setex = r.nextInt(5);
+      if (setex == 0) {
+        setex = 1;
+      }
+      String key = randString();
+      jedis.setex(key, setex, randString());
+      try {
+        Thread.sleep((setex + 5) * 1000);
+      } catch (InterruptedException e) {
+        return;
+      }
+      String result = jedis.get(key);
+      // System.out.println(result);
+      assertNull(result);
+
+      int psetex = r.nextInt(5000);
+      if (psetex == 0) {
+        psetex = 1;
+      }
+      key = randString();
+      jedis.psetex(key, psetex, randString());
+      long start = System.currentTimeMillis();
+      try {
+        Thread.sleep(psetex + 5000);
+      } catch (InterruptedException e) {
+        return;
+      }
+      long stop = System.currentTimeMillis();
+      result = jedis.get(key);
+      assertTrue(stop - start >= psetex);
+      assertNull(result);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index a0b291e..e019673 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -61,7 +61,7 @@ javax.persistence-api.version = 2.0.0
 javax.resource-api.version = 1.7
 javax.servlet-api.version = 3.1.0
 javax.transaction-api.version = 1.2
-jedis.version = 2.7.2
+jedis.version = 2.9.0
 jetty.version = 9.3.6.v20151106
 jgroups.version = 3.6.10.Final
 jline.version = 2.12
@@ -84,7 +84,7 @@ multithreadedtc.version = 1.01
 mx4j.version = 3.0.1
 mx4j-remote.version = 3.0.1
 mx4j-tools.version = 3.0.1
-netty-all.version = 4.0.4.Final
+netty-all.version = 4.1.8.Final
 open-json.version = 1.7
 paranamer.version = 2.3
 phantomjsdriver.version=1.2.1


[12/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java
deleted file mode 100755
index 7c9e808..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class MGetExecutor extends StringExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MGET));
-      return;
-    }
-
-    Collection<ByteArrayWrapper> keys = new ArrayList<ByteArrayWrapper>();
-    for (int i = 1; i < commandElems.size(); i++) {
-      byte[] keyArray = commandElems.get(i);
-      ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
-      /*
-       * try { checkDataType(key, RedisDataType.REDIS_STRING, context); } catch
-       * (RedisDataTypeMismatchException e) { keys.ad continue; }
-       */
-      keys.add(key);
-    }
-
-    Map<ByteArrayWrapper, ByteArrayWrapper> results = r.getAll(keys);
-
-    Collection<ByteArrayWrapper> values = new ArrayList<ByteArrayWrapper>();
-
-    /*
-     * This is done to preserve order in the output
-     */
-    for (ByteArrayWrapper key : keys)
-      values.add(results.get(key));
-
-    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), values));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java
deleted file mode 100755
index a98075b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
-import org.apache.geode.redis.internal.Coder;
-
-public class MSetExecutor extends StringExecutor {
-
-  private final String SUCCESS = "OK";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSET));
-      return;
-    }
-
-    Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
-    for (int i = 1; i < commandElems.size(); i += 2) {
-      byte[] keyArray = commandElems.get(i);
-      ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
-      try {
-        checkAndSetDataType(key, context);
-      } catch (RedisDataTypeMismatchException e) {
-        continue;
-      }
-      byte[] value = commandElems.get(i + 1);
-      map.put(key, new ByteArrayWrapper(value));
-    }
-    r.putAll(map);
-
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java
deleted file mode 100755
index 774886f..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
-import org.apache.geode.redis.internal.Coder;
-
-public class MSetNXExecutor extends StringExecutor {
-
-  private final int SET = 1;
-
-  private final int NOT_SET = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSETNX));
-      return;
-    }
-
-    boolean hasEntry = false;
-
-    Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
-    for (int i = 1; i < commandElems.size(); i += 2) {
-      byte[] keyArray = commandElems.get(i);
-      ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
-      try {
-        checkDataType(key, context);
-      } catch (RedisDataTypeMismatchException e) {
-        hasEntry = true;
-        break;
-      }
-      byte[] value = commandElems.get(i + 1);
-      map.put(key, new ByteArrayWrapper(value));
-      if (r.containsKey(key)) {
-        hasEntry = true;
-        break;
-      }
-    }
-    boolean successful = false;
-    if (!hasEntry) {
-      successful = true;
-      for (ByteArrayWrapper k : map.keySet()) {
-        try {
-          checkAndSetDataType(k, context);
-        } catch (RedisDataTypeMismatchException e) {
-          successful = false;
-          break;
-        }
-      }
-      r.putAll(map);
-    }
-    if (successful) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
-    } else {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java
deleted file mode 100755
index c8e6111..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class PSetEXExecutor extends SetEXExecutor {
-
-  @Override
-  public boolean timeUnitMillis() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.PSETEX;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
deleted file mode 100755
index 4fb38d1..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SetBitExecutor extends StringExecutor {
-
-  private final String ERROR_NOT_INT = "The number provided must be numeric";
-
-  private final String ERROR_VALUE = "The value is out of range, must be 0 or 1";
-
-  private final String ERROR_ILLEGAL_OFFSET =
-      "The offset is out of range, must be greater than or equal to 0  and at most 4294967295 (512MB)";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETBIT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper wrapper = r.get(key);
-
-    long offset;
-    int value;
-    int returnBit = 0;
-    try {
-      byte[] offAr = commandElems.get(2);
-      byte[] valAr = commandElems.get(3);
-      offset = Coder.bytesToLong(offAr);
-      value = Coder.bytesToInt(valAr);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-      return;
-    }
-
-    if (value != 0 && value != 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE));
-      return;
-    }
-
-    if (offset < 0 || offset > 4294967295L) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_OFFSET));
-      return;
-    }
-
-    int byteIndex = (int) (offset / 8);
-    offset %= 8;
-
-    if (wrapper == null) {
-      byte[] bytes = new byte[byteIndex + 1];
-      if (value == 1)
-        bytes[byteIndex] = (byte) (0x80 >> offset);
-      r.put(key, new ByteArrayWrapper(bytes));
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-    } else {
-
-      byte[] bytes = wrapper.toBytes();
-      if (byteIndex < bytes.length)
-        returnBit = (bytes[byteIndex] & (0x80 >> offset)) >> (7 - offset);
-      else
-        returnBit = 0;
-
-      if (byteIndex < bytes.length) {
-        bytes[byteIndex] = value == 1 ? (byte) (bytes[byteIndex] | (0x80 >> offset))
-            : (byte) (bytes[byteIndex] & ~(0x80 >> offset));
-        r.put(key, new ByteArrayWrapper(bytes));
-      } else {
-        byte[] newBytes = new byte[byteIndex + 1];
-        System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
-        newBytes[byteIndex] = value == 1 ? (byte) (newBytes[byteIndex] | (0x80 >> offset))
-            : (byte) (newBytes[byteIndex] & ~(0x80 >> offset));
-        r.put(key, new ByteArrayWrapper(newBytes));
-      }
-
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), returnBit));
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java
deleted file mode 100755
index b6eb12d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public class SetEXExecutor extends StringExecutor implements Extendable {
-
-  private final String ERROR_SECONDS_NOT_A_NUMBER =
-      "The expiration argument provided was not a number";
-
-  private final String ERROR_SECONDS_NOT_LEGAL = "The expiration argument must be greater than 0";
-
-  private final String SUCCESS = "OK";
-
-  private final int VALUE_INDEX = 3;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    byte[] value = commandElems.get(VALUE_INDEX);
-
-    byte[] expirationArray = commandElems.get(2);
-    long expiration;
-    try {
-      expiration = Coder.bytesToLong(expirationArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_A_NUMBER));
-      return;
-    }
-
-    if (expiration <= 0) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_LEGAL));
-      return;
-    }
-
-    if (!timeUnitMillis())
-      expiration *= AbstractExecutor.millisInSecond;
-
-    checkAndSetDataType(key, context);
-    r.put(key, new ByteArrayWrapper(value));
-
-    context.getRegionProvider().setExpiration(key, expiration);
-
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-
-  }
-
-  protected boolean timeUnitMillis() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SETEX;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
deleted file mode 100755
index e419ab1..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public class SetExecutor extends StringExecutor {
-
-  private final String SUCCESS = "OK";
-
-  private final int VALUE_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SET));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, context);
-    byte[] value = commandElems.get(VALUE_INDEX);
-    ByteArrayWrapper valueWrapper = new ByteArrayWrapper(value);
-
-    boolean NX = false; // Set only if not exists
-    boolean XX = false; // Set only if exists
-    long expiration = 0L;
-
-    if (commandElems.size() >= 6) {
-      String elem4;
-      String elem5;
-      String elem6;
-
-      elem4 = Coder.bytesToString(commandElems.get(3));
-      elem5 = Coder.bytesToString(commandElems.get(4));
-      elem6 = Coder.bytesToString(commandElems.get(5));
-
-      if (elem4.equalsIgnoreCase("XX") || elem6.equalsIgnoreCase("XX"))
-        XX = true;
-      else if (elem4.equalsIgnoreCase("NX") || elem6.equalsIgnoreCase("NX"))
-        NX = true;
-
-      if (elem4.equalsIgnoreCase("PX"))
-        expiration = getExpirationMillis(elem4, elem5);
-      else if (elem5.equalsIgnoreCase("PX"))
-        expiration = getExpirationMillis(elem5, elem6);
-      else if (elem4.equalsIgnoreCase("EX"))
-        expiration = getExpirationMillis(elem4, elem5);
-      else if (elem5.equalsIgnoreCase("EX"))
-        expiration = getExpirationMillis(elem5, elem6);
-
-    } else if (commandElems.size() >= 5) {
-      String elem4;
-      String expiry;
-
-      elem4 = Coder.bytesToString(commandElems.get(3));
-      expiry = Coder.bytesToString(commandElems.get(4));
-
-      expiration = getExpirationMillis(elem4, expiry);
-    } else if (commandElems.size() >= 4) {
-      byte[] elem4 = commandElems.get(3);
-      if (elem4.length == 2 && Character.toUpperCase(elem4[1]) == 'X') {
-        if (Character.toUpperCase(elem4[0]) == 'N')
-          NX = true;
-        else if (Character.toUpperCase(elem4[0]) == 'X')
-          XX = true;
-      }
-    }
-
-    boolean keyWasSet = false;
-
-    if (NX)
-      keyWasSet = setNX(r, command, key, valueWrapper, context);
-    else if (XX)
-      keyWasSet = setXX(r, command, key, valueWrapper, context);
-    else {
-      checkAndSetDataType(key, context);
-      r.put(key, valueWrapper);
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-      keyWasSet = true;
-    }
-
-    if (keyWasSet && expiration > 0L) {
-      context.getRegionProvider().setExpiration(key, expiration);
-    }
-
-  }
-
-  private boolean setNX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command,
-      ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) {
-    checkAndSetDataType(key, context);
-    Object oldValue = r.putIfAbsent(key, valueWrapper);
-    if (oldValue != null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return false;
-    } else {
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-      return true;
-    }
-  }
-
-  private boolean setXX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command,
-      ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) {
-    if (r.containsKey(key)) {
-      checkAndSetDataType(key, context);
-      r.put(key, valueWrapper);
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-      return true;
-    } else {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return false;
-    }
-  }
-
-  private long getExpirationMillis(String expx, String expirationString) {
-    long expiration = 0L;
-    try {
-      expiration = Long.parseLong(expirationString);
-    } catch (NumberFormatException e) {
-      return 0L;
-    }
-
-    if (expx.equalsIgnoreCase("EX"))
-      return expiration * AbstractExecutor.millisInSecond;
-    else if (expx.equalsIgnoreCase("PX"))
-      return expiration;
-    else
-      return 0L;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
deleted file mode 100755
index 3b2d6f8..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SetNXExecutor extends StringExecutor {
-
-  private final int SET = 1;
-
-  private final int NOT_SET = 0;
-
-  private final int VALUE_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETNX));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    byte[] value = commandElems.get(VALUE_INDEX);
-
-    Object oldValue = r.putIfAbsent(key, new ByteArrayWrapper(value));
-
-    if (oldValue != null)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java
deleted file mode 100755
index 215aacb..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SetRangeExecutor extends StringExecutor {
-
-  private final String ERROR_NOT_INT = "The number provided must be numeric";
-
-  private final String ERROR_ILLEGAL_OFFSET =
-      "The offset is out of range, must be greater than or equal to 0 and the offset added to the length of the value must be less than 536870911 (512MB), the maximum allowed size";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETRANGE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper wrapper = r.get(key);
-
-    int offset;
-    byte[] value = commandElems.get(3);
-    try {
-      byte[] offAr = commandElems.get(2);
-      offset = Coder.bytesToInt(offAr);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-      return;
-    }
-
-    int totalLength = offset + value.length;
-    if (offset < 0 || totalLength > 536870911) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_OFFSET));
-      return;
-    } else if (value.length == 0) {
-      int length = wrapper == null ? 0 : wrapper.toBytes().length;
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), length));
-      if (wrapper == null)
-        context.getRegionProvider().removeKey(key);
-      return;
-    }
-
-    if (wrapper == null) {
-      byte[] bytes = new byte[totalLength];
-      System.arraycopy(value, 0, bytes, offset, value.length);
-      r.put(key, new ByteArrayWrapper(bytes));
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bytes.length));
-    } else {
-
-      byte[] bytes = wrapper.toBytes();
-      int returnLength;
-      if (totalLength < bytes.length) {
-        System.arraycopy(value, 0, bytes, offset, value.length);
-        r.put(key, new ByteArrayWrapper(bytes));
-        returnLength = bytes.length;
-      } else {
-        byte[] newBytes = new byte[totalLength];
-        System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
-        System.arraycopy(value, 0, newBytes, offset, value.length);
-        returnLength = newBytes.length;
-        r.put(key, new ByteArrayWrapper(newBytes));
-      }
-
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), returnLength));
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java
deleted file mode 100755
index fb91f09..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class StringExecutor extends AbstractExecutor {
-
-  protected final void checkAndSetDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
-    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)
-      throw new RedisDataTypeMismatchException(
-          "The key name \"" + key + "\" is already used by a " + oldVal.toString());
-  }
-
-  protected void checkDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
-    RedisDataType currentType = context.getRegionProvider().getRedisDataType(key);
-    if (currentType == null)
-      return;
-    if (currentType == RedisDataType.REDIS_PROTECTED)
-      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
-    if (currentType != RedisDataType.REDIS_STRING)
-      throw new RedisDataTypeMismatchException(
-          "The key name \"" + key + "\" is already used by a " + currentType.toString());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java
deleted file mode 100755
index 8d35279..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class StrlenExecutor extends StringExecutor {
-
-  private final int KEY_DOES_NOT_EXIST = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.STRLEN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_STRING, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-
-    if (valueWrapper == null)
-      command
-          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), KEY_DOES_NOT_EXIST));
-    else
-      command.setResponse(
-          Coder.getIntegerResponse(context.getByteBufAllocator(), valueWrapper.toBytes().length));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java
deleted file mode 100755
index 0743076..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.transactions;
-
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.TransactionId;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-
-public class DiscardExecutor extends TransactionExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-
-    CacheTransactionManager txm = context.getCacheTransactionManager();
-
-    if (context.hasTransaction()) {
-      TransactionId transactionId = context.getTransactionID();
-      txm.resume(transactionId);
-      txm.rollback();
-      context.clearTransaction();
-    }
-
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java
deleted file mode 100755
index 632a79d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.transactions;
-
-import io.netty.buffer.ByteBuf;
-
-import java.util.Queue;
-
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.CommitConflictException;
-import org.apache.geode.cache.TransactionId;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-
-public class ExecExecutor extends TransactionExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-
-    CacheTransactionManager txm = context.getCacheTransactionManager();
-
-    if (!context.hasTransaction()) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    TransactionId transactionId = context.getTransactionID();
-
-    txm.resume(transactionId);
-
-    boolean hasError = hasError(context.getTransactionQueue());
-
-    if (hasError)
-      txm.rollback();
-    else {
-      try {
-        txm.commit();
-      } catch (CommitConflictException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
-            RedisConstants.ERROR_COMMIT_CONFLICT));
-        context.clearTransaction();
-        return;
-      }
-    }
-
-    ByteBuf response = constructResponseExec(context);
-    command.setResponse(response);
-
-    context.clearTransaction();
-  }
-
-  private ByteBuf constructResponseExec(ExecutionHandlerContext context) {
-    Queue<Command> cQ = context.getTransactionQueue();
-    ByteBuf response = context.getByteBufAllocator().buffer();
-    response.writeByte(Coder.ARRAY_ID);
-    response.writeBytes(Coder.intToBytes(cQ.size()));
-    response.writeBytes(Coder.CRLFar);
-
-    for (Command c : cQ) {
-      ByteBuf r = c.getResponse();
-      response.writeBytes(r);
-    }
-    return response;
-  }
-
-  private boolean hasError(Queue<Command> queue) {
-    for (Command c : queue) {
-      if (c.hasError())
-        return true;
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java
deleted file mode 100755
index d269d93..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.transactions;
-
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.TransactionId;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-
-public class MultiExecutor extends TransactionExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-
-    CacheTransactionManager txm = context.getCacheTransactionManager();
-
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-
-    if (context.hasTransaction()) {
-      throw new IllegalStateException(RedisConstants.ERROR_NESTED_MULTI);
-    }
-
-    txm.begin();
-
-    TransactionId id = txm.suspend();
-
-    context.setTransactionID(id);
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java
deleted file mode 100755
index 27ade8f..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.transactions;
-
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class TransactionExecutor extends AbstractExecutor {
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java
deleted file mode 100755
index 3de173e..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.transactions;
-
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-
-public class UnwatchExecutor extends TransactionExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    command.setResponse(
-        Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_UNWATCH));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java
deleted file mode 100755
index ff6865d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.transactions;
-
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-
-public class WatchExecutor extends TransactionExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    command.setResponse(
-        Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_WATCH));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java b/geode-core/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java
deleted file mode 100644
index b0190f6..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/org/apache/hadoop/fs/GlobPattern.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.redis.internal.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);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/AuthJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/AuthJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/AuthJUnitTest.java
deleted file mode 100644
index e3ebcf7..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/AuthJUnitTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.exceptions.JedisDataException;
-
-import java.io.IOException;
-import java.util.Random;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class AuthJUnitTest {
-
-  private static final String PASSWORD = "pwd";
-  Jedis jedis;
-  GeodeRedisServer server;
-  GemFireCache cache;
-  Random rand;
-  int port;
-
-  int runs = 150;
-
-  @Before
-  public void setUp() throws IOException {
-    rand = new Random();
-    port = AvailablePortHelper.getRandomAvailableTCPPort();
-    this.jedis = new Jedis("localhost", port, 100000);
-  }
-
-  @After
-  public void tearDown() throws InterruptedException {
-    server.shutdown();
-    cache.close();
-  }
-
-  private void setupCacheWithPassword() {
-    CacheFactory cf = new CacheFactory();
-    cf.set(LOG_LEVEL, "error");
-    cf.set(MCAST_PORT, "0");
-    cf.set(LOCATORS, "");
-    cf.set(ConfigurationProperties.REDIS_PASSWORD, PASSWORD);
-    cache = cf.create();
-    server = new GeodeRedisServer("localhost", port);
-    server.start();
-  }
-
-  @Test
-  public void testAuthConfig() {
-    setupCacheWithPassword();
-    InternalDistributedSystem iD = (InternalDistributedSystem) cache.getDistributedSystem();
-    assert (iD.getConfig().getRedisPassword().equals(PASSWORD));
-  }
-
-  @Test
-  public void testAuthRejectAccept() {
-    setupCacheWithPassword();
-    Exception ex = null;
-    try {
-      jedis.auth("wrongpwd");
-    } catch (JedisDataException e) {
-      ex = e;
-    }
-    assertNotNull(ex);
-
-    String res = jedis.auth(PASSWORD);
-    assertEquals(res, "OK");
-  }
-
-  @Test
-  public void testAuthNoPwd() {
-    CacheFactory cf = new CacheFactory();
-    cf.set(LOG_LEVEL, "error");
-    cf.set(MCAST_PORT, "0");
-    cf.set(LOCATORS, "");
-    cache = cf.create();
-    server = new GeodeRedisServer("localhost", port);
-    server.start();
-
-    Exception ex = null;
-    try {
-      jedis.auth(PASSWORD);
-    } catch (JedisDataException e) {
-      ex = e;
-    }
-    assertNotNull(ex);
-  }
-
-  @Test
-  public void testAuthAcceptRequests() {
-    setupCacheWithPassword();
-    Exception ex = null;
-    try {
-      jedis.set("foo", "bar");
-    } catch (JedisDataException e) {
-      ex = e;
-    }
-    assertNotNull(ex);
-
-    String res = jedis.auth(PASSWORD);
-    assertEquals(res, "OK");
-
-    jedis.set("foo", "bar"); // No exception
-  }
-
-  @Test
-  public void testSeparateClientRequests() {
-    setupCacheWithPassword();
-    Jedis authorizedJedis = null;
-    Jedis nonAuthorizedJedis = null;
-    try {
-      authorizedJedis = new Jedis("localhost", port, 100000);
-      nonAuthorizedJedis = new Jedis("localhost", port, 100000);
-      String res = authorizedJedis.auth(PASSWORD);
-      assertEquals(res, "OK");
-      authorizedJedis.set("foo", "bar"); // No exception for authorized client
-
-      authorizedJedis.auth(PASSWORD);
-      Exception ex = null;
-      try {
-        nonAuthorizedJedis.set("foo", "bar");
-      } catch (JedisDataException e) {
-        ex = e;
-      }
-      assertNotNull(ex);
-    } finally {
-      if (authorizedJedis != null)
-        authorizedJedis.close();
-      if (nonAuthorizedJedis != null)
-        nonAuthorizedJedis.close();
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java b/geode-core/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java
deleted file mode 100644
index 759ee35..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/ConcurrentStartTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.assertFalse;
-
-@Category(IntegrationTest.class)
-public class ConcurrentStartTest {
-
-  private Cache cache;
-  private int numServers = 10;
-
-  @Rule
-  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
-  @Before
-  public void setUp() {
-    System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY,
-        getClass().getSimpleName() + ".properties");
-  }
-
-  @After
-  public void tearDown() {
-    if (this.cache != null) {
-      this.cache.close();
-      this.cache = null;
-    }
-  }
-
-  @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, "");
-    this.cache = cf.create();
-
-    runNServers(numServers);
-  }
-
-  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() {
-          GeodeRedisServer s = new GeodeRedisServer(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();
-    this.cache = GemFireCacheImpl.getInstance();
-    assertFalse(this.cache.isClosed());
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/HashesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/HashesJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/HashesJUnitTest.java
deleted file mode 100755
index 5a8ce35..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/HashesJUnitTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
-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 java.io.IOException;
-import java.util.*;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class HashesJUnitTest {
-  private static Jedis jedis;
-  private static GeodeRedisServer 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 GeodeRedisServer("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));
-  }
-
-  @Category(FlakyTest.class) // GEODE-1942
-  @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/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/ListsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/ListsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/ListsJUnitTest.java
deleted file mode 100755
index c8e8d0c..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/ListsJUnitTest.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
-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 java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class ListsJUnitTest {
-
-  private static Jedis jedis;
-  private static GeodeRedisServer 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 GeodeRedisServer("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();
-  }
-}


[13/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java
deleted file mode 100755
index 4bc3554..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByLexExecutor.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRemRangeByLexExecutor extends SortedSetExecutor {
-
-  private final int ERROR_NOT_EXISTS = 0;
-
-  private final String ERROR_ILLEGAL_SYNTAX =
-      "The min and max strings must either start with a (, [ or be - or +";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREMRANGEBYLEX));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command
-          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), ERROR_NOT_EXISTS));
-      return;
-    }
-
-    boolean minInclusive = false;
-    boolean maxInclusive = false;
-
-    byte[] minArray = commandElems.get(2);
-    byte[] maxArray = commandElems.get(3);
-    String startString = Coder.bytesToString(minArray);
-    String stopString = Coder.bytesToString(maxArray);
-
-    if (minArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      minInclusive = false;
-    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
-      startString = startString.substring(1);
-      minInclusive = true;
-    } else if (minArray[0] != Coder.HYPHEN_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = false;
-    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = true;
-    } else if (maxArray[0] != Coder.PLUS_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-    Collection<ByteArrayWrapper> removeList;
-    try {
-      removeList = getRange(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
-          Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    int numRemoved = 0;
-
-    for (ByteArrayWrapper entry : removeList) {
-      Object oldVal = keyRegion.remove(entry);
-      if (oldVal != null)
-        numRemoved++;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-
-  private Collection<ByteArrayWrapper> getRange(ByteArrayWrapper key,
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
-      ByteArrayWrapper start, ByteArrayWrapper stop, boolean startInclusive, boolean stopInclusive)
-      throws Exception {
-    if (start.equals("-") && stop.equals("+"))
-      return new ArrayList<ByteArrayWrapper>(keyRegion.keySet());
-    else if (start.equals("+") || stop.equals("-"))
-      return null;
-
-    Query query;
-    Object[] params;
-    if (start.equals("-")) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINF, context);
-      }
-      params = new Object[] {stop, INFINITY_LIMIT};
-    } else if (stop.equals("+")) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINF, context);
-      }
-      params = new Object[] {start, INFINITY_LIMIT};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEX, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    }
-
-    @SuppressWarnings("unchecked")
-    SelectResults<ByteArrayWrapper> results =
-        (SelectResults<ByteArrayWrapper>) query.execute(params);
-
-    return results.asList();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java
deleted file mode 100755
index 668a0e4..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByRankExecutor.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.Region.Entry;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRemRangeByRankExecutor extends SortedSetExecutor {
-
-  private final int NONE_REMOVED = 0;
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREMRANGEBYRANK));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NONE_REMOVED));
-      return;
-    }
-
-    int startRank;
-    int stopRank;
-
-    try {
-      startRank = Coder.bytesToInt(commandElems.get(2));
-      stopRank = Coder.bytesToInt(commandElems.get(3));
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    int sSetSize = keyRegion.size();
-
-    startRank = getBoundedStartIndex(startRank, sSetSize);
-    stopRank = getBoundedEndIndex(stopRank, sSetSize);
-    if (stopRank > sSetSize - 1)
-      stopRank = sSetSize - 1;
-
-    if (startRank > stopRank) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    int numRemoved = 0;
-    List<?> removeList = null;
-    try {
-      if (startRank == 0 && stopRank == sSetSize - 1) {
-        numRemoved = keyRegion.size();
-        context.getRegionProvider().removeKey(key);
-      } else {
-        removeList = getRemoveKeys(context, key, startRank, stopRank);
-      }
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    if (removeList != null) {
-      for (Object entry : removeList) {
-        ByteArrayWrapper removeKey;
-        if (entry instanceof Entry)
-          removeKey = (ByteArrayWrapper) ((Entry<?, ?>) entry).getKey();
-        else
-          removeKey = (ByteArrayWrapper) ((Struct) entry).getFieldValues()[0];
-        Object oldVal = keyRegion.remove(removeKey);
-        if (oldVal != null)
-          numRemoved++;
-      }
-      if (keyRegion.isEmpty())
-        context.getRegionProvider().removeKey(key);
-    }
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-
-  private List<?> getRemoveKeys(ExecutionHandlerContext context, ByteArrayWrapper key,
-      int startRank, int stopRank) throws Exception {
-    Query query = getQuery(key, SortedSetQuery.ZREMRANGEBYRANK, context);
-    Object[] params = {stopRank + 1};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return results.asList().subList(startRank, stopRank + 1);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java
deleted file mode 100755
index 2afd64d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemRangeByScoreExecutor.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRemRangeByScoreExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREMRANGEBYSCORE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    boolean startInclusive = true;
-    boolean stopInclusive = true;
-    double start;
-    double stop;
-
-    byte[] startArray = commandElems.get(2);
-    byte[] stopArray = commandElems.get(3);
-    String startString = Coder.bytesToString(startArray);
-    String stopString = Coder.bytesToString(stopArray);
-    if (startArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      startInclusive = false;
-    }
-    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      stopInclusive = false;
-    }
-
-    try {
-      start = Coder.stringToDouble(startString);
-      stop = Coder.stringToDouble(stopString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    int numRemoved = 0;
-
-    Collection<?> removeList = null;
-    try {
-      if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY && startInclusive
-          && stopInclusive) {
-        numRemoved = keyRegion.size();
-        context.getRegionProvider().removeKey(key);
-      } else {
-        removeList = getKeys(context, key, keyRegion, start, stop, startInclusive, stopInclusive);
-      }
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    if (removeList != null) {
-      for (Object entry : removeList) {
-        ByteArrayWrapper remove = null;
-        if (entry instanceof Entry)
-          remove = (ByteArrayWrapper) ((Entry<?, ?>) entry).getKey();
-        else if (entry instanceof Struct)
-          remove = (ByteArrayWrapper) ((Struct) entry).getFieldValues()[0];
-        Object oldVal = keyRegion.remove(remove);
-        if (oldVal != null)
-          numRemoved++;
-        if (keyRegion.isEmpty())
-          context.getRegionProvider().removeKey(key);
-      }
-    }
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-
-  private Collection<?> getKeys(ExecutionHandlerContext context, ByteArrayWrapper key,
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, double start, double stop,
-      boolean startInclusive, boolean stopInclusive) throws Exception {
-    if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY || (start > stop))
-      return null;
-
-    Query query;
-    Object[] params;
-    if (startInclusive) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRBSSTISI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRBSSTI, context);
-      }
-    } else {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRBSSI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRBS, context);
-      }
-    }
-    params = new Object[] {start, stop, INFINITY_LIMIT};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Collection<?>) results.asList();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java
deleted file mode 100755
index 652e784..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeByScoreExecutor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class ZRevRangeByScoreExecutor extends ZRangeByScoreExecutor {
-
-  @Override
-  protected boolean isReverse() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZREVRANGEBYSCORE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java
deleted file mode 100755
index 8154570..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRangeExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class ZRevRangeExecutor extends ZRangeExecutor {
-
-  @Override
-  protected boolean isReverse() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZREVRANGE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java
deleted file mode 100755
index 80ebfa4..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRevRankExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZRevRankExecutor extends ZRankExecutor {
-
-  @Override
-  protected boolean isReverse() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZREVRANK;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java
deleted file mode 100755
index df0ea44..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScanExecutor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.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;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
-
-public class ZScanExecutor extends AbstractScanExecutor {
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZSCAN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    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>()));
-      return;
-    }
-    byte[] cAr = commandElems.get(2);
-    // String cursorString = ResponseToByteEncoder.bytesToString(cAr);
-
-    int cursor = 0;
-    Pattern matchPattern = null;
-    String globMatchPattern = null;
-    int count = DEFUALT_COUNT;
-    try {
-      cursor = Coder.bytesToInt(cAr);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-    if (cursor < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-
-    if (commandElems.size() > 4) {
-      try {
-        byte[] bytes = commandElems.get(3);
-        if (Coder.bytesToString(bytes).equalsIgnoreCase("MATCH")) {
-          bytes = commandElems.get(4);
-          globMatchPattern = Coder.bytesToString(bytes);
-        } else if (Coder.bytesToString(bytes).equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(4);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (commandElems.size() > 6) {
-      try {
-        byte[] bytes = commandElems.get(5);
-        if (Coder.bytesToString(bytes).equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(6);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (count < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-      return;
-    }
-
-    try {
-      matchPattern = convertGlobToRegex(globMatchPattern);
-    } catch (PatternSyntaxException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
-      return;
-    }
-
-    List<ByteArrayWrapper> returnList =
-        (List<ByteArrayWrapper>) getIteration(new HashSet(keyRegion.entrySet()), matchPattern,
-            count, cursor);
-
-    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
-    List<Object> returnList = new ArrayList<Object>();
-    int size = list.size();
-    int beforeCursor = 0;
-    int numElements = 0;
-    int i = -1;
-    for (Entry<ByteArrayWrapper, DoubleWrapper> entry : (Collection<Entry<ByteArrayWrapper, DoubleWrapper>>) list) {
-      ByteArrayWrapper keyWrapper = entry.getKey();
-      String key = keyWrapper.toString();
-
-      DoubleWrapper value = entry.getValue();
-      i++;
-      if (beforeCursor < cursor) {
-        beforeCursor++;
-        continue;
-      } else if (numElements < count) {
-        if (matchPattern != null) {
-          if (matchPattern.matcher(key).matches()) {
-            returnList.add(keyWrapper);
-            returnList.add(value.toString());
-            numElements++;
-          }
-        } else {
-          returnList.add(keyWrapper);
-          returnList.add(value.toString());
-          numElements++;
-        }
-      } else
-        break;
-    }
-
-    if (i == size - 1)
-      returnList.add(0, String.valueOf(0));
-    else
-      returnList.add(0, String.valueOf(i));
-    return returnList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java
deleted file mode 100755
index 158adb3..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZScoreExecutor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class ZScoreExecutor extends SortedSetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZSCORE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-    DoubleWrapper score = keyRegion.get(member);
-    if (score == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-    command
-        .setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), score.toString()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java
deleted file mode 100755
index 7c8c375..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/AppendExecutor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class AppendExecutor extends StringExecutor {
-
-  private final int VALUE_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();;
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.APPEND));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper string = r.get(key);
-
-    byte[] stringByteArray = commandElems.get(VALUE_INDEX);
-    if (string == null) {
-      r.put(key, new ByteArrayWrapper(stringByteArray));
-      command.setResponse(
-          Coder.getIntegerResponse(context.getByteBufAllocator(), stringByteArray.length));
-    } else {
-      byte[] newValue = concatArrays(string.toBytes(), stringByteArray);
-      string.setBytes(newValue);
-      r.put(key, string);
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), newValue.length));
-    }
-
-  }
-
-  private byte[] concatArrays(byte[] o, byte[] n) {
-    int oLen = o.length;
-    int nLen = n.length;
-    byte[] combined = new byte[oLen + nLen];
-    System.arraycopy(o, 0, combined, 0, oLen);
-    System.arraycopy(n, 0, combined, oLen, nLen);
-    return combined;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java
deleted file mode 100755
index 68fc357..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitCountExecutor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class BitCountExecutor extends StringExecutor {
-
-  private final String ERROR_NOT_INT = "The indexes provided must be numeric values";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() != 2 && commandElems.size() != 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITCOUNT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper wrapper = r.get(key);
-    if (wrapper == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-    byte[] value = wrapper.toBytes();
-
-    long startL = 0;
-    long endL = value.length - 1;
-
-    if (commandElems.size() == 4) {
-      try {
-        startL = Coder.bytesToLong(commandElems.get(2));
-        endL = Coder.bytesToLong(commandElems.get(3));
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-        return;
-      }
-    }
-    if (startL > Integer.MAX_VALUE || endL > Integer.MAX_VALUE) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_OUT_OF_RANGE));
-      return;
-    }
-
-    int start = (int) startL;
-    int end = (int) endL;
-    if (start < 0)
-      start += value.length;
-    if (end < 0)
-      end += value.length;
-
-    if (start < 0)
-      start = 0;
-    if (end < 0)
-      end = 0;
-
-    if (end > value.length - 1)
-      end = value.length - 1;
-
-    if (end < start || start >= value.length) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    long setBits = 0;
-    for (int j = start; j <= end; j++)
-      setBits += Integer.bitCount(0xFF & value[j]); // 0xFF keeps same bit sequence as the byte as
-                                                    // opposed to keeping the same value
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), setBits));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java
deleted file mode 100755
index 49f0f5c..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitOpExecutor.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class BitOpExecutor extends StringExecutor {
-
-  private static final String ERROR_NO_SUCH_OP = "Please specify a legal operation";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITOP));
-      return;
-    }
-
-    String operation = command.getStringKey().toUpperCase();
-    ByteArrayWrapper destKey = new ByteArrayWrapper(commandElems.get(2));
-    checkDataType(destKey, context);
-
-    byte[][] values = new byte[commandElems.size() - 3][];
-    int maxLength = 0;
-    for (int i = 3; i < commandElems.size(); i++) {
-      ByteArrayWrapper key = new ByteArrayWrapper(commandElems.get(i));
-      checkDataType(key, context);
-      ByteArrayWrapper value = r.get(key);
-      if (value == null) {
-        values[i - 3] = null;
-        continue;
-      }
-
-      byte[] val = value.toBytes();
-      values[i - 3] = val;
-      if (val.length > maxLength) {
-        maxLength = val.length;
-        byte[] tmp = values[0];
-        values[0] = val;
-        values[i - 3] = tmp;
-      }
-      if (i == 3 && operation.equalsIgnoreCase("NOT"))
-        break;
-    }
-
-
-    if (operation.equals("AND"))
-      and(context, r, destKey, values, maxLength);
-    else if (operation.equals("OR"))
-      or(context, r, destKey, values, maxLength);
-    else if (operation.equals("XOR"))
-      xor(context, r, destKey, values, maxLength);
-    else if (operation.equals("NOT"))
-      not(context, r, destKey, values, maxLength);
-    else {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NO_SUCH_OP));
-      return;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), maxLength));
-  }
-
-  private void and(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
-      ByteArrayWrapper destKey, byte[][] values, int max) {
-    byte[] dest = new byte[max];
-    outer: for (int i = 0; i < max; i++) {
-      byte b = values[0][i];
-      for (int j = 1; j < values.length; j++) {
-        if (values[j] == null) {
-          break outer;
-        } else if (i < values[j].length)
-          b &= values[j][i];
-        else
-          b &= 0;
-      }
-      dest[i] = b;
-    }
-    checkAndSetDataType(destKey, context);
-    r.put(destKey, new ByteArrayWrapper(dest));
-  }
-
-  private void or(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
-      ByteArrayWrapper destKey, byte[][] values, int max) {
-    byte[] dest = new byte[max];
-    for (int i = 0; i < max; i++) {
-      byte b = values[0][i];
-      for (int j = 1; j < values.length; j++) {
-        byte[] cA = values[j];
-        if (cA != null && i < cA.length)
-          b |= cA[i];
-        else
-          b |= 0;
-      }
-      dest[i] = b;
-    }
-    checkAndSetDataType(destKey, context);
-    r.put(destKey, new ByteArrayWrapper(dest));
-  }
-
-  private void xor(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
-      ByteArrayWrapper destKey, byte[][] values, int max) {
-    byte[] dest = new byte[max];
-    for (int i = 0; i < max; i++) {
-      byte b = values[0][i];
-      for (int j = 1; j < values.length; j++) {
-        byte[] cA = values[j];
-        if (cA != null && i < cA.length)
-          b ^= cA[i];
-        else
-          b ^= 0;
-      }
-      dest[i] = b;
-    }
-    checkAndSetDataType(destKey, context);
-    r.put(destKey, new ByteArrayWrapper(dest));
-  }
-
-  private void not(ExecutionHandlerContext context, Region<ByteArrayWrapper, ByteArrayWrapper> r,
-      ByteArrayWrapper destKey, byte[][] values, int max) {
-    byte[] dest = new byte[max];
-    byte[] cA = values[0];
-    for (int i = 0; i < max; i++) {
-      if (cA == null)
-        dest[i] = ~0;
-      else
-        dest[i] = (byte) (~cA[i] & 0xFF);
-    }
-    checkAndSetDataType(destKey, context);
-    r.put(destKey, new ByteArrayWrapper(dest));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
deleted file mode 100755
index ca70ae3..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class BitPosExecutor extends StringExecutor {
-
-  private final String ERROR_NOT_INT = "The numbers provided must be numeric values";
-
-  private final String ERROR_BIT = "The bit must either be a 0 or 1";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.BITPOS));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper string = r.get(key);
-
-    int bit;
-    int bitPosition = -1;
-    boolean endSet = false;
-
-    try {
-      byte[] bitAr = commandElems.get(2);
-      bit = Coder.bytesToInt(bitAr);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-      return;
-    }
-
-    if (bit != 0 && bit != 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_BIT));
-      return;
-    }
-
-    if (string == null || string.length() == 0) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -bit)); // Redis
-                                                                                          // returns
-                                                                                          // 0 when
-                                                                                          // key
-                                                                                          // does
-                                                                                          // not
-                                                                                          // exists
-                                                                                          // for
-                                                                                          // this
-                                                                                          // command
-      return;
-    }
-    byte[] bytes = string.toBytes();
-    int start = 0;
-    int end = bytes.length - 1;
-    if (commandElems.size() > 3) {
-      try {
-        byte[] startAr = commandElems.get(3);
-        start = Coder.bytesToInt(startAr);
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-        return;
-      }
-    }
-
-
-    if (commandElems.size() > 4) {
-      try {
-        byte[] endAr = commandElems.get(4);
-        end = Coder.bytesToInt(endAr);
-        endSet = true;
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-        return;
-      }
-    }
-
-    if (start < 0)
-      start += bytes.length;
-    if (end < 0)
-      end += bytes.length;
-
-    if (start < 0)
-      start = 0;
-    if (end < 0)
-      end = 0;
-
-    if (start > bytes.length)
-      start = bytes.length - 1;
-    if (end > bytes.length)
-      end = bytes.length - 1;
-
-    if (end < start) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -1));
-      return;
-    }
-
-    outerLoop: for (int i = start; i <= end; i++) {
-      int cBit;
-      byte cByte = bytes[i];
-      for (int j = 0; j < 8; j++) {
-        cBit = (cByte & (0x80 >> j)) >> (7 - j);
-        if (cBit == bit) {
-          bitPosition = 8 * i + j;
-          break outerLoop;
-        }
-      }
-    }
-
-    if (bit == 0 && bitPosition == -1 && !endSet)
-      bitPosition = bytes.length * 8;
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bitPosition));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java
deleted file mode 100755
index 6cea057..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrByExecutor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class DecrByExecutor extends StringExecutor {
-
-  private final String ERROR_VALUE_NOT_USABLE =
-      "The value at this key cannot be decremented numerically";
-
-  private final String ERROR_DECREMENT_NOT_USABLE =
-      "The decrementation on this key must be numeric";
-
-  private final String ERROR_OVERFLOW = "This decrementation cannot be performed due to overflow";
-
-  private final int DECREMENT_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DECRBY));
-      return;
-    }
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-    /*
-     * Try increment
-     */
-
-    byte[] decrArray = commandElems.get(DECREMENT_INDEX);
-    String decrString = Coder.bytesToString(decrArray);
-    Long decrement;
-
-    try {
-      decrement = Long.parseLong(decrString);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_DECREMENT_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Value does not exist
-     */
-
-    if (valueWrapper == null) {
-      String negativeDecrString =
-          decrString.charAt(0) == Coder.HYPHEN_ID ? decrString.substring(1) : "-" + decrString;
-      r.put(key, new ByteArrayWrapper(Coder.stringToBytes(negativeDecrString)));
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -decrement));
-      return;
-    }
-
-    /*
-     * Value exists
-     */
-
-    String stringValue = Coder.bytesToString(valueWrapper.toBytes());
-
-    Long value;
-    try {
-      value = Long.parseLong(stringValue);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Check for overflow Negative decrement is used because the decrement is stored as a positive
-     * long
-     */
-    if (value <= 0 && -decrement < (Long.MIN_VALUE - value)) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
-      return;
-    }
-
-    value -= decrement;
-
-    stringValue = "" + value;
-    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java
deleted file mode 100755
index fce698b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/DecrExecutor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
-public class DecrExecutor extends StringExecutor {
-
-  private final String ERROR_VALUE_NOT_USABLE =
-      "The value at this key cannot be decremented numerically";
-
-  private final String ERROR_OVERFLOW = "This decrementation cannot be performed due to overflow";
-
-  private final byte[] INIT_VALUE_BYTES = Coder.stringToBytes("-1");
-
-  private final int INIT_VALUE_INT = -1;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    RegionProvider rC = context.getRegionProvider();
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = rC.getStringsRegion();;
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DECR));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-    /*
-     * Value does not exist
-     */
-
-    if (valueWrapper == null) {
-      byte[] newValue = INIT_VALUE_BYTES;
-      r.put(key, new ByteArrayWrapper(newValue));
-      rC.metaPut(key, RedisDataType.REDIS_STRING);
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), INIT_VALUE_INT));
-      return;
-    }
-
-    /*
-     * Value exists
-     */
-
-    String stringValue = valueWrapper.toString();
-    Long value;
-    try {
-      value = Long.parseLong(stringValue);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
-      return;
-    }
-
-    if (value == Long.MIN_VALUE) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
-      return;
-    }
-
-    value--;
-
-    stringValue = "" + value;
-
-    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java
deleted file mode 100755
index 09147b2..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetBitExecutor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class GetBitExecutor extends StringExecutor {
-
-  private final String ERROR_NOT_INT = "The offset provided must be numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETBIT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper wrapper = r.get(key);
-    if (wrapper == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    int bit = 0;
-    byte[] bytes = wrapper.toBytes();
-    int offset;
-    try {
-      byte[] offAr = commandElems.get(2);
-      offset = Coder.bytesToInt(offAr);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-      return;
-    }
-    if (offset < 0)
-      offset += bytes.length * 8;
-
-    if (offset < 0 || offset > bytes.length * 8) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    int byteIndex = offset / 8;
-    offset %= 8;
-
-    if (byteIndex >= bytes.length) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    bit = (bytes[byteIndex] & (0x80 >> offset)) >> (7 - offset);
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bit));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java
deleted file mode 100755
index 3a52928..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetExecutor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class GetExecutor extends StringExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (command.getProcessedCommand().size() < 2) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETEXECUTOR));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_STRING, context);
-    ByteArrayWrapper wrapper = r.get(key);
-
-    if (wrapper == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    } else {
-      command.setResponse(
-          Coder.getBulkStringResponse(context.getByteBufAllocator(), wrapper.toBytes()));
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java
deleted file mode 100755
index f80099c..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class GetRangeExecutor extends StringExecutor {
-
-  private final String ERROR_NOT_INT = "The indexes provided must be numeric values";
-
-  private final int startIndex = 2;
-
-  private final int stopIndex = 3;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETRANGE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_STRING, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-    if (valueWrapper == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    byte[] value = valueWrapper.toBytes();
-    int length = value.length;
-
-    long start;
-    long end;
-
-
-    try {
-      byte[] startI = commandElems.get(startIndex);
-      byte[] stopI = commandElems.get(stopIndex);
-      start = Coder.bytesToLong(startI);
-      end = Coder.bytesToLong(stopI);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
-      return;
-    }
-    start = getBoundedStartIndex(start, length);
-    end = getBoundedEndIndex(end, length);
-
-    /*
-     * If the properly formatted indexes are illegal, send nil
-     */
-    if (start > end || start == length) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-    /*
-     * 1 is added to end because the end in copyOfRange is exclusive but in Redis it is inclusive
-     */
-    if (end != length)
-      end++;
-    byte[] returnRange = Arrays.copyOfRange(value, (int) start, (int) end);
-    if (returnRange == null || returnRange.length == 0) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), returnRange));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java
deleted file mode 100755
index 146fff8..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class GetSetExecutor extends StringExecutor {
-
-  private final int VALUE_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETSET));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-
-    byte[] newCharValue = commandElems.get(VALUE_INDEX);
-    ByteArrayWrapper newValueWrapper = new ByteArrayWrapper(newCharValue);
-
-    ByteArrayWrapper oldValueWrapper = r.get(key);
-    r.put(key, newValueWrapper);
-
-    if (oldValueWrapper == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-    } else {
-      command.setResponse(
-          Coder.getBulkStringResponse(context.getByteBufAllocator(), oldValueWrapper.toBytes()));
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java
deleted file mode 100755
index 00e2e3b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class IncrByExecutor extends StringExecutor {
-
-  private final String ERROR_VALUE_NOT_USABLE =
-      "The value at this key cannot be incremented numerically";
-
-  private final String ERROR_INCREMENT_NOT_USABLE = "The increment on this key must be numeric";
-
-  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
-  private final int INCREMENT_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBY));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-    /*
-     * Try increment
-     */
-
-    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
-    Long increment;
-
-    try {
-      increment = Coder.bytesToLong(incrArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Value does not exist
-     */
-
-    if (valueWrapper == null) {
-      r.put(key, new ByteArrayWrapper(incrArray));
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), increment));
-      return;
-    }
-
-    /*
-     * Value exists
-     */
-
-    String stringValue = Coder.bytesToString(valueWrapper.toBytes());
-    Long value;
-    try {
-      value = Long.parseLong(stringValue);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Check for overflow
-     */
-    if (value >= 0 && increment > (Long.MAX_VALUE - value)) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
-      return;
-    }
-
-    value += increment;
-
-    stringValue = "" + value;
-    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java
deleted file mode 100755
index 0c20f66..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class IncrByFloatExecutor extends StringExecutor {
-
-  private final String ERROR_VALUE_NOT_USABLE =
-      "Invalid value at this key and cannot be incremented numerically";
-
-  private final String ERROR_INCREMENT_NOT_USABLE =
-      "The increment on this key must be a valid floating point numeric";
-
-  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
-  private final int INCREMENT_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-    if (commandElems.size() < 3) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBYFLOAT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-    /*
-     * Try increment
-     */
-
-    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
-    String doub = Coder.bytesToString(incrArray).toLowerCase();
-    if (doub.contains("inf") || doub.contains("nan")) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
-          "Increment would produce NaN or infinity"));
-      return;
-    } else if (valueWrapper != null && valueWrapper.toString().contains(" ")) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
-      return;
-    }
-
-
-    Double increment;
-
-    try {
-      increment = Coder.stringToDouble(doub);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Value does not exist
-     */
-
-    if (valueWrapper == null) {
-      r.put(key, new ByteArrayWrapper(incrArray));
-      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), increment));
-      return;
-    }
-
-    /*
-     * Value exists
-     */
-
-    String stringValue = Coder.bytesToString(valueWrapper.toBytes());
-
-    Double value;
-    try {
-      value = Coder.stringToDouble(stringValue);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Check for overflow
-     */
-    if (value >= 0 && increment > (Double.MAX_VALUE - value)) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
-      return;
-    }
-
-    double result = value + increment;
-    if (Double.isNaN(result) || Double.isInfinite(result)) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_NAN_INF_INCR));
-      return;
-    }
-    value += increment;
-
-    stringValue = "" + value;
-    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), value));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java
deleted file mode 100755
index f506fe6..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.string;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class IncrExecutor extends StringExecutor {
-
-  private final String ERROR_VALUE_NOT_USABLE =
-      "The value at this key cannot be incremented numerically";
-
-  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
-  private final int INIT_VALUE_INT = 1;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCR));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    ByteArrayWrapper valueWrapper = r.get(key);
-
-    /*
-     * Value does not exist
-     */
-
-    if (valueWrapper == null) {
-      byte[] newValue = {Coder.NUMBER_1_BYTE};
-      r.put(key, new ByteArrayWrapper(newValue));
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), INIT_VALUE_INT));
-      return;
-    }
-
-    /*
-     * Value exists
-     */
-
-    String stringValue = valueWrapper.toString();
-
-    Long value;
-    try {
-      value = Long.parseLong(stringValue);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
-      return;
-    }
-
-    if (value == Long.MAX_VALUE) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
-      return;
-    }
-
-    value++;
-
-    stringValue = "" + value;
-    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
-  }
-
-}


[11/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java
deleted file mode 100644
index d6030a9..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/RedisDistDUnitTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.util.Random;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import redis.clients.jedis.Jedis;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.net.SocketCreator;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.dunit.DistributedTestUtils;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.IgnoredException;
-import org.apache.geode.test.dunit.LogWriterUtils;
-import org.apache.geode.test.dunit.SerializableCallable;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
-
-@Category(DistributedTest.class)
-public class RedisDistDUnitTest extends JUnit4DistributedTestCase {
-
-  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 String localHost;
-
-  private static final int JEDIS_TIMEOUT = 20 * 1000;
-
-  private abstract class ClientTestBase extends SerializableCallable {
-
-    int port;
-
-    protected ClientTestBase(int port) {
-      this.port = port;
-    }
-  }
-
-  @Override
-  public final void postSetUp() throws Exception {
-    disconnectAllFromDS();
-
-    localHost = SocketCreator.getLocalHost().getHostName();
-
-    host = Host.getHost(0);
-    server1 = host.getVM(0);
-    server2 = host.getVM(1);
-    client1 = host.getVM(2);
-    client2 = host.getVM(3);
-    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-    final int locatorPort = DistributedTestUtils.getDUnitLocatorPort();
-    final SerializableCallable<Object> startRedisAdapter = new SerializableCallable<Object>() {
-
-      @Override
-      public Object call() throws Exception {
-        int port = ports[VM.getCurrentVMNum()];
-        CacheFactory cF = new CacheFactory();
-        String locator = SocketCreator.getLocalHost().getHostName() + "[" + locatorPort + "]";
-        cF.set(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-        cF.set(ConfigurationProperties.REDIS_BIND_ADDRESS, localHost);
-        cF.set(ConfigurationProperties.REDIS_PORT, "" + port);
-        cF.set(MCAST_PORT, "0");
-        cF.set(LOCATORS, locator);
-        cF.create();
-        return Integer.valueOf(port);
-      }
-    };
-    AsyncInvocation i = server1.invokeAsync(startRedisAdapter);
-    server2Port = (Integer) server2.invoke(startRedisAdapter);
-    server1Port = (Integer) i.getResult();
-  }
-
-  @Override
-  public final void preTearDown() throws Exception {
-    disconnectAllFromDS();
-  }
-
-  @Category(FlakyTest.class) // GEODE-1092: random ports, failure stack involves TCPTransport
-                             // ConnectionHandler (are we eating BindExceptions somewhere?), uses
-                             // Random, async actions
-  @Test
-  public void testConcListOps() throws Exception {
-    final Jedis jedis1 = new Jedis(localHost, server1Port, JEDIS_TIMEOUT);
-    final Jedis jedis2 = new Jedis(localHost, server2Port, JEDIS_TIMEOUT);
-    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, JEDIS_TIMEOUT);
-        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);
-  }
-
-  @Category(FlakyTest.class) // GEODE-717: random ports, BindException in failure stack, async
-                             // actions
-  @Test
-  public void testConcCreateDestroy() throws Exception {
-    IgnoredException.addIgnoredException("RegionDestroyedException");
-    IgnoredException.addIgnoredException("IndexInvalidException");
-    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, JEDIS_TIMEOUT);
-        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
-   */
-  @Category(FlakyTest.class) // GEODE-1697
-  @Test
-  public void testConcOps() throws Exception {
-
-    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, JEDIS_TIMEOUT);
-        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/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/RedisServerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/RedisServerTest.java b/geode-core/src/test/java/org/apache/geode/redis/RedisServerTest.java
deleted file mode 100644
index 81e639d..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/RedisServerTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.DataPolicy;
-import org.apache.geode.cache.Region;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-@Category(IntegrationTest.class)
-public class RedisServerTest {
-
-  Cache cache;
-  GeodeRedisServer redisServer;
-
-  @Before
-  public void createCache() {
-    Properties props = new Properties();
-    props.setProperty("mcast-port", "0");
-    CacheFactory cacheFactory = new CacheFactory(props);
-    cache = cacheFactory.create();
-  }
-
-  @After
-  public void teardown() {
-    if (redisServer != null) {
-      redisServer.shutdown();
-      cache.close();
-    }
-  }
-
-  @Test
-  public void initializeRedisCreatesThreeRegions() {
-    createCache();
-    assert (cache.rootRegions().size() == 0);
-    redisServer = new GeodeRedisServer(0);
-    redisServer.start();
-    assert cache.rootRegions().size() == 2 : cache.rootRegions().size();
-    assert cache.getRegion(GeodeRedisServer.REDIS_META_DATA_REGION) != null;
-  }
-
-  @Test
-  public void initializeRedisCreatesPartitionedRegionByDefault() {
-    createCache();
-    assert (cache.rootRegions().size() == 0);
-    redisServer = new GeodeRedisServer(0);
-    redisServer.start();
-    Region r = cache.getRegion(GeodeRedisServer.STRING_REGION);
-    assert r.getAttributes().getDataPolicy() == DataPolicy.PARTITION : r.getAttributes()
-        .getDataPolicy();
-  }
-
-  @Test
-  public void initializeRedisCreatesRegionsUsingSystemProperty() {
-    createCache();
-    assert (cache.rootRegions().size() == 0);
-    System.setProperty("gemfireredis.regiontype", "REPLICATE");
-    redisServer = new GeodeRedisServer(0);
-    redisServer.start();
-    Region r = cache.getRegion(GeodeRedisServer.STRING_REGION);
-    assert r.getAttributes().getDataPolicy() == DataPolicy.REPLICATE : r.getAttributes()
-        .getDataPolicy();
-    System.setProperty("gemfireredis.regiontype", "");
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
deleted file mode 100755
index aaa7724..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-import redis.clients.jedis.Jedis;
-
-@Category(IntegrationTest.class)
-public class SetsJUnitTest {
-
-  private static Jedis jedis;
-  private static GeodeRedisServer 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 GeodeRedisServer("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();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
deleted file mode 100755
index 633cb3d..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
-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 redis.clients.jedis.Tuple;
-
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class SortedSetsJUnitTest {
-  private static Jedis jedis;
-  private static GeodeRedisServer 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 GeodeRedisServer("localhost", port);
-
-    server.start();
-    jedis = new Jedis("localhost", port, 10000000);
-  }
-
-  @Test
-  public void testZAddZRange() {
-    int numMembers = 10;
-    String key = randString();
-    Map<String, Double> scoreMembers = new HashMap<String, Double>();
-
-    for (int i = 0; i < numMembers; i++)
-      scoreMembers.put(randString(), rand.nextDouble());
-
-    jedis.zadd(key, scoreMembers);
-    int k = 0;
-    for (String entry : scoreMembers.keySet())
-      assertNotNull(jedis.zscore(key, entry));
-
-    Set<Tuple> results = jedis.zrangeWithScores(key, 0, -1);
-    Map<String, Double> resultMap = new HashMap<String, Double>();
-    for (Tuple t : results) {
-      resultMap.put(t.getElement(), t.getScore());
-    }
-
-    assertEquals(scoreMembers, resultMap);
-
-    for (int i = 0; i < 10; i++) {
-      int start;
-      int stop;
-      do {
-        start = rand.nextInt(numMembers);
-        stop = rand.nextInt(numMembers);
-      } while (start > stop);
-      results = jedis.zrangeWithScores(key, start, stop);
-      List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
-      for (Tuple t : results)
-        resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
-      List<Entry<String, Double>> list =
-          new ArrayList<Entry<String, Double>>(scoreMembers.entrySet());
-      Collections.sort(list, new EntryCmp());
-      list = list.subList(start, stop + 1);
-      assertEquals(list, resultList);
-    }
-  }
-
-  @Test
-  public void testZRevRange() {
-    int numMembers = 10;
-    String key = randString();
-
-    Map<String, Double> scoreMembers = new HashMap<String, Double>();
-
-    for (int i = 0; i < numMembers; i++)
-      scoreMembers.put(randString(), rand.nextDouble());
-
-    jedis.zadd(key, scoreMembers);
-
-    Set<Tuple> results;
-
-    for (int i = 0; i < 10; i++) {
-      int start;
-      int stop;
-      do {
-        start = rand.nextInt(numMembers);
-        stop = rand.nextInt(numMembers);
-      } while (start > stop);
-      results = jedis.zrevrangeWithScores(key, start, stop);
-      List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
-      for (Tuple t : results)
-        resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
-      List<Entry<String, Double>> list =
-          new ArrayList<Entry<String, Double>>(scoreMembers.entrySet());
-      Collections.sort(list, new EntryRevCmp());
-      list = list.subList(start, stop + 1);
-      assertEquals(list, resultList);
-    }
-  }
-
-  @Test
-  public void testZCount() {
-    int num = 10;
-    int runs = 2;
-    for (int i = 0; i < runs; i++) {
-      Double min;
-      Double max;
-      do {
-        min = rand.nextDouble();
-        max = rand.nextDouble();
-      } while (min > max);
-
-
-      int count = 0;
-
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-
-      for (int j = 0; j < num; j++) {
-        Double nextDouble = rand.nextDouble();
-        if (nextDouble >= min && nextDouble <= max)
-          count++;
-        scoreMembers.put(randString(), nextDouble);
-      }
-
-      jedis.zadd(key, scoreMembers);
-      Long countResult = jedis.zcount(key, min, max);
-      assertTrue(count == countResult);
-    }
-
-  }
-
-  @Test
-  public void testZIncrBy() {
-    String key = randString();
-    String member = randString();
-    Double score = 0.0;
-    for (int i = 0; i < 20; i++) {
-      Double incr = rand.nextDouble();
-      Double result = jedis.zincrby(key, incr, member);
-      score += incr;
-      assertEquals(score, result, 1.0 / 100000000.0);
-    }
-
-
-    jedis.zincrby(key, Double.MAX_VALUE, member);
-    Double infResult = jedis.zincrby(key, Double.MAX_VALUE, member);
-
-
-    assertEquals(infResult, Double.valueOf(Double.POSITIVE_INFINITY));
-  }
-
-  public void testZRangeByScore() {
-    Double min;
-    Double max;
-    for (int j = 0; j < 2; j++) {
-      do {
-        min = rand.nextDouble();
-        max = rand.nextDouble();
-      } while (min > max);
-      int numMembers = 500;
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-      List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
-      for (int i = 0; i < numMembers; i++) {
-        String s = randString();
-        Double d = rand.nextDouble();
-        scoreMembers.put(s, d);
-        if (d > min && d < max)
-          expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-      }
-      jedis.zadd(key, scoreMembers);
-      Set<Tuple> results = jedis.zrangeByScoreWithScores(key, min, max);
-      List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
-      for (Tuple t : results)
-        resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
-      Collections.sort(expected, new EntryCmp());
-
-      assertEquals(expected, resultList);
-      jedis.del(key);
-    }
-  }
-
-  public void testZRevRangeByScore() {
-    Double min;
-    Double max;
-    for (int j = 0; j < 2; j++) {
-      do {
-        min = rand.nextDouble();
-        max = rand.nextDouble();
-      } while (min > max);
-      int numMembers = 500;
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-      List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
-      for (int i = 0; i < numMembers; i++) {
-        String s = randString();
-        Double d = rand.nextDouble();
-        scoreMembers.put(s, d);
-        if (d > min && d < max)
-          expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-      }
-      jedis.zadd(key, scoreMembers);
-      Set<Tuple> results = jedis.zrevrangeByScoreWithScores(key, max, min);
-      List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
-      for (Tuple t : results)
-        resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
-      Collections.sort(expected, new EntryRevCmp());
-
-      assertEquals(expected, resultList);
-      jedis.del(key);
-    }
-  }
-
-  @Test
-  public void testZRemZScore() {
-    Double min;
-    Double max;
-    for (int j = 0; j < 2; j++) {
-      do {
-        min = rand.nextDouble();
-        max = rand.nextDouble();
-      } while (min > max);
-      int numMembers = 5000;
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-      List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
-      for (int i = 0; i < numMembers; i++) {
-        String s = randString();
-        Double d = rand.nextDouble();
-        scoreMembers.put(s, d);
-        if (d > min && d < max)
-          expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-      }
-      jedis.zadd(key, scoreMembers);
-      Collections.sort(expected, new EntryCmp());
-      for (int i = expected.size(); i > 0; i--) {
-        Entry<String, Double> remEntry = expected.remove(i - 1);
-        String rem = remEntry.getKey();
-        Double val = remEntry.getValue();
-        assertEquals(val, jedis.zscore(key, rem));
-
-        assertTrue(jedis.zrem(key, rem) == 1);
-      }
-      String s = randString();
-      if (!expected.contains(s))
-        assertTrue(jedis.zrem(key, s) == 0);
-      jedis.del(key);
-    }
-  }
-
-  @Test
-  public void testZRank() {
-    for (int j = 0; j < 2; j++) {
-      int numMembers = 10;
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-      List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
-      for (int i = 0; i < numMembers; i++) {
-        String s = randString();
-        Double d = rand.nextDouble();
-        scoreMembers.put(s, d);
-        expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-      }
-      Collections.sort(expected, new EntryCmp());
-      jedis.zadd(key, scoreMembers);
-      for (int i = 0; i < expected.size(); i++) {
-        Entry<String, Double> en = expected.get(i);
-        String field = en.getKey();
-        Long rank = jedis.zrank(key, field);
-        assertEquals(new Long(i), rank);
-      }
-      String field = randString();
-      if (!expected.contains(field))
-        assertNull(jedis.zrank(key, field));
-      jedis.del(key);
-    }
-  }
-
-  @Test
-  public void testZRevRank() {
-    for (int j = 0; j < 2; j++) {
-      int numMembers = 10;
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-      List<Entry<String, Double>> expected = new ArrayList<Entry<String, Double>>();
-      for (int i = 0; i < numMembers; i++) {
-        String s = randString();
-        Double d = rand.nextDouble();
-        scoreMembers.put(s, d);
-        expected.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-      }
-      Collections.sort(expected, new EntryRevCmp());
-      jedis.zadd(key, scoreMembers);
-      for (int i = 0; i < expected.size(); i++) {
-        Entry<String, Double> en = expected.get(i);
-        String field = en.getKey();
-        Long rank = jedis.zrevrank(key, field);
-        assertEquals(new Long(i), rank);
-      }
-      String field = randString();
-      if (!expected.contains(field))
-        assertNull(jedis.zrank(key, field));
-      jedis.del(key);
-    }
-  }
-
-  private class EntryCmp implements Comparator<Entry<String, Double>> {
-
-    @Override
-    public int compare(Entry<String, Double> o1, Entry<String, Double> o2) {
-      Double diff = o1.getValue() - o2.getValue();
-      if (diff == 0)
-        return o2.getKey().compareTo(o1.getKey());
-      else
-        return diff > 0 ? 1 : -1;
-    }
-
-  }
-
-  private class EntryRevCmp implements Comparator<Entry<String, Double>> {
-
-    @Override
-    public int compare(Entry<String, Double> o1, Entry<String, Double> o2) {
-      Double diff = o2.getValue() - o1.getValue();
-      if (diff == 0)
-        return o1.getKey().compareTo(o2.getKey());
-      else
-        return diff > 0 ? 1 : -1;
-    }
-
-  }
-
-  @Test
-  public void testZRemRangeByScore() {
-    Double min;
-    Double max;
-    for (int j = 0; j < 3; j++) {
-      do {
-        min = rand.nextDouble();
-        max = rand.nextDouble();
-      } while (min > max);
-      int numMembers = 10;
-      String key = randString();
-      Map<String, Double> scoreMembers = new HashMap<String, Double>();
-      List<Entry<String, Double>> fullList = new ArrayList<Entry<String, Double>>();
-      List<Entry<String, Double>> toRemoveList = new ArrayList<Entry<String, Double>>();
-      for (int i = 0; i < numMembers; i++) {
-        String s = randString();
-        Double d = rand.nextDouble();
-        scoreMembers.put(s, d);
-        fullList.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-        if (d > min && d < max)
-          toRemoveList.add(new AbstractMap.SimpleEntry<String, Double>(s, d));
-      }
-      jedis.zadd(key, scoreMembers);
-      Long numRemoved = jedis.zremrangeByScore(key, min, max);
-      List<Entry<String, Double>> expectedList = new ArrayList<Entry<String, Double>>(fullList);
-      expectedList.removeAll(toRemoveList);
-      Collections.sort(expectedList, new EntryCmp());
-      Set<Tuple> result = jedis.zrangeWithScores(key, 0, -1);
-      List<Entry<String, Double>> resultList = new ArrayList<Entry<String, Double>>();
-      for (Tuple t : result)
-        resultList.add(new AbstractMap.SimpleEntry<String, Double>(t.getElement(), t.getScore()));
-      assertEquals(expectedList, resultList);
-      jedis.del(key);
-    }
-  }
-
-  private String randString() {
-    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/geode/blob/c6dbc6d4/geode-core/src/test/java/org/apache/geode/redis/StringsJunitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/StringsJunitTest.java b/geode-core/src/test/java/org/apache/geode/redis/StringsJunitTest.java
deleted file mode 100755
index 6d11a71..0000000
--- a/geode-core/src/test/java/org/apache/geode/redis/StringsJunitTest.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-import org.apache.geode.redis.GeodeRedisServer;
-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 java.io.IOException;
-import java.util.*;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class StringsJunitTest {
-
-  private static Jedis jedis;
-  private static GeodeRedisServer 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 GeodeRedisServer("localhost", port);
-
-    server.start();
-    jedis = new Jedis("localhost", port, 10000000);
-  }
-
-  @Test
-  public void testAppendAndStrlen() {
-    String key = randString();
-    int len = key.length();
-    String full = key;
-    jedis.set(key, key);
-    for (int i = 0; i < 15; i++) {
-      String rand = randString();
-      jedis.append(key, rand);
-      len += rand.length();
-      full += rand;
-    }
-    String ret = jedis.get(key);
-    assertTrue(ret.length() == len);
-    assertTrue(full.equals(ret));
-    assertTrue(full.length() == jedis.strlen(key));
-  }
-
-  @Test
-  public void testDecr() {
-    String key1 = randString();
-    String key2 = randString();
-    String key3 = randString();
-    int num1 = 100;
-    int num2 = -100;
-    jedis.set(key1, "" + num1);
-    // jedis.set(key3, "-100");
-    jedis.set(key2, "" + num2);
-
-    jedis.decr(key1);
-    jedis.decr(key3);
-    jedis.decr(key2);
-    assertTrue(jedis.get(key1).equals("" + (num1 - 1)));
-    assertTrue(jedis.get(key2).equals("" + (num2 - 1)));
-    assertTrue(jedis.get(key3).equals("" + (-1)));
-  }
-
-  @Test
-  public void testIncr() {
-    String key1 = randString();
-    String key2 = randString();
-    String key3 = randString();
-    int num1 = 100;
-    int num2 = -100;
-    jedis.set(key1, "" + num1);
-    // jedis.set(key3, "-100");
-    jedis.set(key2, "" + num2);
-
-    jedis.incr(key1);
-    jedis.incr(key3);
-    jedis.incr(key2);
-
-    assertTrue(jedis.get(key1).equals("" + (num1 + 1)));
-    assertTrue(jedis.get(key2).equals("" + (num2 + 1)));
-    assertTrue(jedis.get(key3).equals("" + (+1)));
-  }
-
-  @Test
-  public void testDecrBy() {
-    String key1 = randString();
-    String key2 = randString();
-    String key3 = randString();
-    int decr1 = rand.nextInt(100);
-    int decr2 = rand.nextInt(100);
-    Long decr3 = Long.MAX_VALUE / 2;
-    int num1 = 100;
-    int num2 = -100;
-    jedis.set(key1, "" + num1);
-    jedis.set(key2, "" + num2);
-    jedis.set(key3, "" + Long.MIN_VALUE);
-
-    jedis.decrBy(key1, decr1);
-    jedis.decrBy(key2, decr2);
-
-    assertTrue(jedis.get(key1).equals("" + (num1 - decr1 * 1)));
-    assertTrue(jedis.get(key2).equals("" + (num2 - decr2 * 1)));
-
-    Exception ex = null;
-    try {
-      jedis.decrBy(key3, decr3);
-    } catch (Exception e) {
-      ex = e;
-    }
-    assertNotNull(ex);
-
-  }
-
-  @Test
-  public void testIncrBy() {
-    String key1 = randString();
-    String key2 = randString();
-    String key3 = randString();
-    int incr1 = rand.nextInt(100);
-    int incr2 = rand.nextInt(100);
-    Long incr3 = Long.MAX_VALUE / 2;
-    int num1 = 100;
-    int num2 = -100;
-    jedis.set(key1, "" + num1);
-    jedis.set(key2, "" + num2);
-    jedis.set(key3, "" + Long.MAX_VALUE);
-
-    jedis.incrBy(key1, incr1);
-    jedis.incrBy(key2, incr2);
-    assertTrue(jedis.get(key1).equals("" + (num1 + incr1 * 1)));
-    assertTrue(jedis.get(key2).equals("" + (num2 + incr2 * 1)));
-
-    Exception ex = null;
-    try {
-      jedis.incrBy(key3, incr3);
-    } catch (Exception e) {
-      ex = e;
-    }
-    assertNotNull(ex);
-  }
-
-  @Test
-  public void testGetRange() {
-    String sent = randString();
-    String contents = randString();
-    jedis.set(sent, contents);
-    for (int i = 0; i < sent.length(); i++) {
-      String range = jedis.getrange(sent, i, -1);
-      assertTrue(contents.substring(i).equals(range));
-    }
-    assertNull(jedis.getrange(sent, 2, 0));
-  }
-
-  @Test
-  public void testGetSet() {
-    String key = randString();
-    String contents = randString();
-    jedis.set(key, contents);
-    String newContents = randString();
-    String oldContents = jedis.getSet(key, newContents);
-    assertTrue(oldContents.equals(contents));
-    contents = newContents;
-  }
-
-  @Test
-  public void testMSetAndGet() {
-    int r = 5;
-    String[] keyvals = new String[(r * 2)];
-    String[] keys = new String[r];
-    String[] vals = new String[r];
-    for (int i = 0; i < r; i++) {
-      String key = randString();
-      String val = randString();
-      keyvals[2 * i] = key;
-      keyvals[2 * i + 1] = val;
-      keys[i] = key;
-      vals[i] = val;
-    }
-
-    jedis.mset(keyvals);
-
-    List<String> ret = jedis.mget(keys);
-    Object[] retArray = ret.toArray();
-
-    assertTrue(Arrays.equals(vals, retArray));
-  }
-
-  @Test
-  public void testMSetNX() {
-    Set<String> strings = new HashSet<String>();
-    for (int i = 0; i < 2 * 5; i++)
-      strings.add(randString());
-    String[] array = strings.toArray(new String[0]);
-    long response = jedis.msetnx(array);
-
-    assertTrue(response == 1);
-
-    long response2 = jedis.msetnx(array[0], randString());
-
-    assertTrue(response2 == 0);
-    assertEquals(array[1], jedis.get(array[0]));
-  }
-
-  @Test
-  public void testSetNX() {
-    String key1 = randString();
-    String key2;
-    do {
-      key2 = randString();
-    } while (key2.equals(key1));
-
-    long response1 = jedis.setnx(key1, key1);
-    long response2 = jedis.setnx(key2, key2);
-    long response3 = jedis.setnx(key1, key2);
-
-    assertTrue(response1 == 1);
-    assertTrue(response2 == 1);
-    assertTrue(response3 == 0);
-  }
-
-  @Test
-  public void testPAndSetex() {
-    Random r = new Random();
-    int setex = r.nextInt(5);
-    if (setex == 0)
-      setex = 1;
-    String key = randString();
-    jedis.setex(key, setex, randString());
-    try {
-      Thread.sleep((setex + 5) * 1000);
-    } catch (InterruptedException e) {
-      return;
-    }
-    String result = jedis.get(key);
-    // System.out.println(result);
-    assertNull(result);
-
-    int psetex = r.nextInt(5000);
-    if (psetex == 0)
-      psetex = 1;
-    key = randString();
-    jedis.psetex(key, psetex, randString());
-    long start = System.currentTimeMillis();
-    try {
-      Thread.sleep(psetex + 5000);
-    } catch (InterruptedException e) {
-      return;
-    }
-    long stop = System.currentTimeMillis();
-    result = jedis.get(key);
-    assertTrue(stop - start >= psetex);
-    assertNull(result);
-  }
-
-  private String randString() {
-    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/geode/blob/c6dbc6d4/geode-redis/build.gradle
----------------------------------------------------------------------
diff --git a/geode-redis/build.gradle b/geode-redis/build.gradle
new file mode 100644
index 0000000..b769007
--- /dev/null
+++ b/geode-redis/build.gradle
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+dependencies {
+    compile project(':geode-core')
+    compile project(':geode-common')
+    compile('io.netty:netty-all:' + project.'netty-all.version') {
+        ext.optional = true
+    }
+
+    testCompile project(':geode-junit')
+    testCompile 'redis.clients:jedis:' + project.'jedis.version'
+
+    testCompile files(project(':geode-core').sourceSets.test.output)
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java b/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java
new file mode 100644
index 0000000..6503766
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServiceImpl.java
@@ -0,0 +1,597 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.ServerChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.oio.OioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.channel.socket.oio.OioServerSocketChannel;
+import io.netty.util.concurrent.Future;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionDestroyedException;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.util.CacheListenerAdapter;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.cache.CacheService;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalRegionArguments;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.management.internal.beans.CacheServiceMBeanBase;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ByteToCommandDecoder;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RegionProvider;
+import org.apache.geode.redis.internal.hll.HyperLogLogPlus;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * The GeodeRedisServiceImpl is a server that understands the Redis protocol. As commands are sent
+ * to the server, each command is picked up by a thread, interpreted and then executed and a
+ * response is sent back to the client. The default connection port is 6379 but that can be altered
+ * when run through GFSH or started through the provided static main class.
+ * <p>
+ * Each Redis data type instance is stored in a separate {@link Region} except for the Strings and
+ * HyperLogLogs which are collectively stored in one Region respectively. That Region along with a
+ * meta data region used internally are protected so the client may not store keys with the name
+ * {@link GeodeRedisServiceImpl#REDIS_META_DATA_REGION} or
+ * {@link GeodeRedisServiceImpl#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 GeodeRedisServiceImpl#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>
+ * Supported String commands - APPEND, BITCOUNT, BITOP, BITPOS, DECR, DECRBY, GET, GETBIT, GETRANGE,
+ * GETSET, INCR, INCRBY, INCRBYFLOAT, MGET, MSET, MSETNX, PSETEX, SET, SETBIT, SETEX, SETNX, STRLEN
+ * <p>
+ * Supported List commands - LINDEX, LLEN, LPOP, LPUSH, LPUSHX, LRANGE, LREM, LSET, LTRIM, RPOP,
+ * RPUSH, RPUSHX
+ * <p>
+ * Supported Hash commands - HDEL, HEXISTS, HGET, HGETALL, HINCRBY, HINCRBYFLOAT, HKEYS, HMGET,
+ * HMSET, HSETNX, HLEN, HSCAN, HSET, HVALS
+ * <p>
+ * Supported Set commands - SADD, SCARD, SDIFF, SDIFFSTORE, SINTER, SINTERSTORE, SISMEMBER,
+ * SMEMBERS, SMOVE, SREM, SPOP, SRANDMEMBER, SCAN, SUNION, SUNIONSTORE
+ * <p>
+ * Supported SortedSet commands - ZADD, ZCARD, ZCOUNT, ZINCRBY, ZLEXCOUNT, ZRANGE, ZRANGEBYLEX,
+ * ZRANGEBYSCORE, ZRANK, ZREM, ZREMRANGEBYLEX, ZREMRANGEBYRANK, ZREMRANGEBYSCORE, ZREVRANGE,
+ * ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE
+ * <p>
+ * Supported HyperLogLog commands - PFADD, PFCOUNT, PFMERGE
+ * <p>
+ * Supported Keys commands - DEL, DBSIZE, EXISTS, EXPIRE, EXPIREAT, FLUSHDB, FLUSHALL, KEYS,
+ * PERSIST, PEXPIRE, PEXPIREAT, PTTL, SCAN, TTL
+ * <p>
+ * Supported Transaction commands - DISCARD, EXEC, MULTI
+ * <P>
+ * Supported Server commands - AUTH, ECHO, PING, TIME, QUIT
+ * <p>
+ * <p>
+ * The command executors are not explicitly documented but the functionality can be found at
+ * <a href="http://redis.io/commands">Redis Commands</a>
+ * <p>
+ * Exceptions to the Redis Commands Documents:
+ * <p>
+ * <ul>
+ * <li>Any command that removes keys and returns a count of removed entries will not return a total
+ * remove count but rather a count of how many entries have been removed that existed on the local
+ * vm, though all entries will be removed</li>
+ * <li>Any command that returns a count of newly set members has an unspecified return value. The
+ * command will work just as the Redis protocol states but the count will not necessary reflect the
+ * number set compared to overridden.</li>
+ * <li>Transactions work just as they would on a Redis instance, they are local transaction.
+ * Transactions cannot be executed on data that is not local to the executing server, that is on a
+ * partitioned region in a different server instance or on a persistent region that does not have
+ * transactions enabled. Also, you cannot watch or unwatch keys as all keys within a GemFire
+ * transaction are watched by default.</li>
+ * </ul>
+ */
+
+public class GeodeRedisServiceImpl implements GeodeRedisService {
+
+  /**
+   * The default Redis port as specified by their protocol, {@value #DEFAULT_REDIS_SERVER_PORT}
+   */
+  public static final int DEFAULT_REDIS_SERVER_PORT = 6379;
+
+  /**
+   * The number of threads that will work on handling requests
+   */
+  private int numWorkerThreads;
+
+  /**
+   * The number of threads that will work socket selectors
+   */
+  private final int numSelectorThreads = 1;
+  private final int numExpirationThreads = 1;
+
+  /**
+   * The actual port being used by the server
+   */
+  private int redisPort;
+
+  /**
+   * The address to bind to
+   */
+  private String redisBindAddress;
+
+  /**
+   * Connection timeout in milliseconds
+   */
+  private static final int connectTimeoutMillis = 1000;
+
+  /**
+   * Temporary constant whether to use old single thread per connection model for worker group
+   */
+  private boolean singleThreadPerConnection;
+
+  /**
+   * The cache instance pointer on this vm
+   */
+  private Cache cache;
+
+  /**
+   * Channel to be closed when shutting down
+   */
+  private Channel serverChannel;
+
+  /**
+   * Gem logwriter
+   */
+  private Logger logger = null;
+
+  private RegionProvider regionProvider;
+  private MetaCacheListener metaListener;
+  private EventLoopGroup bossGroup;
+  private EventLoopGroup workerGroup;
+  private ScheduledExecutorService expirationExecutor;
+
+  /**
+   * Map of futures to be executed for key expirations
+   */
+  private ConcurrentMap<ByteArrayWrapper, ScheduledFuture<?>> expirationFutures;
+
+
+  /**
+   * The field that defines the name of the {@link Region} which holds all of the strings. The
+   * current value of this field is {@value #STRING_REGION}.
+   */
+  public static final String STRING_REGION = "ReDiS_StRiNgS";
+
+  /**
+   * The field that defines the name of the {@link Region} which holds all of the HyperLogLogs. The
+   * current value of this field is {@value #HLL_REGION}.
+   */
+  public static final String HLL_REGION = "ReDiS_HlL";
+
+  /**
+   * The field that defines the name of the {@link Region} which holds all of the Redis meta data.
+   * The current value of this field is {@value #REDIS_META_DATA_REGION}.
+   */
+  public static final String REDIS_META_DATA_REGION = "__ReDiS_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}, i.e. "PARTITION" would be used for {@link RegionShortcut#PARTITION}.
+   */
+  public static final String DEFAULT_REGION_SYS_PROP_NAME = "gemfireredis.regiontype";
+
+  /**
+   * System property name that can be used to set the number of threads to be used by the
+   * GeodeRedisServiceImpl
+   */
+  public static final String NUM_THREADS_SYS_PROP_NAME = "gemfireredis.numthreads";
+
+  /**
+   * The actual {@link RegionShortcut} type specified by the system property
+   * {@value #DEFAULT_REGION_SYS_PROP_NAME}.
+   */
+  private RegionShortcut DEFAULT_REGION_TYPE;
+
+  private boolean shutdown = false;
+  private boolean started = false;
+
+  /**
+   * 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.
+   * 
+   * @return {@link RegionShortcut}
+   */
+  private RegionShortcut setRegionType() {
+    String regionType = System.getProperty(DEFAULT_REGION_SYS_PROP_NAME, "PARTITION");
+    RegionShortcut type;
+    try {
+      type = RegionShortcut.valueOf(regionType);
+    } catch (Exception e) {
+      type = RegionShortcut.PARTITION;
+    }
+    return type;
+  }
+
+  /**
+   * Helper method to set the number of worker threads
+   * 
+   * @return If the System property {@value #NUM_THREADS_SYS_PROP_NAME} is set then that number is
+   *         used, otherwise 4 * # of cores
+   */
+  private int setNumWorkerThreads() {
+    String prop = System.getProperty(NUM_THREADS_SYS_PROP_NAME);
+    int numCores = Runtime.getRuntime().availableProcessors();
+    int def = 4 * numCores;
+    if (prop == null || prop.isEmpty()) {
+      return def;
+    }
+    int threads;
+    try {
+      threads = Integer.parseInt(prop);
+    } catch (NumberFormatException e) {
+      return def;
+    }
+    return threads;
+  }
+
+  public GeodeRedisServiceImpl() {}
+
+  /**
+   * Helper method to get the host name to bind to
+   * 
+   * @return The InetAddress to bind to
+   */
+  private InetAddress getRedisBindAddress() throws UnknownHostException {
+    return this.redisBindAddress == null || this.redisBindAddress.isEmpty()
+        ? SocketCreator.getLocalHost() : InetAddress.getByName(this.redisBindAddress);
+  }
+
+  /**
+   * This is function to call on a {@link GeodeRedisServiceImpl} instance to start it running
+   */
+  @Override
+  public synchronized void start() {
+    if (!started) {
+      try {
+        initializeRedis();
+        startRedisServer();
+      } catch (IOException | InterruptedException e) {
+        throw new RuntimeException("Could not start Server", e);
+      }
+      started = true;
+    }
+  }
+
+  private void initializeRedis() {
+    initializeRedisServiceInternals();
+    Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion;
+
+    Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion;
+    Region<String, RedisDataType> redisMetaData;
+    GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache;
+    try {
+      if ((stringsRegion = cache.getRegion(STRING_REGION)) == null) {
+        RegionFactory<ByteArrayWrapper, ByteArrayWrapper> regionFactory =
+            gemFireCache.createRegionFactory(this.DEFAULT_REGION_TYPE);
+        stringsRegion = regionFactory.create(STRING_REGION);
+      }
+      if ((hLLRegion = cache.getRegion(HLL_REGION)) == null) {
+        RegionFactory<ByteArrayWrapper, HyperLogLogPlus> regionFactory =
+            gemFireCache.createRegionFactory(this.DEFAULT_REGION_TYPE);
+        hLLRegion = regionFactory.create(HLL_REGION);
+      }
+      if ((redisMetaData = cache.getRegion(REDIS_META_DATA_REGION)) == null) {
+        AttributesFactory af = new AttributesFactory();
+        af.addCacheListener(metaListener);
+        af.setDataPolicy(DataPolicy.REPLICATE);
+        InternalRegionArguments ira =
+            new InternalRegionArguments().setInternalRegion(true).setIsUsedForMetaRegion(true);
+        redisMetaData = gemFireCache.createVMRegion(REDIS_META_DATA_REGION, af.create(), ira);
+      }
+    } catch (IOException | ClassNotFoundException e) {
+      // only if loading snapshot, not here
+      InternalGemFireError assErr = new InternalGemFireError(
+          LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
+      assErr.initCause(e);
+      throw assErr;
+    }
+    this.regionProvider = 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);
+    checkForRegions();
+  }
+
+  private void initializeRedisServiceInternals() {
+    this.DEFAULT_REGION_TYPE = setRegionType();
+    this.numWorkerThreads = setNumWorkerThreads();
+    if (this.numWorkerThreads == 0) {
+      this.singleThreadPerConnection = true;
+    }
+    this.metaListener = new MetaCacheListener();
+    this.expirationFutures = new ConcurrentHashMap<>();
+    this.expirationExecutor =
+        Executors.newScheduledThreadPool(numExpirationThreads, new ThreadFactory() {
+          private final AtomicInteger counter = new AtomicInteger();
+
+          @Override
+          public Thread newThread(Runnable r) {
+            Thread t = new Thread(r);
+            t.setName("GemFireRedis-ScheduledExecutor-" + counter.incrementAndGet());
+            t.setDaemon(true);
+            return t;
+          }
+
+        });
+  }
+
+  private void checkForRegions() {
+    Collection<Entry<String, RedisDataType>> entrySet = this.regionProvider.metaEntrySet();
+    for (Entry<String, RedisDataType> entry : entrySet) {
+      String regionName = entry.getKey();
+      RedisDataType type = entry.getValue();
+      Region<?, ?> newRegion = cache.getRegion(regionName);
+      if (newRegion == null && type != RedisDataType.REDIS_STRING && type != RedisDataType.REDIS_HLL
+          && type != RedisDataType.REDIS_PROTECTED) {
+        try {
+          this.regionProvider
+              .createRemoteRegionReferenceLocally(Coder.stringToByteArrayWrapper(regionName), type);
+        } catch (Exception e) {
+          if (logger.isErrorEnabled()) {
+            logger.error(e);
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Helper method to start the server listening for connections. The server is bound to the port
+   * specified by {@link GeodeRedisServiceImpl#redisPort}
+   */
+  private void startRedisServer() throws IOException, InterruptedException {
+    ThreadFactory selectorThreadFactory = new ThreadFactory() {
+      private final AtomicInteger counter = new AtomicInteger();
+
+      @Override
+      public Thread newThread(Runnable r) {
+        Thread t = new Thread(r);
+        t.setName("GeodeRedisServiceImpl-SelectorThread-" + counter.incrementAndGet());
+        t.setDaemon(true);
+        return t;
+      }
+
+    };
+
+    ThreadFactory workerThreadFactory = new ThreadFactory() {
+      private final AtomicInteger counter = new AtomicInteger();
+
+      @Override
+      public Thread newThread(Runnable r) {
+        Thread t = new Thread(r);
+        t.setName("GeodeRedisServiceImpl-WorkerThread-" + counter.incrementAndGet());
+        return t;
+      }
+
+    };
+
+    bossGroup = null;
+    workerGroup = null;
+    Class<? extends ServerChannel> socketClass = null;
+    if (singleThreadPerConnection) {
+      bossGroup = new OioEventLoopGroup(Integer.MAX_VALUE, selectorThreadFactory);
+      workerGroup = new OioEventLoopGroup(Integer.MAX_VALUE, workerThreadFactory);
+      socketClass = OioServerSocketChannel.class;
+    } else {
+      bossGroup = new NioEventLoopGroup(this.numSelectorThreads, selectorThreadFactory);
+      workerGroup = new NioEventLoopGroup(this.numWorkerThreads, workerThreadFactory);
+      socketClass = NioServerSocketChannel.class;
+    }
+    InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
+    String pwd = system.getConfig().getRedisPassword();
+    final byte[] pwdB = Coder.stringToBytes(pwd);
+    ServerBootstrap b = new ServerBootstrap();
+    b.group(bossGroup, workerGroup).channel(socketClass)
+        .childHandler(new ChannelInitializer<SocketChannel>() {
+          @Override
+          public void initChannel(SocketChannel ch) throws Exception {
+            if (logger.isDebugEnabled()) {
+              logger
+                  .debug("GeodeRedisServiceImpl-Connection established with " + ch.remoteAddress());
+            }
+            ChannelPipeline p = ch.pipeline();
+            p.addLast(ByteToCommandDecoder.class.getSimpleName(), new ByteToCommandDecoder());
+            p.addLast(ExecutionHandlerContext.class.getSimpleName(), new ExecutionHandlerContext(ch,
+                cache, regionProvider, GeodeRedisServiceImpl.this, pwdB));
+          }
+        }).option(ChannelOption.SO_REUSEADDR, true).option(ChannelOption.SO_RCVBUF, getBufferSize())
+        .childOption(ChannelOption.SO_KEEPALIVE, true)
+        .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS,
+            GeodeRedisServiceImpl.connectTimeoutMillis)
+        .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
+
+    // Bind and start to accept incoming connections.
+    ChannelFuture f = b.bind(new InetSocketAddress(getRedisBindAddress(), redisPort)).sync();
+    if (this.logger.isInfoEnabled()) {
+      String logMessage = "GeodeRedisServiceImpl started {" + getRedisBindAddress() + ":"
+          + redisPort + "}, Selector threads: " + this.numSelectorThreads;
+      if (this.singleThreadPerConnection) {
+        logMessage += ", One worker thread per connection";
+      } else {
+        logMessage += ", Worker threads: " + this.numWorkerThreads;
+      }
+      this.logger.info(logMessage);
+    }
+    this.serverChannel = f.channel();
+  }
+
+  /**
+   * Takes an entry event and processes it. If the entry denotes that a
+   * {@link RedisDataType#REDIS_LIST} or {@link RedisDataType#REDIS_SORTEDSET} was created then this
+   * function will call the necessary calls to create the parameterized queries for those keys.
+   * 
+   * @param event EntryEvent from meta data region
+   */
+  private void afterKeyCreate(EntryEvent<String, RedisDataType> event) {
+    if (event.isOriginRemote()) {
+      final String key = (String) event.getKey();
+      final RedisDataType value = event.getNewValue();
+      if (value != RedisDataType.REDIS_STRING && value != RedisDataType.REDIS_HLL
+          && value != RedisDataType.REDIS_PROTECTED) {
+        try {
+          this.regionProvider
+              .createRemoteRegionReferenceLocally(Coder.stringToByteArrayWrapper(key), value);
+        } catch (RegionDestroyedException ignore) { // Region already destroyed, ignore
+        }
+      }
+    }
+  }
+
+  /**
+   * When a key is removed then this function will make sure the associated queries with the key are
+   * also removed from each vm to avoid unnecessary data retention
+   */
+  private void afterKeyDestroy(EntryEvent<String, RedisDataType> event) {
+    if (event.isOriginRemote()) {
+      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) {
+        ByteArrayWrapper kW = Coder.stringToByteArrayWrapper(key);
+        Region<?, ?> r = this.regionProvider.getRegion(kW);
+        if (r != null) {
+          this.regionProvider.removeRegionReferenceLocally(kW, value);
+        }
+      }
+    }
+  }
+
+  @Override
+  public void init(Cache cache) {
+    this.cache = cache;
+    logger = LogService.getLogger();
+
+    InternalDistributedSystem internalDistributedSystem = ((GemFireCacheImpl) cache).getSystem();
+    DistributionConfig internalDistributedSystemConfig = internalDistributedSystem.getConfig();
+    this.redisPort = internalDistributedSystemConfig.getRedisPort();
+    if (redisPort <= 0) { // unset
+      this.redisPort = DEFAULT_REDIS_SERVER_PORT;
+    }
+    this.redisBindAddress = internalDistributedSystemConfig.getRedisBindAddress();
+  }
+
+  @Override
+  public Class<? extends CacheService> getInterface() {
+    return GeodeRedisService.class;
+  }
+
+  @Override
+  public CacheServiceMBeanBase getMBean() {
+    // TODO This needs to be implemented in the GEODE-2449
+    throw new RuntimeException("This still needs to be implemented");
+  }
+
+  private final class MetaCacheListener extends CacheListenerAdapter<String, RedisDataType> {
+
+    @Override
+    public void afterCreate(EntryEvent<String, RedisDataType> event) {
+      afterKeyCreate(event);
+    }
+
+    @Override
+    public void afterDestroy(EntryEvent<String, RedisDataType> event) {
+      afterKeyDestroy(event);
+    }
+  }
+
+  /**
+   * Helper method to get GemFire set socket buffer size, possibly a default of 32k
+   * 
+   * @return Buffer size to use for server
+   */
+  private int getBufferSize() {
+    InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
+    return system.getConfig().getSocketBufferSize();
+  }
+
+  /**
+   * Shutdown method for {@link GeodeRedisServiceImpl}. This closes the {@link Cache}, interrupts
+   * all execution and forcefully closes all connections.
+   */
+  @Override
+  public void stop() {
+    if (!shutdown) {
+      if (logger.isInfoEnabled()) {
+        logger.info("GeodeRedisServiceImpl shutting down");
+      }
+
+      Future<?> workerGroupFuture = workerGroup.shutdownGracefully(0,1, TimeUnit.SECONDS);
+      Future<?> bossGroupFuture = bossGroup.shutdownGracefully(0,1,TimeUnit.SECONDS);
+      ChannelFuture closeFuture = this.serverChannel.close();
+
+      // We are likely brought here by a channel read reading a shutdown message, in which case calling
+      // await or sync can cause a deadlock.
+//      workerGroupFuture.syncUninterruptibly();
+//      bossGroupFuture.syncUninterruptibly();
+      this.regionProvider.close();
+      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/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java
new file mode 100644
index 0000000..5b895e8
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import org.apache.geode.DataSerializable;
+import org.apache.geode.DataSerializer;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * This class is a wrapper for the any Regions that need to store a byte[]. The only data this an
+ * instance will store is a byte[] for the data but it is also serializable and comparable so it is
+ * able to be used in querying
+ * 
+ *
+ */
+public class ByteArrayWrapper implements DataSerializable, Comparable<ByteArrayWrapper> {
+  /**
+   * Generated serialVerionUID
+   */
+  private static final long serialVersionUID = 9066391742266642992L;
+
+  /**
+   * The data portion of ValueWrapper
+   */
+  private byte[] value;
+
+  /**
+   * Hash of {@link #value}, this value is cached for performance
+   */
+  private transient int hashCode;
+
+  private transient String toString;
+
+  /**
+   * Empty constructor for serialization
+   */
+  public ByteArrayWrapper() {}
+
+  /**
+   * Default constructor constructs a ValueWrapper and initialize the {@link #value}
+   * 
+   * @param value
+   */
+  public ByteArrayWrapper(byte[] value) {
+    this.value = value;
+    this.hashCode = Arrays.hashCode(value);
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    DataSerializer.writeByteArray(value, out);
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    this.value = DataSerializer.readByteArray(in);;
+    this.hashCode = Arrays.hashCode(this.value);
+  }
+
+  @Override
+  public String toString() {
+    if (toString == null)
+      toString = Coder.bytesToString(this.value);
+    return toString;
+  }
+
+  public byte[] toBytes() {
+    return this.value;
+  }
+
+  public void setBytes(byte[] bytes) {
+    this.value = bytes;
+    this.toString = null;
+    this.hashCode = Arrays.hashCode(bytes);
+  }
+
+  /**
+   * Getter for the length of the {@link #value} array
+   * 
+   * @return The length of the value array
+   */
+  public int length() {
+    return value.length;
+  }
+
+  /**
+   * Hash code for byte[] wrapped by this object, the actual hashcode is determined by
+   * Arrays.hashCode(byte[])
+   */
+  @Override
+  public int hashCode() {
+    return this.hashCode;
+  }
+
+
+  /**
+   * This equals is neither symmetric and therefore not transitive, because a String with the same
+   * underlying bytes is considered equal. Clearly calling {@link String#equals(Object)} would not
+   * yield the same result
+   */
+  @Override
+  public boolean equals(Object other) {
+    if (other instanceof ByteArrayWrapper)
+      return Arrays.equals(value, ((ByteArrayWrapper) other).value);
+    else if (other instanceof String) {
+      return Arrays.equals(value, Coder.stringToBytes((String) other));
+    }
+    return false;
+  }
+
+  /**
+   * This is a byte to byte comparator, it is not lexicographical but purely compares byte by byte
+   * values
+   */
+  @Override
+  public int compareTo(ByteArrayWrapper other) {
+    return arrayCmp(value, other.value);
+
+  }
+
+  /**
+   * Private helper method to compare two byte arrays, A.compareTo(B). The comparison is basically
+   * numerical, for each byte index, the byte representing the greater value will be the greater
+   * 
+   * @param A byte[]
+   * @param B byte[]
+   * @return 1 if A > B, -1 if B > A, 0 if A == B
+   */
+  private int arrayCmp(byte[] A, byte[] B) {
+    if (A == B)
+      return 0;
+    if (A == null) {
+      return -1;
+    } else if (B == null) {
+      return 1;
+    }
+
+    int len = Math.min(A.length, B.length);
+
+    for (int i = 0; i < len; i++) {
+      byte a = A[i];
+      byte b = B[i];
+      int diff = a - b;
+      if (diff > 0)
+        return 1;
+      else if (diff < 0)
+        return -1;
+    }
+
+    if (A.length > B.length)
+      return 1;
+    else if (B.length > A.length)
+      return -1;
+
+    return 0;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java
new file mode 100644
index 0000000..4f66a47
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This is the first part of the channel pipeline for Netty. Here incoming bytes are read and a
+ * created {@link Command} is sent down the pipeline. It is unfortunate that this class is not
+ * {@link Sharable} because no state is kept in this class. State is kept by
+ * {@link ByteToMessageDecoder}, it may be worthwhile to look at a different decoder setup as to
+ * avoid allocating a decoder for every new connection.
+ * <p>
+ * The code flow of the protocol parsing may not be exactly Java like, but this is done very
+ * intentionally. It was found that in cases where large Redis requests are sent that end up being
+ * fragmented, throwing exceptions when the command could not be fully parsed took up an enormous
+ * amount of cpu time. The simplicity of the Redis protocol allows us to just back out and wait for
+ * more data, while exceptions are left to malformed requests which should never happen if using a
+ * proper Redis client.
+ * 
+ *
+ */
+public class ByteToCommandDecoder extends ByteToMessageDecoder {
+
+  /**
+   * Important note
+   * 
+   * Do not use '' <-- java primitive chars. Redis uses {@link Coder#CHARSET} encoding so we should
+   * not risk java handling char to byte conversions, rather just hard code {@link Coder#CHARSET}
+   * chars as bytes
+   */
+
+  private static final byte rID = 13; // '\r';
+  private static final byte nID = 10; // '\n';
+  private static final byte bulkStringID = 36; // '$';
+  private static final byte arrayID = 42; // '*';
+  private static final int MAX_BULK_STRING_LENGTH = 512 * 1024 * 1024; // 512 MB
+
+  public ByteToCommandDecoder() {}
+
+  @Override
+  protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
+    Command c = null;
+    do {
+      in.markReaderIndex();
+      c = parse(in);
+      if (c == null) {
+        in.resetReaderIndex();
+        return;
+      }
+      out.add(c);
+    } while (in.isReadable()); // Try to take advantage of pipelining if it is being used
+  }
+
+  private Command parse(ByteBuf buffer) throws RedisCommandParserException {
+    if (buffer == null)
+      throw new NullPointerException();
+    if (!buffer.isReadable())
+      return null;
+
+    byte firstB = buffer.readByte();
+    if (firstB != arrayID)
+      throw new RedisCommandParserException(
+          "Expected: " + (char) arrayID + " Actual: " + (char) firstB);
+    ArrayList<byte[]> commandElems = new ArrayList<byte[]>();
+
+    if (!parseArray(commandElems, buffer))
+      return null;
+
+    return new Command(commandElems);
+  }
+
+  private boolean parseArray(ArrayList<byte[]> commandElems, ByteBuf buffer)
+      throws RedisCommandParserException {
+    byte currentChar;
+    int arrayLength = parseCurrentNumber(buffer);
+    if (arrayLength == Integer.MIN_VALUE || !parseRN(buffer))
+      return false;
+    if (arrayLength < 0 || arrayLength > 1000000000)
+      throw new RedisCommandParserException("invalid multibulk length");
+
+    for (int i = 0; i < arrayLength; i++) {
+      if (!buffer.isReadable())
+        return false;
+      currentChar = buffer.readByte();
+      if (currentChar == bulkStringID) {
+        byte[] newBulkString = parseBulkString(buffer);
+        if (newBulkString == null)
+          return false;
+        commandElems.add(newBulkString);
+      } else
+        throw new RedisCommandParserException(
+            "expected: \'$\', got \'" + (char) currentChar + "\'");
+    }
+    return true;
+  }
+
+  /**
+   * Helper method to parse a bulk string when one is seen
+   * 
+   * @param buffer Buffer to read from
+   * @return byte[] representation of the Bulk String read
+   * @throws RedisCommandParserException Thrown when there is illegal syntax
+   */
+  private byte[] parseBulkString(ByteBuf buffer) throws RedisCommandParserException {
+    int bulkStringLength = parseCurrentNumber(buffer);
+    if (bulkStringLength == Integer.MIN_VALUE)
+      return null;
+    if (bulkStringLength > MAX_BULK_STRING_LENGTH)
+      throw new RedisCommandParserException(
+          "invalid bulk length, cannot exceed max length of " + MAX_BULK_STRING_LENGTH);
+    if (!parseRN(buffer))
+      return null;
+
+    if (!buffer.isReadable(bulkStringLength))
+      return null;
+    byte[] bulkString = new byte[bulkStringLength];
+    buffer.readBytes(bulkString);
+
+    if (!parseRN(buffer))
+      return null;
+
+    return bulkString;
+  }
+
+  /**
+   * Helper method to parse the number at the beginning of the buffer
+   * 
+   * @param buffer Buffer to read
+   * @return The number found at the beginning of the buffer
+   */
+  private int parseCurrentNumber(ByteBuf buffer) {
+    int number = 0;
+    int readerIndex = buffer.readerIndex();
+    byte b = 0;
+    while (true) {
+      if (!buffer.isReadable())
+        return Integer.MIN_VALUE;
+      b = buffer.readByte();
+      if (Character.isDigit(b)) {
+        number = number * 10 + (int) (b - '0');
+        readerIndex++;
+      } else {
+        buffer.readerIndex(readerIndex);
+        break;
+      }
+    }
+    return number;
+  }
+
+  /**
+   * Helper method that is called when the next characters are supposed to be "\r\n"
+   * 
+   * @param buffer Buffer to read from
+   * @throws RedisCommandParserException Thrown when the next two characters are not "\r\n"
+   */
+  private boolean parseRN(ByteBuf buffer) throws RedisCommandParserException {
+    if (!buffer.isReadable(2))
+      return false;
+    byte b = buffer.readByte();
+    if (b != rID)
+      throw new RedisCommandParserException(
+          "expected \'" + (char) rID + "\', got \'" + (char) b + "\'");
+    b = buffer.readByte();
+    if (b != nID)
+      throw new RedisCommandParserException(
+          "expected: \'" + (char) nID + "\', got \'" + (char) b + "\'");
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/Command.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/Command.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/Command.java
new file mode 100644
index 0000000..2f91218
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/Command.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import io.netty.buffer.ByteBuf;
+
+import java.nio.channels.SocketChannel;
+import java.util.List;
+
+/**
+ * The command class is used in holding a received Redis command. Each sent command resides in an
+ * instance of this class. This class is designed to be used strictly by getter and setter methods.
+ * 
+ *
+ */
+public class Command {
+
+  private final List<byte[]> commandElems;
+  private final RedisCommandType commandType;
+  private ByteBuf response;
+  private String key;
+  private ByteArrayWrapper bytes;
+
+  /**
+   * Constructor for {@link Command}. Must initialize Command with a {@link SocketChannel} and a
+   * {@link List} of command elements
+   * 
+   * @param commandElems List of elements in command
+   */
+  public Command(List<byte[]> commandElems) {
+    if (commandElems == null || commandElems.isEmpty())
+      throw new IllegalArgumentException(
+          "List of command elements cannot be empty -> List:" + commandElems);
+    this.commandElems = commandElems;
+    this.response = null;
+
+    RedisCommandType type;
+
+    try {
+      byte[] charCommand = commandElems.get(0);
+      String commandName = Coder.bytesToString(charCommand).toUpperCase();
+      type = RedisCommandType.valueOf(commandName);
+    } catch (Exception e) {
+      type = RedisCommandType.UNKNOWN;
+    }
+    this.commandType = type;
+
+  }
+
+  /**
+   * Used to get the command element list
+   * 
+   * @return List of command elements in form of {@link List}
+   */
+  public List<byte[]> getProcessedCommand() {
+    return this.commandElems;
+  }
+
+  /**
+   * Getter method for the command type
+   * 
+   * @return The command type
+   */
+  public RedisCommandType getCommandType() {
+    return this.commandType;
+  }
+
+  /**
+   * Getter method to get the response to be sent
+   * 
+   * @return The response
+   */
+  public ByteBuf getResponse() {
+    return response;
+  }
+
+  /**
+   * Setter method to set the response to be sent
+   * 
+   * @param response The response to be sent
+   */
+  public void setResponse(ByteBuf response) {
+    this.response = response;
+  }
+
+  public boolean hasError() {
+    if (response == null)
+      return false;
+
+    if (response.getByte(0) == Coder.ERROR_ID)
+      return true;
+
+    return false;
+  }
+
+  /**
+   * Convenience method to get a String representation of the key in a Redis command, always at the
+   * second position in the sent command array
+   * 
+   * @return Returns the second element in the parsed command list, which is always the key for
+   *         commands indicating a key
+   */
+  public String getStringKey() {
+    if (this.commandElems.size() > 1) {
+      if (this.bytes == null) {
+        this.bytes = new ByteArrayWrapper(this.commandElems.get(1));
+        this.key = this.bytes.toString();
+      } else if (this.key == null)
+        this.key = this.bytes.toString();
+      return this.key;
+    } else
+      return null;
+  }
+
+  public ByteArrayWrapper getKey() {
+    if (this.commandElems.size() > 1) {
+      if (this.bytes == null)
+        this.bytes = new ByteArrayWrapper(this.commandElems.get(1));
+      return this.bytes;
+    } else
+      return null;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder b = new StringBuilder();
+    for (byte[] bs : this.commandElems) {
+      b.append(Coder.bytesToString(bs));
+      b.append(' ');
+    }
+    return b.toString();
+  }
+}


[18/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
deleted file mode 100755
index acacd12..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandType.java
+++ /dev/null
@@ -1,2896 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.redis.internal;
-
-import org.apache.geode.redis.internal.executor.AuthExecutor;
-import org.apache.geode.redis.internal.executor.DBSizeExecutor;
-import org.apache.geode.redis.internal.executor.DelExecutor;
-import org.apache.geode.redis.internal.executor.EchoExecutor;
-import org.apache.geode.redis.internal.executor.ExistsExecutor;
-import org.apache.geode.redis.internal.executor.ExpireAtExecutor;
-import org.apache.geode.redis.internal.executor.ExpireExecutor;
-import org.apache.geode.redis.internal.executor.FlushAllExecutor;
-import org.apache.geode.redis.internal.executor.KeysExecutor;
-import org.apache.geode.redis.internal.executor.PExpireAtExecutor;
-import org.apache.geode.redis.internal.executor.PExpireExecutor;
-import org.apache.geode.redis.internal.executor.PTTLExecutor;
-import org.apache.geode.redis.internal.executor.PersistExecutor;
-import org.apache.geode.redis.internal.executor.PingExecutor;
-import org.apache.geode.redis.internal.executor.QuitExecutor;
-import org.apache.geode.redis.internal.executor.ScanExecutor;
-import org.apache.geode.redis.internal.executor.ShutDownExecutor;
-import org.apache.geode.redis.internal.executor.TTLExecutor;
-import org.apache.geode.redis.internal.executor.TimeExecutor;
-import org.apache.geode.redis.internal.executor.TypeExecutor;
-import org.apache.geode.redis.internal.executor.UnkownExecutor;
-import org.apache.geode.redis.internal.executor.hash.HDelExecutor;
-import org.apache.geode.redis.internal.executor.hash.HExistsExecutor;
-import org.apache.geode.redis.internal.executor.hash.HGetAllExecutor;
-import org.apache.geode.redis.internal.executor.hash.HGetExecutor;
-import org.apache.geode.redis.internal.executor.hash.HIncrByExecutor;
-import org.apache.geode.redis.internal.executor.hash.HIncrByFloatExecutor;
-import org.apache.geode.redis.internal.executor.hash.HKeysExecutor;
-import org.apache.geode.redis.internal.executor.hash.HLenExecutor;
-import org.apache.geode.redis.internal.executor.hash.HMGetExecutor;
-import org.apache.geode.redis.internal.executor.hash.HMSetExecutor;
-import org.apache.geode.redis.internal.executor.hash.HScanExecutor;
-import org.apache.geode.redis.internal.executor.hash.HSetExecutor;
-import org.apache.geode.redis.internal.executor.hash.HSetNXExecutor;
-import org.apache.geode.redis.internal.executor.hash.HValsExecutor;
-import org.apache.geode.redis.internal.executor.hll.PFAddExecutor;
-import org.apache.geode.redis.internal.executor.hll.PFCountExecutor;
-import org.apache.geode.redis.internal.executor.hll.PFMergeExecutor;
-import org.apache.geode.redis.internal.executor.list.LIndexExecutor;
-import org.apache.geode.redis.internal.executor.list.LInsertExecutor;
-import org.apache.geode.redis.internal.executor.list.LLenExecutor;
-import org.apache.geode.redis.internal.executor.list.LPopExecutor;
-import org.apache.geode.redis.internal.executor.list.LPushExecutor;
-import org.apache.geode.redis.internal.executor.list.LPushXExecutor;
-import org.apache.geode.redis.internal.executor.list.LRangeExecutor;
-import org.apache.geode.redis.internal.executor.list.LRemExecutor;
-import org.apache.geode.redis.internal.executor.list.LSetExecutor;
-import org.apache.geode.redis.internal.executor.list.LTrimExecutor;
-import org.apache.geode.redis.internal.executor.list.RPopExecutor;
-import org.apache.geode.redis.internal.executor.list.RPushExecutor;
-import org.apache.geode.redis.internal.executor.list.RPushXExecutor;
-import org.apache.geode.redis.internal.executor.set.SAddExecutor;
-import org.apache.geode.redis.internal.executor.set.SCardExecutor;
-import org.apache.geode.redis.internal.executor.set.SDiffExecutor;
-import org.apache.geode.redis.internal.executor.set.SDiffStoreExecutor;
-import org.apache.geode.redis.internal.executor.set.SInterExecutor;
-import org.apache.geode.redis.internal.executor.set.SInterStoreExecutor;
-import org.apache.geode.redis.internal.executor.set.SIsMemberExecutor;
-import org.apache.geode.redis.internal.executor.set.SMembersExecutor;
-import org.apache.geode.redis.internal.executor.set.SMoveExecutor;
-import org.apache.geode.redis.internal.executor.set.SPopExecutor;
-import org.apache.geode.redis.internal.executor.set.SRandMemberExecutor;
-import org.apache.geode.redis.internal.executor.set.SRemExecutor;
-import org.apache.geode.redis.internal.executor.set.SScanExecutor;
-import org.apache.geode.redis.internal.executor.set.SUnionExecutor;
-import org.apache.geode.redis.internal.executor.set.SUnionStoreExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZAddExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZCardExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZCountExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZIncrByExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZLexCountExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRangeByLexExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRangeByScoreExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRangeExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRankExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRemExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRemRangeByLexExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRemRangeByRankExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRemRangeByScoreExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRevRangeByScoreExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRevRangeExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZRevRankExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZScanExecutor;
-import org.apache.geode.redis.internal.executor.sortedset.ZScoreExecutor;
-import org.apache.geode.redis.internal.executor.string.AppendExecutor;
-import org.apache.geode.redis.internal.executor.string.BitCountExecutor;
-import org.apache.geode.redis.internal.executor.string.BitOpExecutor;
-import org.apache.geode.redis.internal.executor.string.BitPosExecutor;
-import org.apache.geode.redis.internal.executor.string.DecrByExecutor;
-import org.apache.geode.redis.internal.executor.string.DecrExecutor;
-import org.apache.geode.redis.internal.executor.string.GetBitExecutor;
-import org.apache.geode.redis.internal.executor.string.GetExecutor;
-import org.apache.geode.redis.internal.executor.string.GetRangeExecutor;
-import org.apache.geode.redis.internal.executor.string.GetSetExecutor;
-import org.apache.geode.redis.internal.executor.string.IncrByExecutor;
-import org.apache.geode.redis.internal.executor.string.IncrByFloatExecutor;
-import org.apache.geode.redis.internal.executor.string.IncrExecutor;
-import org.apache.geode.redis.internal.executor.string.MGetExecutor;
-import org.apache.geode.redis.internal.executor.string.MSetExecutor;
-import org.apache.geode.redis.internal.executor.string.MSetNXExecutor;
-import org.apache.geode.redis.internal.executor.string.PSetEXExecutor;
-import org.apache.geode.redis.internal.executor.string.SetBitExecutor;
-import org.apache.geode.redis.internal.executor.string.SetEXExecutor;
-import org.apache.geode.redis.internal.executor.string.SetExecutor;
-import org.apache.geode.redis.internal.executor.string.SetNXExecutor;
-import org.apache.geode.redis.internal.executor.string.SetRangeExecutor;
-import org.apache.geode.redis.internal.executor.string.StrlenExecutor;
-import org.apache.geode.redis.internal.executor.transactions.DiscardExecutor;
-import org.apache.geode.redis.internal.executor.transactions.ExecExecutor;
-import org.apache.geode.redis.internal.executor.transactions.MultiExecutor;
-import org.apache.geode.redis.internal.executor.transactions.UnwatchExecutor;
-import org.apache.geode.redis.internal.executor.transactions.WatchExecutor;
-
-/**
- * The redis command type used by the server. Each command is directly from the redis protocol and
- * calling {@link #getExecutor()} on a type returns the executor class for that command.
- * 
- *
- */
-public enum RedisCommandType {
-
-  /***************************************
-   *************** Keys ******************
-   ***************************************/
-
-  /**
-   * AUTH password
-   * <p>
-   * Authenticate to the server
-   */
-  AUTH {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new AuthExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * DEL key [key ...]
-   * <p>
-   * Delete a key
-   */
-  DEL {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new DelExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * EXISTS key
-   * <p>
-   * Determine if a key exists
-   */
-  EXISTS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ExistsExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * EXPIRE key seconds
-   * <p>
-   * Set a key's time to live in seconds
-   */
-  EXPIRE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ExpireExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * EXPIREAT key timestamp
-   * <p>
-   * Set the expiration for a key as a UNIX timestamp
-   */
-  EXPIREAT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ExpireAtExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * FLUSHALL
-   * <p>
-   * Remove all keys from all databases
-   */
-  FLUSHALL {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new FlushAllExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * FLUSHDB
-   * <p>
-   * Remove all keys from the current database
-   * <p>
-   * Same as FLUSHALL for this implementation
-   */
-  FLUSHDB {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new FlushAllExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * KEYS pattern
-   * <p>
-   * Find all keys matching the given pattern
-   */
-  KEYS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new KeysExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PERSIST key
-   * <p>
-   * Remove the expiration from a key
-   */
-  PERSIST {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PersistExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PEXPIRE key milliseconds
-   * <p>
-   * Set a key's time to live in milliseconds
-   */
-  PEXPIRE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PExpireExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PEXPIREAT key milliseconds-timestamp
-   * <p>
-   * Set the expiration for a key as a UNIX timestamp specified in milliseconds
-   */
-  PEXPIREAT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PExpireAtExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PTTL key
-   * <p>
-   * Get the time to live for a key in milliseconds
-   */
-  PTTL {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PTTLExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SCAN cursor [MATCH pattern] [COUNT count]
-   * <p>
-   * Incrementally iterate the keys space
-   */
-  SCAN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ScanExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * TTL key
-   * <p>
-   * Get the time to live for a key
-   */
-  TTL {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new TTLExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * TYPE key
-   * <p>
-   * Determine the type stored at key
-   */
-  TYPE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new TypeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   ************** Strings ****************
-   ***************************************/
-
-  /**
-   * APPEND key value
-   * <p>
-   * Append a value to a key
-   */
-  APPEND {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new AppendExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * BITCOUNT key start end [start end ...]
-   * <p>
-   * Count set bits in a string
-   */
-  BITCOUNT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new BitCountExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * BITOP operation destkey key [key ...]
-   * <p>
-   * Perform bitwise operations between strings
-   */
-  BITOP {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new BitOpExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * BITPOS key bit [start] [end]
-   * <p>
-   * Find first bit set or clear in a string
-   */
-  BITPOS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new BitPosExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * DECR key
-   * <p>
-   * Decrement the integer value of a key by one
-   */
-  DECR {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new DecrExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * DECRBY key decrement
-   * <p>
-   * Decrement the integer value of a key by the given number
-   */
-  DECRBY {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new DecrByExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * GET key
-   * <p>
-   * Get the value of a key
-   */
-  GET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new GetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * GETBIT key offset
-   * <p>
-   * Returns the bit value at offset in the string value stored at key
-   */
-  GETBIT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new GetBitExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * GETRANGE key start end
-   * <p>
-   * Get a substring of the string stored at a key
-   */
-  GETRANGE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new GetRangeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * GETSET key value
-   * <p>
-   * Set the string value of a key and return its old value
-   */
-  GETSET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new GetSetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * INCR key
-   * <p>
-   * Increment the integer value of a key by one
-   */
-  INCR {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new IncrExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * INCRBY key increment
-   * <p>
-   * Increment the integer value of a key by the given amount
-   */
-  INCRBY {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new IncrByExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * INCRBYFLOAT key increment
-   * <p>
-   * Increment the float value of a key by the given amount
-   */
-  INCRBYFLOAT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new IncrByFloatExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * MGET key [key ...]
-   * <p>
-   * Get the values of all the given keys
-   */
-  MGET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new MGetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * MSET key value [key value ...]
-   * <p>
-   * Set multiple keys to multiple values
-   */
-  MSET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new MSetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * MSETNX key value [key value ...]
-   * <p>
-   * Set multiple keys to multiple values, only if none of the keys exist
-   */
-  MSETNX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new MSetNXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PSETEX key milliseconds value
-   * <p>
-   * Set the value and expiration in milliseconds of a key
-   */
-  PSETEX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PSetEXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SETEX key seconds value
-   * <p>
-   * Set the value and expiration of a key
-   */
-  SETEX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SetEXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SET key value [EX seconds] [PX milliseconds] [NX|XX]
-   * <p>
-   * Set the string value of a key
-   */
-  SET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SETBIT key offset value
-   * <P>
-   * Sets or clears the bit at offset in the string value stored at key
-   */
-  SETBIT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SetBitExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SETNX key value
-   * <p>
-   * Set the value of a key, only if the key does not exist
-   */
-  SETNX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SetNXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SETRANGE key offset value
-   * <p>
-   * Overwrite part of a string at key starting at the specified offset
-   */
-  SETRANGE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SetRangeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * STRLEN key
-   * <p>
-   * Get the length of the value stored in a key
-   */
-  STRLEN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new StrlenExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_STRING;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   **************** Hashes ***************
-   ***************************************/
-  /**
-   * HDEL key field [field ...]
-   * <p>
-   * Delete one or more hash fields
-   */
-  HDEL {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HDelExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HEXISTS key field
-   * <p>
-   * Determine if a hash field exists
-   */
-  HEXISTS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HExistsExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HGET key field
-   * <p>
-   * Get the value of a hash field
-   */
-  HGET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HGetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HGETALL key
-   * <p>
-   * Get all the fields and values in a hash
-   */
-  HGETALL {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HGetAllExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HINCRBY key field increment
-   * <p>
-   * Increment the integer value of a hash field by the given number
-   */
-  HINCRBY {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HIncrByExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HINCRBYFLOAT key field increment
-   * <p>
-   * Increment the float value of a hash field by the given amount
-   */
-  HINCRBYFLOAT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HIncrByFloatExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HKEYS key
-   * <p>
-   * Get all the fields in a hash
-   */
-  HKEYS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HKeysExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HLEN key
-   * <p>
-   * Get the number of fields in a hash
-   */
-  HLEN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HLenExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HMGET key field [field ...]
-   * <p>
-   * Get the values of all the given hash fields
-   */
-  HMGET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HMGetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HMSET key field value [field value ...]
-   * <p>
-   * Set multiple hash fields to multiple values
-   */
-  HMSET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HMSetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HSCAN key cursor [MATCH pattern] [COUNT count]
-   * <p>
-   * Incrementally iterate hash fields and associated values
-   */
-  HSCAN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HScanExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HSET key field value
-   * <p>
-   * Set the string value of a hash field
-   */
-  HSET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HSetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HSETNX key field value
-   * <p>
-   * Set the value of a hash field, only if the field does not exist
-   */
-  HSETNX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HSetNXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * HVALS key
-   * <p>
-   * Get all the values in a hash
-   */
-  HVALS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new HValsExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HASH;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   *********** HyperLogLogs **************
-   ***************************************/
-
-  /**
-   * PFADD key element [element ...]
-   * <p>
-   * Adds the specified elements to the specified HyperLogLog
-   */
-  PFADD {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PFAddExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HLL;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PFCOUNT key [key ...]
-   * <p>
-   * Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s)
-   */
-  PFCOUNT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PFCountExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HLL;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PFMERGE destkey sourcekey [sourcekey ...]
-   * <p>
-   * Merge N different HyperLogLogs into a single one
-   */
-  PFMERGE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PFMergeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_HLL;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   *************** Lists *****************
-   ***************************************/
-
-  /**
-   * LINDEX key index
-   * <p>
-   * Get an element from a list by its index
-   */
-  LINDEX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LIndexExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LINSERT key BEFORE|AFTER pivot value
-   * <p>
-   * Insert an element before or after another element in a list
-   */
-  LINSERT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LInsertExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LLEN key
-   * <p>
-   * Get the length of a list
-   */
-  LLEN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LLenExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LPOP key
-   * <p>
-   * Remove and get the first element in a list
-   */
-  LPOP {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LPopExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LPUSH key value [value ...]
-   * <p>
-   * Prepend one or multiple values to a list
-   */
-  LPUSH {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LPushExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LPUSHX key value
-   * <p>
-   * Prepend a value to a list, only if the list exists
-   */
-  LPUSHX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LPushXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LRANGE key start stop
-   * <p>
-   * Get a range of elements from a list
-   */
-  LRANGE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LRangeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LREM key count value
-   * <p>
-   * Remove elements from a list
-   */
-  LREM {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LRemExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LSET key index value
-   * <p>
-   * Set the value of an element in a list by its index
-   */
-  LSET {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LSetExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * LTRIM key start stop
-   * <p>
-   * Trim a list to the specified range
-   */
-  LTRIM {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new LTrimExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * RPOP key
-   * <p>
-   * Remove and get the last element in a list
-   */
-  RPOP {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new RPopExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * RPUSH key value [value ...]
-   * <p>
-   * Append one or multiple values to a list
-   */
-  RPUSH {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new RPushExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * RPUSHX key value
-   * <p>
-   * Append a value to a list, only if the list exists
-   */
-  RPUSHX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new RPushXExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_LIST;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   **************** Sets *****************
-   ***************************************/
-
-  /**
-   * SADD key member [member ...]
-   * <p>
-   * Add one or more members to a set
-   */
-  SADD {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SAddExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SCARD key
-   * <p>
-   * Get the number of members in a set
-   */
-  SCARD {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SCardExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SDIFF key [key ...]
-   * <p>
-   * Subtract multiple sets
-   */
-  SDIFF {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SDiffExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SDIFFSTORE destination key [key ...]
-   * <p>
-   * Subtract multiple sets and store the resulting set in a key
-   */
-  SDIFFSTORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SDiffStoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SISMEMBER key member
-   * <p>
-   * Determine if a given value is a member of a set
-   */
-  SISMEMBER {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SIsMemberExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SINTER key [key ...]
-   * <p>
-   * Intersect multiple sets
-   */
-  SINTER {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SInterExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SINTERSTORE destination key [key ...]
-   * <p>
-   * Intersect multiple sets and store the resulting set in a key
-   */
-  SINTERSTORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SInterStoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SMEMBERS key
-   * <p>
-   * Get all the members in a set
-   */
-  SMEMBERS {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SMembersExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SMOVE source destination member
-   * <p>
-   * Move a member from one set to another
-   */
-  SMOVE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SMoveExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SPOP key
-   * <p>
-   * Remove and return a random member from a set
-   */
-  SPOP {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SPopExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SRANDMEMBER key [count]
-   * <p>
-   * Get one or multiple random members from a set
-   */
-  SRANDMEMBER {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SRandMemberExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SUNION key [key ...]
-   * <p>
-   * Add multiple sets
-   */
-  SUNION {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SUnionExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SUNIONSTORE destination key [key ...]
-   * <p>
-   * Add multiple sets and store the resulting set in a key
-   */
-  SUNIONSTORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SUnionStoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SSCAN key cursor [MATCH pattern] [COUNT count]
-   * <p>
-   * Incrementally iterate Set elements
-   */
-  SSCAN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SScanExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SREM key member [member ...]
-   * <p>
-   * Remove one or more members from a set
-   */
-  SREM {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new SRemExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   ************* Sorted Sets *************
-   ***************************************/
-
-  /**
-   * ZADD key score member [score member ...]
-   * <p>
-   * Add one or more members to a sorted set, or update its score if it already exists
-   */
-  ZADD {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZAddExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZCARD key
-   * <p>
-   * Get the number of members in a sorted set
-   */
-  ZCARD {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZCardExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZCOUNT key min max
-   * <p>
-   * Count the members in a sorted set with scores within the given values
-   */
-  ZCOUNT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZCountExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZINCRBY key increment member
-   * <p>
-   * Increment the score of a member in a sorted set
-   */
-  ZINCRBY {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZIncrByExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZLEXCOUNT key min max
-   * <p>
-   * Count the number of members in a sorted set between a given lexicographical range
-   */
-  ZLEXCOUNT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZLexCountExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZRANGE key start stop [WITHSCORES]
-   * <p>
-   * Return a range of members in a sorted set, by index
-   */
-  ZRANGE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRangeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZRANGEBYLEX key min max [LIMIT offset count]
-   * <p>
-   * Return a range of members in a sorted set, by lexicographical range
-   */
-  ZRANGEBYLEX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRangeByLexExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
-   * <p>
-   * Return a range of members in a sorted set, by score
-   */
-  ZRANGEBYSCORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRangeByScoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREVRANGE key start stop [WITHSCORES]
-   * <p>
-   * Return a range of members in a sorted set, by index, with scores ordered from high to low
-   */
-  ZREVRANGE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRevRangeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZRANK key member
-   * <p>
-   * Determine the index of a member in a sorted set
-   */
-  ZRANK {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRankExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREM key member [member ...]
-   * <p>
-   * Remove one or more members from a sorted set
-   */
-  ZREM {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRemExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREMRANGEBYLEX key min max
-   * <p>
-   * Remove all members in a sorted set between the given lexicographical range
-   */
-  ZREMRANGEBYLEX {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRemRangeByLexExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREMRANGEBYRANK key start stop
-   * <p>
-   * Remove all members in a sorted set within the given indexes
-   */
-  ZREMRANGEBYRANK {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRemRangeByRankExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREMRANGEBYSCORE key min max
-   * <p>
-   * Remove all members in a sorted set within the given scores
-   */
-  ZREMRANGEBYSCORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRemRangeByScoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]
-   * <p>
-   * Return a range of members in a sorted set, by score, with scores ordered from high to low
-   */
-  ZREVRANGEBYSCORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRevRangeByScoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZREVRANK key member
-   * <p>
-   * Determine the index of a member in a sorted set, with scores ordered from high to low
-   */
-  ZREVRANK {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZRevRankExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZSCAN key cursor [MATCH pattern] [COUNT count]
-   * <P>
-   * Incrementally iterate sorted sets elements and associated scores
-   */
-  ZSCAN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZScanExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ZSCORE key member
-   * <p>
-   * Get the score associated with the given member in a sorted set
-   */
-  ZSCORE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ZScoreExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.REDIS_SORTEDSET;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   ************ Transactions *************
-   ***************************************/
-
-  /**
-   * DISCARD
-   * <p>
-   * Discard all commands issued after MULTI
-   */
-  DISCARD {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new DiscardExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * EXEC
-   * <p>
-   * Execute all commands issued after MULTI
-   */
-  EXEC {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ExecExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * MULTI
-   * <p>
-   * Mark the start of a transaction block
-   */
-  MULTI {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new MultiExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * UNWATCH
-   * <p>
-   * Forget about all watched keys
-   */
-  UNWATCH {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new UnwatchExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * WATCH key [key ...]
-   * <p>
-   * Watch the given keys to determine execution of the MULTI/EXEC block
-   */
-  WATCH {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new WatchExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /***************************************
-   *************** Server ****************
-   ***************************************/
-
-  /**
-   * DBSIZE
-   * <p>
-   * Return the number of keys in the selected database
-   */
-  DBSIZE {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new DBSizeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * ECHO message
-   * <p>
-   * Echo the given string
-   */
-  ECHO {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new EchoExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * TIME
-   * <p>
-   * Return the current server time
-   */
-  TIME {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new TimeExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * PING
-   * <p>
-   * Ping the server
-   */
-  PING {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new PingExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * QUIT
-   * <p>
-   * Close the connection
-   */
-  QUIT {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new QuitExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  /**
-   * SHUTDOWN
-   * <p>
-   * Shut down the server
-   */
-  SHUTDOWN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new ShutDownExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  },
-
-  // UNKNOWN
-  UNKNOWN {
-    private Executor executor;
-
-    @Override
-    public Executor getExecutor() {
-      if (executor == null) {
-        executor = new UnkownExecutor();
-      }
-      return executor;
-    }
-
-    private final RedisDataType dataType = RedisDataType.NONE;
-
-    @Override
-    public RedisDataType getDataType() {
-      return this.dataType;
-    }
-  };
-
-  /**
-   * Abstract method overridden by each value in enum to get the executor associated with that
-   * command type
-   * 
-   * @return {@link Executor} for command type
-   */
-  public abstract Executor getExecutor();
-
-  public abstract RedisDataType getDataType();
-  /*
-   * private RedisCommandType (RedisDataType dataType) { this.dataType = dataType; }
-   */
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RedisConstants.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisConstants.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RedisConstants.java
deleted file mode 100644
index 3c39c01..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisConstants.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-
-public class RedisConstants {
-
-  public static final int NUM_DEFAULT_KEYS = 3;
-
-  /*
-   * Responses
-   */
-  public static final String QUIT_RESPONSE = "OK";
-  public static final String COMMAND_QUEUED = "QUEUED";
-
-
-  /*
-   * Error responses
-   */
-  static final String PARSING_EXCEPTION_MESSAGE =
-      "The command recieved by GeodeRedisServer was improperly formatted";
-  static final String SERVER_ERROR_MESSAGE = "The server had an internal error please try again";
-  static final String SERVER_ERROR_UNKNOWN_RESPONSE = "Unkown response";
-  static final String SERVER_ERROR_SHUTDOWN = "The server is shutting down";
-  static final String ERROR_UNSUPPORTED_OPERATION_IN_TRANSACTION =
-      "This command is not supported within a transaction";
-  static final String ERROR_TRANSACTION_EXCEPTION =
-      "This transcation cannot be initiated, make sure the command is executed against a replicate region or your data is collocated. If you are using persistent regions, make sure transactions are enabled";
-  public static final String ERROR_NOT_NUMERIC = "Illegal non numeric argument";
-  public static final String ERROR_UNKOWN_COMMAND = "Unable to process uknown command";
-  public static final String ERROR_COMMIT_CONFLICT =
-      "There has been a conflict with another transaction";
-  public static final String ERROR_REGION_CREATION =
-      "This key could not be created. Gemfire does not allow certain characters to used in keys";
-  public static final String ERROR_UNWATCH =
-      "Keys cannot be watched or unwatched because GemFire watches all keys by default for transactions";
-  public static final String ERROR_WATCH =
-      "Keys cannot be watched or unwatched because GemFire watches all keys by default for transactions";
-  public static final String ERROR_ILLEGAL_GLOB = "Incorrect syntax for given glob regex";
-  public static final String ERROR_OUT_OF_RANGE = "The number provided is out of range";
-  public static final String ERROR_NESTED_MULTI = "The MULTI command cannot be nested";
-  public static final String ERROR_NAN_INF_INCR = "increment would produce NaN or Infinity";
-  public static final String ERROR_NO_PASS =
-      "Attempting to authenticate when no password has been set";
-  public static final String ERROR_INVALID_PWD =
-      "Attemping to authenticate with an invalid password";
-  public static final String ERROR_NOT_AUTH = "Must authenticate before sending any requests";
-
-  public static class ArityDef {
-
-    /*
-     * General
-     */
-    public static final int DBSIZE_ARITY = 0;
-    public static final String AUTH =
-        "The wrong number of arguments or syntax was provided, the format for the AUTH command is \"AUTH password\"";
-    public static final String DBSIZE = null;
-    public static final String DEL =
-        "The wrong number of arguments or syntax was provided, the format for the DEL command is \"DEL key [key ...]\"";
-    public static final String ECHO =
-        "The wrong number of arguments or syntax was provided, the format for the ECHO command is \"ECHO message\"";
-    public static final String EXISTS =
-        "The wrong number of arguments or syntax was provided, the format for the EXISTS command is \"EXISTS key\"";
-    public static final String EXPIREAT =
-        "The wrong number of arguments or syntax was provided, the format for the EXPIREAT command is \"EXPIREAT key timestamp\"";
-    public static final String EXPIRE =
-        "The wrong number of arguments or syntax was provided, the format for the EXPIRE command is \"EXPIRE key seconds\"";
-    public static final String FLUSHALL = null;
-    public static final String KEYS =
-        "The wrong number of arguments or syntax was provided, the format for the KEYS command is \"KEYS pattern\"";
-    public static final String PERSIST =
-        "The wrong number of arguments or syntax was provided, the format for the PERSIST command is \"PERSIST key\"";
-    public static final String PEXPIREAT =
-        "The wrong number of arguments or syntax was provided, the format for the PEXPIREAT command is \"PEXPIREAT key milliseconds-timestamp\"";
-    public static final String PEXPIRE =
-        "The wrong number of arguments or syntax was provided, the format for the PEXPIRE command is \"PEXPIRE key milliseconds\"";
-    public static final String PING = null;
-    public static final String PTTL =
-        "The wrong number of arguments or syntax was provided, the format for the PTTL command is \"PTTL key\"";
-    public static final String QUIT = null;
-    public static final String SCAN =
-        "The wrong number of arguments or syntax was provided, the format for the SCAN command is \"SCAN cursor [MATCH pattern] [COUNT count]\"";
-    public static final String SHUTDOWN = null;
-    public static final String TIME = null;
-    public static final String TTL =
-        "The wrong number of arguments or syntax was provided, the format for the TTL command is \"TTL key\"";
-    public static final String TYPE =
-        "The wrong number of arguments or syntax was provided, the format for the TYPE command is \"TYPE key\"";
-    public static final String UNKNOWN = null;
-
-    /*
-     * Hash
-     */
-    public static final String HDEL =
-        "The wrong number of arguments or syntax was provided, the format for the HDEL command is \"HDEL key field [field ...]\"";
-    public static final String HEXISTS =
-        "The wrong number of arguments or syntax was provided, the format for the HEXISTS command is \"HEXISTS key field\"";
-    public static final String HGETALL =
-        "The wrong number of arguments or syntax was provided, the format for the HGETALL command is \"HGETALL key\"";
-    public static final String HGET =
-        "The wrong number of arguments or syntax was provided, the format for the HGET command is \"HGET key field\"";
-    public static final String HINCRBY =
-        "The wrong number of arguments or syntax was provided, the format for the HINCRBY command is \"HINCRBY key field increment\"";
-    public static final String HINCRBYFLOAT =
-        "The wrong number of arguments or syntax was provided, the format for the HINCRBYFLOAT command is \"HINCRBYFLOAT key field increment\"";
-    public static final String HKEYS =
-        "The wrong number of arguments or syntax was provided, the format for the HKEYS command is \"HKEYS key\"";
-    public static final String HLEN =
-        "The wrong number of arguments or syntax was provided, the format for the HLEN command is \"HLEN key\"";
-    public static final String HMGET =
-        "The wrong number of arguments or syntax was provided, the format for the HMGET command is \"HMGET key field [field ...]\"";
-    public static final String HMSET =
-        "The wrong number of arguments or syntax was provided, the format for the HMSET command is \"HMSET key field value [field value ...]\", or not every field is associated with a value";
-    public static final String HSCAN =
-        "The wrong number of arguments or syntax was provided, the format for the SSCAN command is \"SSCAN key cursor [MATCH pattern] [COUNT count]\"";
-    public static final String HSET =
-        "The wrong number of arguments or syntax was provided, the format for the HSET command is \"HSET key field value\"";
-    public static final String HSETNX =
-        "The wrong number of arguments or syntax was provided, the format for the HSETNX command is \"HSETNX key field value\"";
-    public static final String HVALS =
-        "The wrong number of arguments or syntax was provided, the format for the HVALS command is \"HVALS key\"";
-
-    /*
-     * Hll
-     */
-    public static final String PFADD =
-        "The wrong number of arguments or syntax was provided, the format for the PFADD command is \"PFADD key element [element ...]\"";
-    public static final String PFCOUNT =
-        "The wrong number of arguments or syntax was provided, the format for the PFCOUNT command is \"PFCOUNT key [key ...]\"";
-    public static final String PFMERGE =
-        "The wrong number of arguments or syntax was provided, the format for the PFMERGE command is \"PFMERGE destkey sourcekey [sourcekey ...]\"";
-
-    /*
-     * List
-     */
-    public static final String LINDEX =
-        "The wrong number of arguments or syntax was provided, the format for the LINDEX command is \"LINDEX key index";
-    public static final String LINSERT = null;
-    public static final String LLEN =
-        "The wrong number of arguments or syntax was provided, the format for the LLEN command is \"LLEN key";
-    public static final String LPOP =
-        "The wrong number of arguments or syntax was provided, the format for the LPOP command is \"LPOP key";
-    public static final String LPUSH =
-        "The wrong number of arguments or syntax was provided, the format for the LPUSH command is \"LPUSH key value [value ...]";
-    public static final String LPUSHX =
-        "The wrong number of arguments or syntax was provided, the format for the LPUSHX command is \"LPUSHX key value";
-    public static final String LRANGE =
-        "The wrong number of arguments or syntax was provided, the format for the LRANGE command is \"LRANGE key start stop\"";
-    public static final String LREM =
-        "The wrong number of arguments or syntax was provided, the format for the LREM command is \"LREM key count value\"";
-    public static final String LSET =
-        "The wrong number of arguments or syntax was provided, the format for the LSET command is \"LSET key index value\"";
-    public static final String LTRIM =
-        "The wrong number of arguments or syntax was provided, the format for the LTRIM command is \"LTRIM key start stop\"";
-    public static final String RPOP =
-        "The wrong number of arguments or syntax was provided, the format for the RPOP command is \"RPOP key";
-    public static final String RPUSH =
-        "The wrong number of arguments or syntax was provided, the format for the RPUSH command is \"RPUSH key value [value ...]";
-    public static final String RPUSHX =
-        "The wrong number of arguments or syntax was provided, the format for the RPUSHX command is \"RPUSHX key value";
-
-    /*
-     * Set
-     */
-    public static final String SADD =
-        "The wrong number of arguments or syntax was provided, the format for the SADD command is \"SADD key member [member ...]\"";
-    public static final String SCARD =
-        "The wrong number of arguments or syntax was provided, the format for the SCARD command is \"SCARD key\"";
-    public static final String SDIFF =
-        "The wrong number of arguments or syntax was provided, the format for the SDIFF command is \"SDIFF key [key ...]\"";
-    public static final String SDIFFSTORE =
-        "The wrong number of arguments or syntax was provided, the format for the SDIFF command is \"SDIFFSTORE destination key [key ...]\"";
-    public static final String SINTER =
-        "The wrong number of arguments or syntax was provided, the format for the SINTER command is \"SINTER key [key ...]\"";
-    public static final String SINTERSTORE =
-        "The wrong number of arguments or syntax was provided, the format for the SINTERSTORE command is \"SINTERSTORE destination key [key ...]\"";
-    public static final String SISMEMBER =
-        "The wrong number of arguments or syntax was provided, the format for the SISMEMBER command is \"SISMEMBER key member\"";
-    public static final String SMEMBERS =
-        "The wrong number of arguments or syntax was provided, the format for the SMEMBERS command is \"SMEMBERS key\"";
-    public static final String SMOVE =
-        "The wrong number of arguments or syntax was provided, the format for the SMOVE command is \"SMOVE source destination member\"";
-    public static final String SPOP =
-        "The wrong number of arguments or syntax was provided, the format for the SPOP command is \"SPOP key\"";
-    public static final String SRANDMEMBER =
-        "The wrong number of arguments or syntax was provided, the format for the SRANDMEMBER command is \"SRANDMEMBER key [count]\"";
-    public static final String SREM =
-        "The wrong number of arguments or syntax was provided, the format for the SREM command is \"SREM key member [member ...]\"";
-    public static final String SSCAN =
-        "The wrong number of arguments or syntax was provided, the format for the SSCAN command is \"SSCAN key cursor [MATCH pattern] [COUNT count]\"";
-    public static final String SUNION =
-        "The wrong number of arguments or syntax was provided, the format for the SUNION command is \"SUNION key [key ...]\"";
-    public static final String SUNIONSTORE =
-        "The wrong number of arguments or syntax was provided, the format for the SUNIONSTORE command is \"SUNIONSTORE destination key [key ...]\"";
-
-    /*
-     * Sorted set
-     */
-    public static final String ZADD =
-        "The wrong number of arguments or syntax was provided, the format for the ZADD command is \"ZADD key score member [score member ...]\", or not every score matches to a member";
-    public static final String ZCARD =
-        "The wrong number of arguments or syntax was provided, the format for the ZCARD command is \"ZCARD key\"";
-    public static final String ZCOUNT =
-        "The wrong number of arguments or syntax was provided, the format for the ZCOUNT command is \"ZCOUNT key min max\"";
-    public static final String ZINCRBY =
-        "The wrong number of arguments or syntax was provided, the format for the ZINCRBY command is \"ZINCRBY key increment member\"";
-    public static final String ZLEXCOUNT =
-        "The wrong number of arguments or syntax was provided, the format for the ZLEXCOUNT command is \"ZLEXCOUNT key min max\"";
-    public static final String ZRANGEBYLEX =
-        "The wrong number of arguments or syntax was provided, the format for the ZRANGEBYLEX command is \"ZRANGEBYLEX key min max [LIMIT offset count]\"";
-    public static final String ZRANGEBYSCORE =
-        "The wrong number of arguments or syntax was provided, the format for the ZRANGEBYSCORE command is \"ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]\"";
-    public static final String ZRANGE =
-        "The wrong number of arguments or syntax was provided, the format for the ZRANGE command is \"ZRANGE key start stop [WITHSCORES]\"";
-    public static final String ZRANK =
-        "The wrong number of arguments or syntax was provided, the format for the ZRANK command is \"ZRANK key member\"";
-    public static final String ZREM =
-        "The wrong number of arguments or syntax was provided, the format for the ZREM command is \"ZREM key member [member ...]\"";
-    public static final String ZREMRANGEBYLEX =
-        "The wrong number of arguments or syntax was provided, the format for the ZREMRANGEBYLEX command is \"ZREMRANGEBYLEX key min max\"";
-    public static final String ZREMRANGEBYRANK =
-        "The wrong number of arguments or syntax was provided, the format for the ZREMRANGEBYRANK command is \"ZREMRANGEBYRANK key start stop\"";
-    public static final String ZREMRANGEBYSCORE =
-        "The wrong number of arguments or syntax was provided, the format for the ZREMRANGEBYSCORE command is \"ZREMRANGEBYSCORE key min max\"";
-    public static final String ZREVRANGEBYSCORE =
-        "The wrong number of arguments or syntax was provided, the format for the ZREVRANGEBYSCORE command is \"ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]\"";
-    public static final String ZREVRANGE =
-        "The wrong number of arguments or syntax was provided, the format for the ZREVRANGE command is \"ZREVRANGE key start stop [WITHSCORES]\"";
-    public static final String ZREVRANK =
-        "The wrong number of arguments or syntax was provided, the format for the ZREVRANK command is \"ZREVRANK key member\"";
-    public static final String ZSCAN =
-        "The wrong number of arguments or syntax was provided, the format for the SSCAN command is \"SSCAN key cursor [MATCH pattern] [COUNT count]\"";
-    public static final String ZSCORE =
-        "The wrong number of arguments or syntax was provided, the format for the ZSCORE command is \"ZSCORE key member\"";
-
-    /*
-     * String
-     */
-    public static final String APPEND =
-        "The wrong number of arguments or syntax was provided, the format for the APPEND command is \"APPEND key value\"";
-    public static final String BITCOUNT =
-        "The wrong number of arguments or syntax was provided, the format for the BITCOUNT command is \"BITCOUNT key [start end]\"";
-    public static final String BITOP =
-        "The wrong number of arguments or syntax was provided, the format for the BITOP command is \"BITOP operation destkey key [key ...]\"";
-    public static final String BITPOS =
-        "The wrong number of arguments or syntax was provided, the format for the BITOPS command is \"BITPOS key bit [start] [end]\"";
-    public static final String DECRBY =
-        "The wrong number of arguments or syntax was provided, the format for the DECRBY command is \"DECRRBY key decrement\"";
-    public static final String DECR =
-        "The wrong number of arguments or syntax was provided, the format for the DECR command is \"DECR key\"";
-    public static final String GETBIT =
-        "The wrong number of arguments or syntax was provided, the format for the GETBIT command is \"GETBIT key offset\"";
-    public static final String GETEXECUTOR =
-        "The wrong number of arguments or syntax was provided, the format for the GET command is \"GET key\"";
-    public static final String GETRANGE =
-        "The wrong number of arguments or syntax was provided, the format for the GETRANGE command is \"GETRANGE key start end\"";
-    public static final String GETSET =
-        "The wrong number of arguments or syntax was provided, the format for the GETSET command is \"GETSET key value\"";
-    public static final String INCRBY =
-        "The wrong number of arguments or syntax was provided, the format for the INCRBY command is \"INCRBY key increment\"";
-    public static final String INCRBYFLOAT =
-        "The wrong number of arguments or syntax was provided, the format for the INCRBY command is \"INCRBY key increment\"";
-    public static final String INCR =
-        "The wrong number of arguments or syntax was provided, the format for the INCR command is \"INCR key\"";
-    public static final String MGET =
-        "The wrong number of arguments or syntax was provided, the format for the MGET command is \"MGET key [key ...]\"";
-    public static final String MSET =
-        "The wrong number of arguments or syntax was provided, the format for the MSET command is \"MSET key value [key value ...]\", or not every key matches a value";
-    public static final String MSETNX =
-        "The wrong number of arguments or syntax was provided, the format for the MSETNX command is \"MSETNX key value [key value ...]\", or not every key matches a value";
-    public static final String PSETEX =
-        "The wrong number of arguments or syntax was provided, the format for the PSETEX command is \"PSETEX key milliseconds value\"";
-    public static final String SETBIT =
-        "The wrong number of arguments or syntax was provided, the format for the SETBIT command is \"SETBIT key offset value\"";
-    public static final String SET =
-        "The wrong number of arguments or syntax was provided, the format for the SET command is \"SET key value [EX seconds] [PX milliseconds] [NX|XX]\"";
-    public static final String SETEX =
-        "The wrong number of arguments or syntax was provided, the format for the SETEX command is \"SETEX key seconds value\"";
-    public static final String SETNX =
-        "The wrong number of arguments or syntax was provided, the format for the SETNX command is \"SETNX key value\"";
-    public static final String SETRANGE =
-        "The wrong number of arguments or syntax was provided, the format for the SETRANGE command is \"SETRANGE key offset value\"";
-    public static final String STRLEN =
-        "The wrong number of arguments or syntax was provided, the format for the STRELEN command is \"STRLEN key\"";
-
-    /*
-     * Transaction
-     */
-    public static final String DISCARD = null;
-    public static final String EXEC = null;
-    public static final String MULTI = null;
-    public static final String UNWATCH = null;
-    public static final String WATCH = null;
-  }
-
-}


[07/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java
new file mode 100644
index 0000000..7660e8f
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class HValsExecutor extends HashExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HVALS));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    Collection<ByteArrayWrapper> vals = new ArrayList(keyRegion.values());
+
+    if (vals.isEmpty()) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), vals));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java
new file mode 100644
index 0000000..1ef7a07
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+public abstract class HashExecutor extends AbstractExecutor {
+
+  protected final int FIELD_INDEX = 2;
+
+  @SuppressWarnings("unchecked")
+  protected Region<ByteArrayWrapper, ByteArrayWrapper> getOrCreateRegion(
+      ExecutionHandlerContext context, ByteArrayWrapper key, RedisDataType type) {
+    return (Region<ByteArrayWrapper, ByteArrayWrapper>) context.getRegionProvider()
+        .getOrCreateRegion(key, type, context);
+  }
+
+  @SuppressWarnings("unchecked")
+  protected Region<ByteArrayWrapper, ByteArrayWrapper> getRegion(ExecutionHandlerContext context,
+      ByteArrayWrapper key) {
+    return (Region<ByteArrayWrapper, ByteArrayWrapper>) context.getRegionProvider().getRegion(key);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java
new file mode 100644
index 0000000..e440c09
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hll;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+public abstract class HllExecutor extends AbstractExecutor {
+
+  public static final Double DEFAULT_HLL_STD_DEV = 0.081;
+  public static final Integer DEFAULT_HLL_DENSE = 18;
+  public static final Integer DEFAULT_HLL_SPARSE = 32;
+
+  protected final void checkAndSetDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
+    Object oldVal = context.getRegionProvider().metaPutIfAbsent(key, RedisDataType.REDIS_HLL);
+    if (oldVal == RedisDataType.REDIS_PROTECTED)
+      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
+    if (oldVal != null && oldVal != RedisDataType.REDIS_HLL)
+      throw new RedisDataTypeMismatchException(
+          "The key name \"" + key + "\" is already used by a " + oldVal.toString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java
new file mode 100644
index 0000000..d85a4ca
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hll;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.hll.HyperLogLogPlus;
+
+import java.util.List;
+
+public class PFAddExecutor extends HllExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PFADD));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    Region<ByteArrayWrapper, HyperLogLogPlus> keyRegion =
+        context.getRegionProvider().gethLLRegion();
+
+    HyperLogLogPlus hll = keyRegion.get(key);
+
+    boolean changed = false;
+
+    if (hll == null)
+      hll = new HyperLogLogPlus(DEFAULT_HLL_DENSE);
+
+    for (int i = 2; i < commandElems.size(); i++) {
+      byte[] bytes = commandElems.get(i);
+      boolean offerChange = hll.offer(bytes);
+      if (offerChange)
+        changed = true;
+    }
+
+    keyRegion.put(key, hll);
+
+    if (changed)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 1));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java
new file mode 100644
index 0000000..1639542
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hll;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.hll.CardinalityMergeException;
+import org.apache.geode.redis.internal.hll.HyperLogLogPlus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PFCountExecutor extends HllExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PFCOUNT));
+      return;
+    }
+
+    Region<ByteArrayWrapper, HyperLogLogPlus> keyRegion =
+        context.getRegionProvider().gethLLRegion();
+
+    List<HyperLogLogPlus> hlls = new ArrayList<HyperLogLogPlus>();
+
+    for (int i = 1; i < commandElems.size(); i++) {
+      ByteArrayWrapper k = new ByteArrayWrapper(commandElems.get(i));
+      checkDataType(k, RedisDataType.REDIS_HLL, context);
+      HyperLogLogPlus h = keyRegion.get(k);
+      if (h != null)
+        hlls.add(h);
+    }
+    if (hlls.isEmpty()) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      return;
+    }
+
+    HyperLogLogPlus tmp = hlls.remove(0);
+    HyperLogLogPlus[] estimators = hlls.toArray(new HyperLogLogPlus[hlls.size()]);
+    try {
+      tmp = (HyperLogLogPlus) tmp.merge(estimators);
+    } catch (CardinalityMergeException e) {
+      throw new RuntimeException(e);
+    }
+    long cardinality = tmp.cardinality();
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), cardinality));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java
new file mode 100644
index 0000000..ee3eacf
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hll;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.hll.CardinalityMergeException;
+import org.apache.geode.redis.internal.hll.HyperLogLogPlus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PFMergeExecutor extends HllExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PFMERGE));
+      return;
+    }
+
+    ByteArrayWrapper destKey = command.getKey();
+    checkAndSetDataType(destKey, context);
+    Region<ByteArrayWrapper, HyperLogLogPlus> keyRegion =
+        context.getRegionProvider().gethLLRegion();
+    HyperLogLogPlus mergedHLL = keyRegion.get(destKey);
+    if (mergedHLL == null)
+      mergedHLL = new HyperLogLogPlus(DEFAULT_HLL_DENSE);
+    List<HyperLogLogPlus> hlls = new ArrayList<HyperLogLogPlus>();
+
+    for (int i = 2; i < commandElems.size(); i++) {
+      ByteArrayWrapper k = new ByteArrayWrapper(commandElems.get(i));
+      checkDataType(k, RedisDataType.REDIS_HLL, context);
+      HyperLogLogPlus h = keyRegion.get(k);
+      if (h != null)
+        hlls.add(h);
+    }
+    if (hlls.isEmpty()) {
+      context.getRegionProvider().removeKey(destKey);
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
+      return;
+    }
+
+    HyperLogLogPlus[] estimators = hlls.toArray(new HyperLogLogPlus[hlls.size()]);
+    try {
+      mergedHLL = (HyperLogLogPlus) mergedHLL.merge(estimators);
+    } catch (CardinalityMergeException e) {
+      throw new RuntimeException(e);
+    }
+    keyRegion.put(destKey, mergedHLL);
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java
new file mode 100644
index 0000000..da370ce
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hll/Varint.java
@@ -0,0 +1,238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hll;
+
+/**
+ * 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.
+ */
+
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+
+/**
+ * <p>
+ * Encodes signed and unsigned values using a common variable-length scheme, found for example in
+ * <a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google's Protocol
+ * Buffers</a>. It uses fewer bytes to encode smaller values, but will use slightly more bytes to
+ * encode large values.
+ * </p>
+ * <p/>
+ * <p>
+ * Signed values are further encoded using so-called zig-zag encoding in order to make them
+ * "compatible" with variable-length encoding.
+ * </p>
+ */
+public final class Varint {
+
+  private Varint() {}
+
+  /**
+   * Encodes a value using the variable-length encoding from
+   * <a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google Protocol
+   * Buffers</a>. It uses zig-zag encoding to efficiently encode signed values. If values are known
+   * to be nonnegative, {@link #writeUnsignedVarLong(long, DataOutput)} should be used.
+   *
+   * @param value value to encode
+   * @param out to write bytes to
+   * @throws IOException if {@link DataOutput} throws {@link IOException}
+   */
+  public static void writeSignedVarLong(long value, DataOutput out) throws IOException {
+    // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
+    writeUnsignedVarLong((value << 1) ^ (value >> 63), out);
+  }
+
+  /**
+   * Encodes a value using the variable-length encoding from
+   * <a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google Protocol
+   * Buffers</a>. Zig-zag is not used, so input must not be negative. If values can be negative, use
+   * {@link #writeSignedVarLong(long, DataOutput)} instead. This method treats negative input as
+   * like a large unsigned value.
+   *
+   * @param value value to encode
+   * @param out to write bytes to
+   * @throws IOException if {@link DataOutput} throws {@link IOException}
+   */
+  public static void writeUnsignedVarLong(long value, DataOutput out) throws IOException {
+    while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
+      out.writeByte(((int) value & 0x7F) | 0x80);
+      value >>>= 7;
+    }
+    out.writeByte((int) value & 0x7F);
+  }
+
+  /**
+   * @see #writeSignedVarLong(long, DataOutput)
+   */
+  public static void writeSignedVarInt(int value, DataOutput out) throws IOException {
+    // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
+    writeUnsignedVarInt((value << 1) ^ (value >> 31), out);
+  }
+
+  /**
+   * @see #writeUnsignedVarLong(long, DataOutput)
+   */
+  public static void writeUnsignedVarInt(int value, DataOutput out) throws IOException {
+    while ((value & 0xFFFFFF80) != 0L) {
+      out.writeByte((value & 0x7F) | 0x80);
+      value >>>= 7;
+    }
+    out.writeByte(value & 0x7F);
+  }
+
+  public static byte[] writeSignedVarInt(int value) {
+    // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
+    return writeUnsignedVarInt((value << 1) ^ (value >> 31));
+  }
+
+  /**
+   * @see #writeUnsignedVarLong(long, DataOutput)
+   *      <p/>
+   *      This one does not use streams and is much faster. Makes a single object each time, and
+   *      that object is a primitive array.
+   */
+  public static byte[] writeUnsignedVarInt(int value) {
+    byte[] byteArrayList = new byte[10];
+    int i = 0;
+    while ((value & 0xFFFFFF80) != 0L) {
+      byteArrayList[i++] = ((byte) ((value & 0x7F) | 0x80));
+      value >>>= 7;
+    }
+    byteArrayList[i] = ((byte) (value & 0x7F));
+    byte[] out = new byte[i + 1];
+    for (; i >= 0; i--) {
+      out[i] = byteArrayList[i];
+    }
+    return out;
+  }
+
+  /**
+   * @param in to read bytes from
+   * @return decode value
+   * @throws IOException if {@link DataInput} throws {@link IOException}
+   * @throws IllegalArgumentException if variable-length value does not terminate after 9 bytes have
+   *         been read
+   * @see #writeSignedVarLong(long, DataOutput)
+   */
+  public static long readSignedVarLong(DataInput in) throws IOException {
+    long raw = readUnsignedVarLong(in);
+    // This undoes the trick in writeSignedVarLong()
+    long temp = (((raw << 63) >> 63) ^ raw) >> 1;
+    // This extra step lets us deal with the largest signed values by treating
+    // negative results from read unsigned methods as like unsigned values
+    // Must re-flip the top bit if the original read value had it set.
+    return temp ^ (raw & (1L << 63));
+  }
+
+  /**
+   * @param in to read bytes from
+   * @return decode value
+   * @throws IOException if {@link DataInput} throws {@link IOException}
+   * @throws IllegalArgumentException if variable-length value does not terminate after 9 bytes have
+   *         been read
+   * @see #writeUnsignedVarLong(long, DataOutput)
+   */
+  public static long readUnsignedVarLong(DataInput in) throws IOException {
+    long value = 0L;
+    int i = 0;
+    long b;
+    while (((b = in.readByte()) & 0x80L) != 0) {
+      value |= (b & 0x7F) << i;
+      i += 7;
+      if (i > 63) {
+        throw new IllegalArgumentException("Variable length quantity is too long");
+      }
+    }
+    return value | (b << i);
+  }
+
+  /**
+   * @throws IllegalArgumentException if variable-length value does not terminate after 5 bytes have
+   *         been read
+   * @throws IOException if {@link DataInput} throws {@link IOException}
+   * @see #readSignedVarLong(DataInput)
+   */
+  public static int readSignedVarInt(DataInput in) throws IOException {
+    int raw = readUnsignedVarInt(in);
+    // This undoes the trick in writeSignedVarInt()
+    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
+    // This extra step lets us deal with the largest signed values by treating
+    // negative results from read unsigned methods as like unsigned values.
+    // Must re-flip the top bit if the original read value had it set.
+    return temp ^ (raw & (1 << 31));
+  }
+
+  /**
+   * @throws IllegalArgumentException if variable-length value does not terminate after 5 bytes have
+   *         been read
+   * @throws IOException if {@link DataInput} throws {@link IOException}
+   * @see #readUnsignedVarLong(DataInput)
+   */
+  public static int readUnsignedVarInt(DataInput in) throws IOException {
+    int value = 0;
+    int i = 0;
+    int b;
+    while (((b = in.readByte()) & 0x80) != 0) {
+      value |= (b & 0x7F) << i;
+      i += 7;
+      if (i > 35) {
+        throw new IllegalArgumentException("Variable length quantity is too long");
+      }
+    }
+    return value | (b << i);
+  }
+
+  public static int readSignedVarInt(byte[] bytes) {
+    int raw = readUnsignedVarInt(bytes);
+    // This undoes the trick in writeSignedVarInt()
+    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
+    // This extra step lets us deal with the largest signed values by treating
+    // negative results from read unsigned methods as like unsigned values.
+    // Must re-flip the top bit if the original read value had it set.
+    return temp ^ (raw & (1 << 31));
+  }
+
+  public static int readUnsignedVarInt(byte[] bytes) {
+    int value = 0;
+    int i = 0;
+    byte rb = Byte.MIN_VALUE;
+    for (byte b : bytes) {
+      rb = b;
+      if ((b & 0x80) == 0) {
+        break;
+      }
+      value |= (b & 0x7f) << i;
+      i += 7;
+      if (i > 35) {
+        throw new IllegalArgumentException("Variable length quantity is too long");
+      }
+    }
+    return value | (rb << i);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java
new file mode 100644
index 0000000..e6044e2
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LIndexExecutor.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.ListQuery;
+
+import java.util.List;
+
+public class LIndexExecutor extends ListExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LINDEX));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    byte[] indexArray = commandElems.get(2);
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+
+    Integer redisIndex;
+
+    try {
+      redisIndex = Coder.bytesToInt(indexArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    /*
+     * Now the fun part, converting the redis index into our index. The redis index is 0 based but
+     * negative values count from the tail
+     */
+
+    if (redisIndex < 0)
+      // Since the redisIndex is negative here, this will reset it to be a standard 0 based index
+      redisIndex = listSize + redisIndex;
+
+    /*
+     * If the index is still less than 0 that means the index has shot off back past the beginning,
+     * which means the index isn't real and a nil is returned
+     */
+    if (redisIndex < 0) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    /*
+     * Now we must get that element from the region
+     */
+    Struct entry;
+    try {
+      entry = getEntryAtIndex(context, key, redisIndex);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+    if (entry == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    Object[] entryArray = entry.getFieldValues();
+    ByteArrayWrapper valueWrapper = (ByteArrayWrapper) entryArray[1];
+    command.setResponse(
+        Coder.getBulkStringResponse(context.getByteBufAllocator(), valueWrapper.toBytes()));
+  }
+
+  private Struct getEntryAtIndex(ExecutionHandlerContext context, ByteArrayWrapper key, int index)
+      throws Exception {
+
+    Query query = getQuery(key, ListQuery.LINDEX, context);
+
+    Object[] params = {Integer.valueOf(index + 1)};
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    if (results == null || results.size() == 0 || results.size() <= index)
+      return null;
+    else
+      return (Struct) results.asList().get(index);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java
new file mode 100644
index 0000000..d1649c2
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LInsertExecutor.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+
+public class LInsertExecutor extends ListExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
+        "Unfortunately GemFireRedis server does not support LINSERT"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java
new file mode 100644
index 0000000..6abed92
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LLenExecutor.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class LLenExecutor extends ListExecutor {
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LLEN));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    int listSize = 0;
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java
new file mode 100644
index 0000000..40736c8
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPopExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class LPopExecutor extends PopExecutor {
+
+  @Override
+  protected ListDirection popType() {
+    return ListDirection.LEFT;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.LPOP;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java
new file mode 100644
index 0000000..6624a61
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class LPushExecutor extends PushExecutor {
+
+  @Override
+  protected ListDirection pushType() {
+    return ListDirection.LEFT;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.LPUSH;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java
new file mode 100644
index 0000000..dc84896
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LPushXExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class LPushXExecutor extends PushXExecutor {
+
+  @Override
+  protected ListDirection pushType() {
+    return ListDirection.LEFT;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.LPUSHX;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java
new file mode 100644
index 0000000..38186ca
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRangeExecutor.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.ListQuery;
+
+import java.util.List;
+
+public class LRangeExecutor extends ListExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LRANGE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    byte[] startArray = commandElems.get(2);
+    byte[] stopArray = commandElems.get(3);
+
+    int redisStart;
+    int redisStop;
+
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+    if (listSize == 0) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    try {
+      redisStart = Coder.bytesToInt(startArray);
+      redisStop = Coder.bytesToInt(stopArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+
+    redisStart = getBoundedStartIndex(redisStart, listSize);
+    redisStop = getBoundedEndIndex(redisStop, listSize);
+    if (redisStart > redisStop) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+    redisStart = Math.min(redisStart, listSize - 1);
+    redisStop = Math.min(redisStop, listSize - 1);
+
+
+    List<Struct> range;
+    try {
+      range = getRange(context, key, redisStart, redisStop, keyRegion);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    if (range == null)
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+    else
+      command.setResponse(
+          Coder.getBulkStringArrayResponseOfValues(context.getByteBufAllocator(), range));
+  }
+
+  private List<Struct> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
+      int stop, Region r) throws Exception {
+
+    Query query = getQuery(key, ListQuery.LRANGE, context);
+
+    Object[] params = {Integer.valueOf(stop + 1)};
+    SelectResults<Struct> results = (SelectResults<Struct>) query.execute(params);
+    int size = results.size();
+    if (results == null || size <= start) {
+      return null;
+    }
+
+    return results.asList().subList(start, size);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java
new file mode 100644
index 0000000..f9fbbf3
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LRemExecutor.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.Struct;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.ListQuery;
+
+import java.util.List;
+
+public class LRemExecutor extends ListExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The count provided is not numeric";
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LREM));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    byte[] countArray = commandElems.get(2);
+    byte[] value = commandElems.get(3);
+
+    int count;
+
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    try {
+      count = Coder.bytesToInt(countArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    List<Struct> removeList;
+    try {
+      removeList = getRemoveList(context, key, new ByteArrayWrapper(value), count);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    int numRemoved = 0;
+
+    if (removeList == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+      return;
+    }
+
+    for (Struct entry : removeList) {
+      Integer removeKey = (Integer) entry.getFieldValues()[0];
+      Object oldVal = keyRegion.remove(removeKey);
+      if (oldVal != null)
+        numRemoved++;
+    }
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+  }
+
+  private List<Struct> getRemoveList(ExecutionHandlerContext context, ByteArrayWrapper key,
+      ByteArrayWrapper value, int count) throws Exception {
+    Object[] params;
+    Query query;
+    if (count > 0) {
+      query = getQuery(key, ListQuery.LREMG, context);
+      params = new Object[] {value, Integer.valueOf(count)};
+    } else if (count < 0) {
+      query = getQuery(key, ListQuery.LREML, context);
+      params = new Object[] {value, Integer.valueOf(-count)};
+    } else {
+      query = getQuery(key, ListQuery.LREME, context);
+      params = new Object[] {value};
+    }
+
+
+    SelectResults<Struct> results = (SelectResults<Struct>) query.execute(params);
+
+    if (results == null || results.isEmpty()) {
+      return null;
+    }
+
+    return results.asList();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java
new file mode 100644
index 0000000..e2f13cb
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LSetExecutor.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.ListQuery;
+
+import java.util.List;
+
+public class LSetExecutor extends ListExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  private final String ERROR_INDEX =
+      "The index provided is not within range of this list or the key does not exist";
+
+  private final String SUCCESS = "OK";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LSET));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    byte[] indexArray = commandElems.get(2);
+    byte[] value = commandElems.get(3);
+
+    int index;
+
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INDEX));
+      return;
+    }
+
+    try {
+      index = Coder.bytesToInt(indexArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+    if (index < 0)
+      index += listSize;
+    if (index < 0 || index > listSize) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INDEX));
+      return;
+    }
+
+    Integer indexKey;
+    try {
+      indexKey = getIndexKey(context, key, index);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+    if (indexKey == null) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INDEX));
+      return;
+    }
+    if (index == listSize)
+      indexKey++;
+    keyRegion.put(indexKey, new ByteArrayWrapper(value));
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+  }
+
+  private Integer getIndexKey(ExecutionHandlerContext context, ByteArrayWrapper key, int index)
+      throws Exception {
+    Query query = getQuery(key, ListQuery.LSET, context);
+
+    Object[] params = {Integer.valueOf(index + 1)};
+
+    SelectResults<Integer> results = (SelectResults<Integer>) query.execute(params);
+    int size = results.size();
+    if (results == null || size == 0) {
+      return null;
+    }
+
+    return results.asList().get(size - 1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java
new file mode 100644
index 0000000..1a7b369
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/LTrimExecutor.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.ListQuery;
+
+import java.util.List;
+
+public class LTrimExecutor extends ListExecutor {
+
+  private final String ERROR_KEY_NOT_EXISTS = "The key does not exists on this server";
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  private final String SUCCESS = "OK";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.LTRIM));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    byte[] startArray = commandElems.get(2);
+    byte[] stopArray = commandElems.get(3);
+
+    int redisStart;
+    int redisStop;
+
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_KEY_NOT_EXISTS));
+      return;
+    }
+
+    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+    if (listSize == 0) {
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+      return;
+    }
+
+    try {
+      redisStart = Coder.bytesToInt(startArray);
+      redisStop = Coder.bytesToInt(stopArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    redisStart = getBoundedStartIndex(redisStart, listSize);
+    redisStop = getBoundedEndIndex(redisStop, listSize);
+    redisStart = Math.min(redisStart, listSize - 1);
+    redisStop = Math.min(redisStop, listSize - 1);
+
+    if (redisStart == 0 && redisStop == listSize - 1) {
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+      return;
+    } else if (redisStart == 0 && redisStop < redisStart) {
+      context.getRegionProvider().removeKey(key, RedisDataType.REDIS_LIST);
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+      return;
+    }
+
+    List<Integer> keepList;
+    try {
+      keepList = getRange(context, key, redisStart, redisStop, keyRegion);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    for (Object keyElement : keyRegion.keySet()) {
+      if (!keepList.contains(keyElement) && keyElement instanceof Integer)
+        keyRegion.remove(keyElement);
+    }
+
+    // Reset indexes in meta data region
+    keyRegion.put("head", keepList.get(0));
+    keyRegion.put("tail", keepList.get(keepList.size() - 1));
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+  }
+
+  private List<Integer> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
+      int stop, Region r) throws Exception {
+    Query query = getQuery(key, ListQuery.LTRIM, context);
+
+    Object[] params = {Integer.valueOf(stop + 1)};
+
+    SelectResults<Integer> results = (SelectResults<Integer>) query.execute(params);
+    if (results == null || results.size() <= start) {
+      return null;
+    }
+
+    return results.asList().subList(start, results.size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
new file mode 100644
index 0000000..26fc70d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+import java.util.List;
+
+
+public abstract class ListExecutor extends AbstractExecutor {
+
+  protected static final int LIST_EMPTY_SIZE = 2;
+
+  protected static enum ListDirection {
+    LEFT, RIGHT
+  };
+
+  protected final static QueryService getQueryService() {
+    return GemFireCacheImpl.getInstance().getQueryService();
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  protected Region<Integer, ByteArrayWrapper> getOrCreateRegion(ExecutionHandlerContext context,
+      ByteArrayWrapper key, RedisDataType type) {
+    return (Region<Integer, ByteArrayWrapper>) context.getRegionProvider().getOrCreateRegion(key,
+        type, context);
+  }
+
+  @SuppressWarnings("unchecked")
+  protected Region<Integer, ByteArrayWrapper> getRegion(ExecutionHandlerContext context,
+      ByteArrayWrapper key) {
+    return (Region<Integer, ByteArrayWrapper>) context.getRegionProvider().getRegion(key);
+  }
+
+  /**
+   * Helper method to be used by the push commands to push elements onto a list. Because our current
+   * setup requires non trivial code to push elements in to a Region, I wanted all the push code to
+   * reside in one place.
+   * 
+   * @param key Name of the list
+   * @param commandElems Pieces of the command, this is where the elements that need to be pushed
+   *        live
+   * @param startIndex The index to start with in the commandElems list, inclusive
+   * @param endIndex The index to end with in the commandElems list, exclusive
+   * @param keyRegion Region of list
+   * @param pushType ListDirection.LEFT || ListDirection.RIGHT
+   * @param context Context of this push
+   */
+  protected void pushElements(ByteArrayWrapper key, List<byte[]> commandElems, int startIndex,
+      int endIndex, Region keyRegion, ListDirection pushType, ExecutionHandlerContext context) {
+
+    String indexKey = pushType == ListDirection.LEFT ? "head" : "tail";
+    String oppositeKey = pushType == ListDirection.RIGHT ? "head" : "tail";
+    Integer index = (Integer) keyRegion.get(indexKey);
+    Integer opp = (Integer) keyRegion.get(oppositeKey);
+    if (index != opp)
+      index += pushType == ListDirection.LEFT ? -1 : 1; // Subtract index if left push, add if right
+                                                        // push
+
+    /**
+     * Multi push command
+     * 
+     * For every element that needs to be added
+     */
+
+    for (int i = startIndex; i < endIndex; i++) {
+      byte[] value = commandElems.get(i);
+      ByteArrayWrapper wrapper = new ByteArrayWrapper(value);
+
+      /**
+       * 
+       * First, use the start index to attempt to insert the value into the Region
+       * 
+       */
+
+      Object oldValue;
+      do {
+        oldValue = keyRegion.putIfAbsent(index, wrapper);
+        if (oldValue != null) {
+          index += pushType == ListDirection.LEFT ? -1 : 1; // Subtract index if left push, add if
+                                                            // right push
+        }
+      } while (oldValue != null);
+
+      /**
+       * 
+       * Next, update the index in the meta data region. Keep trying to replace the existing index
+       * unless the index is further out than previously inserted, that's ok. Example below:
+       * 
+       * ********************** LPUSH/LPUSH *************************** Push occurring at the same
+       * time, further index update first | This push | | | | V V [-4] [-3] [-2] [-1] [0] [1] [2]
+       * 
+       * In this case, -4 would already exist in the meta data region, therefore we do not try to
+       * put -3 in the meta data region because a further index is already there.
+       * ***************************************************************
+       * 
+       * Another example
+       * 
+       * ********************** LPUSH/LPOP ***************************** This push | Simultaneous
+       * LPOP, meta data head index already updated to -2 | | | | V V [-4] [X] [-2] [-1] [0] [1] [2]
+       * 
+       * In this case, -2 would already exist in the meta data region, but we need to make sure the
+       * element at -4 is visible to all other threads so we will attempt to change the index to -4
+       * as long as it is greater than -4
+       * ***************************************************************
+       * 
+       */
+
+      boolean indexSet = false;
+      do {
+        Integer existingIndex = (Integer) keyRegion.get(indexKey);
+        if ((pushType == ListDirection.RIGHT && existingIndex < index)
+            || (pushType == ListDirection.LEFT && existingIndex > index))
+          indexSet = keyRegion.replace(indexKey, existingIndex, index);
+        else
+          break;
+      } while (!indexSet);
+
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java
new file mode 100644
index 0000000..935e7a1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PopExecutor.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public abstract class PopExecutor extends ListExecutor implements Extendable {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    Region keyRegion = getRegion(context, key);
+
+    if (keyRegion == null || keyRegion.size() == LIST_EMPTY_SIZE) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    String indexKey = popType() == ListDirection.LEFT ? "head" : "tail";
+    String oppositeKey = popType() == ListDirection.RIGHT ? "head" : "tail";
+    Integer index = 0;
+    int originalIndex = index;
+    int incr = popType() == ListDirection.LEFT ? 1 : -1;
+    ByteArrayWrapper valueWrapper = null;
+
+    /**
+     * 
+     * First attempt to hop over an index by moving the index down one in the meta data region. The
+     * desired index to remove is held within the field index
+     * 
+     */
+
+    boolean indexChanged = false;
+    do {
+      index = (Integer) keyRegion.get(indexKey);
+      Integer opp = (Integer) keyRegion.get(oppositeKey);
+      if (index.equals(opp))
+        break;
+      indexChanged = keyRegion.replace(indexKey, index, index + incr);
+    } while (!indexChanged);
+
+    /**
+     * 
+     * Now attempt to remove the value of the index. We must do a get to ensure a returned value and
+     * then call remove with the value to ensure no one else has removed it first. Otherwise, try
+     * other indexes
+     * 
+     */
+
+    boolean removed = false;
+    int i = 0;
+    do {
+      valueWrapper = (ByteArrayWrapper) keyRegion.get(index);
+      if (valueWrapper != null)
+        removed = keyRegion.remove(index, valueWrapper);
+
+      /**
+       * 
+       * If remove has passed, our job is done and we can break and stop looking for a value
+       * 
+       */
+
+      if (removed)
+        break;
+
+      /**
+       * 
+       * If the index has not been removed, we need to look at other indexes. Two cases exist:
+       * 
+       * ************************** FIRST MISS *********************************** Push occurring at
+       * the same time, further index update first | This is location of miss | | | | V V [-4] [X]
+       * [-2] [-1] [0] [1] [2] <-- Direction of index update If this is the first miss, the index is
+       * re obtained from the meta region and that index is trying. However, if the index in the
+       * meta data region is not further out, that index is not used and moves on to the second case
+       * **************************************************************************
+       * 
+       * ************************* SUBSEQUENT MISSES ****************************** Push occurring
+       * at the same time, further index update first | This is location of miss | | | | V V [-4]
+       * [X] [-2] [-1] [0] [1] [2] Direction of index update --> If this is not the first miss then
+       * we move down to the other end of the list which means the next not empty index will be
+       * attempted to be removed
+       * **************************************************************************
+       * 
+       * If it is the case that the list is empty, it will exit this loop
+       * 
+       */
+
+      index += incr;
+      Integer metaIndex = (Integer) keyRegion.get(indexKey);
+      if (i < 1 && (popType() == ListDirection.LEFT && metaIndex < originalIndex
+          || popType() == ListDirection.RIGHT && metaIndex > originalIndex))
+        index = metaIndex;
+      i++;
+    } while (!removed && keyRegion.size() != LIST_EMPTY_SIZE);
+    if (valueWrapper != null)
+      command.setResponse(
+          Coder.getBulkStringResponse(context.getByteBufAllocator(), valueWrapper.toBytes()));
+    else
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+  }
+
+  protected abstract ListDirection popType();
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java
new file mode 100644
index 0000000..ace592a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushExecutor.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public abstract class PushExecutor extends PushXExecutor implements Extendable {
+
+  private final int START_VALUES_INDEX = 2;
+  static volatile AtomicInteger puts = new AtomicInteger(0);
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<Integer, ByteArrayWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_LIST);
+    pushElements(key, commandElems, START_VALUES_INDEX, commandElems.size(), keyRegion, pushType(),
+        context);
+    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize));
+  }
+
+  protected abstract ListDirection pushType();
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java
new file mode 100644
index 0000000..251ae0d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/PushXExecutor.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public abstract class PushXExecutor extends ListExecutor implements Extendable {
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key);
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+    checkDataType(key, RedisDataType.REDIS_LIST, context);
+    pushElements(key, commandElems, 2, 3, keyRegion, pushType(), context);
+
+    int listSize = keyRegion.size() - LIST_EMPTY_SIZE;
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize));
+  }
+
+  protected abstract ListDirection pushType();
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java
new file mode 100644
index 0000000..3d25ae6
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPopExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class RPopExecutor extends PopExecutor {
+
+  @Override
+  protected ListDirection popType() {
+    return ListDirection.RIGHT;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.RPOP;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java
new file mode 100644
index 0000000..04f6bfd
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class RPushExecutor extends PushExecutor {
+
+  @Override
+  protected ListDirection pushType() {
+    return ListDirection.RIGHT;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.RPUSH;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java
new file mode 100644
index 0000000..8d1a007
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/list/RPushXExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.list;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class RPushXExecutor extends PushXExecutor {
+
+  @Override
+  protected ListDirection pushType() {
+    return ListDirection.RIGHT;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.RPUSHX;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java
new file mode 100644
index 0000000..18cf1b6
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SAddExecutor.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class SAddExecutor extends SetExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SADD));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion = (Region<ByteArrayWrapper, Boolean>) context
+        .getRegionProvider().getOrCreateRegion(key, RedisDataType.REDIS_SET, context);
+
+    if (commandElems.size() >= 4) {
+      Map<ByteArrayWrapper, Boolean> entries = new HashMap<ByteArrayWrapper, Boolean>();
+      for (int i = 2; i < commandElems.size(); i++)
+        entries.put(new ByteArrayWrapper(commandElems.get(i)), true);
+
+      keyRegion.putAll(entries);
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), entries.size()));
+    } else {
+      Object v = keyRegion.put(new ByteArrayWrapper(commandElems.get(2)), true);
+      command
+          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), v == null ? 1 : 0));
+    }
+
+  }
+
+}


[08/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java
new file mode 100644
index 0000000..dcd062a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ListQuery.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+public enum ListQuery {
+
+  LINDEX {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
+    }
+  },
+  LRANGE {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
+    }
+  },
+  LREMG {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE value = $1 AND key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $2";
+    }
+  },
+  LREML {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE value = $1 AND key != 'head' AND key != 'tail' ORDER BY key desc LIMIT $2";
+    }
+  },
+  LREME {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE value = $1 ORDER BY key asc";
+    }
+  },
+  LSET {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
+    }
+  },
+  LTRIM {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key != 'head' AND key != 'tail' ORDER BY key asc LIMIT $1";
+    }
+  };
+
+  public abstract String getQueryString(String fullpath);
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java
new file mode 100644
index 0000000..fa68d13
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireAtExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+public class PExpireAtExecutor extends ExpireAtExecutor {
+
+  @Override
+  protected boolean timeUnitMillis() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.PEXPIREAT;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java
new file mode 100644
index 0000000..3581d5d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PExpireExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+public class PExpireExecutor extends ExpireExecutor {
+
+  @Override
+  protected boolean timeUnitMillis() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.PEXPIRE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java
new file mode 100644
index 0000000..9e15d56
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PTTLExecutor.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+public class PTTLExecutor extends TTLExecutor {
+
+
+  @Override
+  protected boolean timeUnitMillis() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.PTTL;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java
new file mode 100644
index 0000000..16bbc0f
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PersistExecutor.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class PersistExecutor extends AbstractExecutor {
+
+  private final int TIMEOUT_REMOVED = 1;
+
+  private final int KEY_NOT_EXIST_OR_NO_TIMEOUT = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PERSIST));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    boolean canceled = context.getRegionProvider().cancelKeyExpiration(key);
+
+    if (canceled)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), TIMEOUT_REMOVED));
+    else
+      command.setResponse(
+          Coder.getIntegerResponse(context.getByteBufAllocator(), KEY_NOT_EXIST_OR_NO_TIMEOUT));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java
new file mode 100644
index 0000000..4561b5c
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/PingExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+
+public class PingExecutor extends AbstractExecutor {
+
+  private final String PING_RESPONSE = "PONG";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    command
+        .setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), PING_RESPONSE));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java
new file mode 100644
index 0000000..84ad241
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/QuitExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+
+public class QuitExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    command.setResponse(
+        Coder.getSimpleStringResponse(context.getByteBufAllocator(), RedisConstants.QUIT_RESPONSE));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java
new file mode 100644
index 0000000..3f8ea4d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ScanExecutor.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.GeodeRedisServiceImpl;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class ScanExecutor extends AbstractScanExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SCAN));
+      return;
+    }
+
+    String cursorString = command.getStringKey();
+    int cursor = 0;
+    Pattern matchPattern = null;
+    String globMatchString = null;
+    int count = DEFUALT_COUNT;
+    try {
+      cursor = Integer.parseInt(cursorString);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+    if (cursor < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+
+    if (commandElems.size() > 3) {
+      try {
+        byte[] bytes = commandElems.get(2);
+        String tmp = Coder.bytesToString(bytes);
+        if (tmp.equalsIgnoreCase("MATCH")) {
+          bytes = commandElems.get(3);
+          globMatchString = Coder.bytesToString(bytes);
+        } else if (tmp.equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(3);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (commandElems.size() > 5) {
+      try {
+        byte[] bytes = commandElems.get(4);
+        String tmp = Coder.bytesToString(bytes);
+        if (tmp.equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(5);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (count < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+      return;
+    }
+
+    try {
+      matchPattern = convertGlobToRegex(globMatchString);
+    } catch (PatternSyntaxException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
+      return;
+    }
+
+    @SuppressWarnings("unchecked")
+    List<String> returnList = (List<String>) getIteration(context.getRegionProvider().metaKeySet(),
+        matchPattern, count, cursor);
+
+    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
+    List<String> returnList = new ArrayList<String>();
+    int size = list.size();
+    int beforeCursor = 0;
+    int numElements = 0;
+    int i = -1;
+    for (String key : (Collection<String>) list) {
+      if (key.equals(GeodeRedisServiceImpl.REDIS_META_DATA_REGION)
+          || key.equals(GeodeRedisServiceImpl.STRING_REGION)
+          || key.equals(GeodeRedisServiceImpl.HLL_REGION))
+        continue;
+      i++;
+      if (beforeCursor < cursor) {
+        beforeCursor++;
+        continue;
+      } else if (numElements < count) {
+        if (matchPattern != null) {
+          if (matchPattern.matcher(key).matches()) {
+            returnList.add(key);
+            numElements++;
+          }
+        } else {
+          returnList.add(key);
+          numElements++;
+        }
+      } else
+        break;
+    }
+
+    if (i == size - (NUM_DEFAULT_REGIONS + 1))
+      returnList.add(0, String.valueOf(0));
+    else
+      returnList.add(0, String.valueOf(i));
+    return returnList;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java
new file mode 100644
index 0000000..0392095
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ShutDownExecutor.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+
+public class ShutDownExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {}
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java
new file mode 100644
index 0000000..a0a8f63
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+public enum SortedSetQuery {
+
+  ZCOUNTNINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score <= $1";
+    }
+  },
+  ZCOUNTNINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score < $1";
+    }
+  },
+  ZCOUNTPINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score >= $1";
+    }
+  },
+  ZCOUNTPINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score > $1";
+    }
+  },
+  ZCOUNTSTI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".values value WHERE value.score >= $1 AND value.score < $2";
+    }
+  },
+  ZCOUNTSTISI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".values value WHERE value.score >= $1 AND value.score <= $2";
+    }
+  },
+  ZCOUNTSI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".values value WHERE value.score > $1 AND value.score <= $2";
+    }
+  },
+  ZCOUNT {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".values value WHERE value.score > $1 AND value.score < $2";
+    }
+  },
+  ZLEXCOUNTNINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) <= 0";
+    }
+  },
+  ZLEXCOUNTNINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) < 0";
+    }
+  },
+  ZLEXCOUNTPINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) >= 0";
+    }
+  },
+  ZLEXCOUNTPINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) > 0";
+    }
+  },
+  ZLEXCOUNTSTI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) < 0";
+    }
+  },
+  ZLEXCOUNTSTISI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) <= 0";
+    }
+  },
+  ZLEXCOUNTSI {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) <= 0";
+    }
+  },
+  ZLEXCOUNT {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) < 0";
+    }
+  },
+  ZRANGEBYLEXNINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) <= 0 ORDER BY key asc LIMIT $2";
+    }
+  },
+  ZRANGEBYLEXNINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) < 0 ORDER BY key asc LIMIT $2";
+    }
+  },
+  ZRANGEBYLEXPINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) >= 0 ORDER BY key asc LIMIT $2";
+    }
+  },
+  ZRANGEBYLEXPINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) > 0 ORDER BY key asc LIMIT $2";
+    }
+  },
+  ZRANGEBYLEXSTI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) < 0 ORDER BY key asc LIMIT $3";
+    }
+  },
+  ZRANGEBYLEXSTISI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) <= 0 ORDER BY key asc LIMIT $3";
+    }
+  },
+  ZRANGEBYLEXSI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) <= 0 ORDER BY key asc LIMIT $3";
+    }
+  },
+  ZRANGEBYLEX {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT * FROM " + fullpath
+          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) < 0 ORDER BY key asc LIMIT $3";
+    }
+  },
+  ZREMRANGEBYRANK {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry ORDER BY entry.value asc LIMIT $1";
+    }
+  },
+  ZRBSNINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE value.score <= $1 ORDER BY entry.value asc LIMIT $2";
+    }
+  },
+  ZRBSNINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score < $1 ORDER BY entry.value asc LIMIT $2";
+    }
+  },
+  ZRBSPINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score >= $1 ORDER BY entry.value asc LIMIT $2";
+    }
+  },
+  ZRBSPINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score > $1 ORDER BY entry.value asc LIMIT $2";
+    }
+  },
+  ZRBSSTISI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score <= $2 ORDER BY entry.value asc LIMIT $3";
+    }
+  },
+  ZRBSSTI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score < $2 ORDER BY entry.value asc LIMIT $3";
+    }
+  },
+  ZRBSSI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score <= $2 ORDER BY entry.value asc LIMIT $3";
+    }
+  },
+  ZRBS {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score < $2 ORDER BY entry.value asc LIMIT $3";
+    }
+  },
+  ZREVRBSNINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE value <= $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
+    }
+  },
+  ZREVRBSNINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score < $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
+    }
+  },
+  ZREVRBSPINFI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score >= $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
+    }
+  },
+  ZREVRBSPINF {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score > $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
+    }
+  },
+  ZREVRBSSTISI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score <= $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
+    }
+  },
+  ZREVRBSSTI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score < $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
+    }
+  },
+  ZREVRBSSI {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score <= $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
+    }
+  },
+  ZREVRBS {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score < $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
+    }
+  },
+  ZREVRANGE {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry ORDER BY entry.value asc, entry.key asc LIMIT $1";
+    }
+  },
+  ZRANGE {
+    public String getQueryString(String fullpath) {
+      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
+          + ".entrySet entry ORDER BY entry.value desc, entry.key desc LIMIT $1";
+    }
+  },
+  ZRANK {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".entrySet entry WHERE entry.value < $1 OR (entry.value = $2 AND entry.key.compareTo($3) < 0)";
+    }
+  },
+  ZREVRANK {
+    public String getQueryString(String fullpath) {
+      return "SELECT COUNT(*) FROM " + fullpath
+          + ".entrySet entry WHERE entry.value > $1 OR (entry.value = $2 AND entry.key.compareTo($3) > 0)";
+    }
+  };
+
+  public abstract String getQueryString(String fullpath);
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java
new file mode 100644
index 0000000..f237342
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RegionProvider;
+
+import java.util.List;
+
+public class TTLExecutor extends AbstractExecutor implements Extendable {
+
+  private final int NOT_EXISTS = -2;
+
+  private final int NO_TIMEOUT = -1;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    RegionProvider rC = context.getRegionProvider();
+    boolean exists = false;
+    RedisDataType val = rC.getRedisDataType(key);
+    if (val != null)
+      exists = true;
+
+    if (!exists) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+    long ttl = rC.getExpirationDelayMillis(key);
+
+    if (ttl == 0L) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NO_TIMEOUT));
+      return;
+    }
+
+    if (!timeUnitMillis())
+      ttl = ttl / millisInSecond;
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), ttl));
+  }
+
+  protected boolean timeUnitMillis() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.TTL;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java
new file mode 100644
index 0000000..4094200
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import io.netty.buffer.ByteBuf;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+
+public class TimeExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    long timeStamp = System.currentTimeMillis();
+    long seconds = timeStamp / 1000;
+    long microSeconds = (timeStamp - (seconds * 1000)) * 1000;
+    byte[] secAr = Coder.longToBytes(seconds);
+    byte[] micAr = Coder.longToBytes(microSeconds);
+
+    ByteBuf response = context.getByteBufAllocator().buffer(50);
+    response.writeByte(Coder.ARRAY_ID);
+    response.writeByte(50); // #2
+    response.writeBytes(Coder.CRLFar);
+    response.writeByte(Coder.BULK_STRING_ID);
+    response.writeBytes(Coder.intToBytes(secAr.length));
+    response.writeBytes(Coder.CRLFar);
+    response.writeBytes(secAr);
+    response.writeBytes(Coder.CRLFar);
+    response.writeByte(Coder.BULK_STRING_ID);
+    response.writeBytes(Coder.intToBytes(micAr.length));
+    response.writeBytes(Coder.CRLFar);
+    response.writeBytes(micAr);
+    response.writeBytes(Coder.CRLFar);
+    command.setResponse(response);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java
new file mode 100644
index 0000000..f6a0313
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class TypeExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.TYPE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    RedisDataType type = context.getRegionProvider().getRedisDataType(key);
+
+    if (type == null)
+      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), "none"));
+    else
+      command
+          .setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), type.toString()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java
new file mode 100644
index 0000000..d5c2bba
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+
+public class UnkownExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    command.setResponse(
+        Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_UNKOWN_COMMAND));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java
new file mode 100644
index 0000000..c034334
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HDelExecutor extends HashExecutor {
+
+  private final int START_FIELDS_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HDEL));
+      return;
+    }
+
+    int numDeleted = 0;
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeleted));
+      return;
+    }
+
+
+    for (int i = START_FIELDS_INDEX; i < commandElems.size(); i++) {
+      ByteArrayWrapper field = new ByteArrayWrapper(commandElems.get(i));
+      Object oldValue = keyRegion.remove(field);
+      if (oldValue != null)
+        numDeleted++;
+    }
+    if (keyRegion.isEmpty()) {
+      context.getRegionProvider().removeKey(key, RedisDataType.REDIS_HASH);
+    }
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeleted));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
new file mode 100644
index 0000000..e1eb0e7
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HExistsExecutor extends HashExecutor {
+
+  private final int NOT_EXISTS = 0;
+
+  private final int EXISTS = 1;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HEXISTS));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    byte[] byteField = commandElems.get(FIELD_INDEX);
+    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
+
+    boolean hasField = keyRegion.containsKey(field);
+
+    if (hasField)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTS));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java
new file mode 100644
index 0000000..99138de
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class HGetAllExecutor extends HashExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HGETALL));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    Collection<Map.Entry<ByteArrayWrapper, ByteArrayWrapper>> entries =
+        new ArrayList(keyRegion.entrySet()); // This creates a CopyOnRead behavior
+
+    if (entries.isEmpty()) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    command.setResponse(Coder.getKeyValArrayResponse(context.getByteBufAllocator(), entries));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java
new file mode 100644
index 0000000..858fe80
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HGetExecutor extends HashExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HGET));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    byte[] byteField = commandElems.get(FIELD_INDEX);
+    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
+
+    ByteArrayWrapper valueWrapper = keyRegion.get(field);
+
+    if (valueWrapper != null) {
+      command.setResponse(
+          Coder.getBulkStringResponse(context.getByteBufAllocator(), valueWrapper.toBytes()));
+    } else
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java
new file mode 100644
index 0000000..faf9945
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HIncrByExecutor extends HashExecutor {
+
+  private final String ERROR_FIELD_NOT_USABLE = "The value at this field is not an integer";
+
+  private final String ERROR_INCREMENT_NOT_USABLE = "The increment on this key must be numeric";
+
+  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
+
+  private final int FIELD_INDEX = 2;
+
+  private final int INCREMENT_INDEX = 3;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HINCRBY));
+      return;
+    }
+
+    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
+    long increment;
+
+    try {
+      increment = Coder.bytesToLong(incrArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
+
+    byte[] byteField = commandElems.get(FIELD_INDEX);
+    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
+
+    /*
+     * Put incrememnt as value if field doesn't exist
+     */
+
+    ByteArrayWrapper oldValue = keyRegion.get(field);
+
+    if (oldValue == null) {
+      keyRegion.put(field, new ByteArrayWrapper(incrArray));
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), increment));
+      return;
+    }
+
+    /*
+     * If the field did exist then increment the field
+     */
+
+    long value;
+
+    try {
+      value = Long.parseLong(oldValue.toString());
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_FIELD_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Check for overflow
+     */
+    if ((value >= 0 && increment > (Long.MAX_VALUE - value))
+        || (value <= 0 && increment < (Long.MIN_VALUE - value))) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
+      return;
+    }
+
+    value += increment;
+    // String newValue = String.valueOf(value);
+
+    keyRegion.put(field, new ByteArrayWrapper(Coder.longToBytes(value)));
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java
new file mode 100644
index 0000000..3be182e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HIncrByFloatExecutor extends HashExecutor {
+
+  private final String ERROR_FIELD_NOT_USABLE =
+      "The value at this field cannot be incremented numerically because it is not a float";
+
+  private final String ERROR_INCREMENT_NOT_USABLE =
+      "The increment on this key must be floating point numeric";
+
+  private final int FIELD_INDEX = 2;
+
+  private final int INCREMENT_INDEX = 3;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HINCRBYFLOAT));
+      return;
+    }
+
+    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
+    Double increment;
+
+    try {
+      increment = Coder.bytesToDouble(incrArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
+
+    byte[] byteField = commandElems.get(FIELD_INDEX);
+    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
+
+    /*
+     * Put incrememnt as value if field doesn't exist
+     */
+
+    ByteArrayWrapper oldValue = keyRegion.get(field);
+
+    if (oldValue == null) {
+      keyRegion.put(field, new ByteArrayWrapper(incrArray));
+      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), increment));
+      return;
+    }
+
+    /*
+     * If the field did exist then increment the field
+     */
+    String valueS = oldValue.toString();
+    if (valueS.contains(" ")) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_FIELD_NOT_USABLE));
+      return;
+    }
+    Double value;
+
+    try {
+      value = Coder.stringToDouble(valueS);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_FIELD_NOT_USABLE));
+      return;
+    }
+
+    value += increment;
+    keyRegion.put(field, new ByteArrayWrapper(Coder.doubleToBytes(value)));
+    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), value));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java
new file mode 100644
index 0000000..01ac817
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class HKeysExecutor extends HashExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HKEYS));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    Set<ByteArrayWrapper> keys = new HashSet(keyRegion.keySet());
+
+    if (keys.isEmpty()) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    // String response = getBulkStringArrayResponse(keys);
+
+    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), keys));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java
new file mode 100644
index 0000000..945a715
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HLenExecutor extends HashExecutor {
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HLEN));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    final int regionSize = keyRegion.size();
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), regionSize));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java
new file mode 100644
index 0000000..132e7d5
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HMGetExecutor extends HashExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HMGET));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+
+    if (keyRegion == null) {
+      command.setResponse(
+          Coder.getArrayOfNils(context.getByteBufAllocator(), commandElems.size() - 2));
+      return;
+    }
+
+    ArrayList<ByteArrayWrapper> fields = new ArrayList<ByteArrayWrapper>();
+    for (int i = 2; i < commandElems.size(); i++) {
+      byte[] fieldArray = commandElems.get(i);
+      ByteArrayWrapper field = new ByteArrayWrapper(fieldArray);
+      fields.add(field);
+    }
+
+    Map<ByteArrayWrapper, ByteArrayWrapper> results = keyRegion.getAll(fields);
+
+    ArrayList<ByteArrayWrapper> values = new ArrayList<ByteArrayWrapper>();
+
+    /*
+     * This is done to preserve order in the output
+     */
+    for (ByteArrayWrapper field : fields)
+      values.add(results.get(field));
+
+    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), values));
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java
new file mode 100644
index 0000000..7cbe1ba
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class HMSetExecutor extends HashExecutor {
+
+  private final String SUCCESS = "OK";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3 || commandElems.size() % 2 == 1) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HMSET));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
+
+    Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
+    for (int i = 2; i < commandElems.size(); i += 2) {
+      byte[] fieldArray = commandElems.get(i);
+      ByteArrayWrapper field = new ByteArrayWrapper(fieldArray);
+      byte[] value = commandElems.get(i + 1);
+      map.put(field, new ByteArrayWrapper(value));
+    }
+
+    keyRegion.putAll(map);
+
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
new file mode 100644
index 0000000..1a8dddc
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
+
+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;
+import java.util.regex.PatternSyntaxException;
+
+public class HScanExecutor extends AbstractScanExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HSCAN));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
+        (Region<ByteArrayWrapper, ByteArrayWrapper>) context.getRegionProvider().getRegion(key);
+    checkDataType(key, RedisDataType.REDIS_HASH, context);
+    if (keyRegion == null) {
+      command.setResponse(
+          Coder.getScanResponse(context.getByteBufAllocator(), new ArrayList<String>()));
+      return;
+    }
+    byte[] cAr = commandElems.get(2);
+    String cursorString = Coder.bytesToString(cAr);
+
+    int cursor = 0;
+    Pattern matchPattern = null;
+    String globMatchPattern = null;
+    int count = DEFUALT_COUNT;
+    try {
+      cursor = Integer.parseInt(cursorString);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+    if (cursor < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+
+    if (commandElems.size() > 4) {
+      try {
+        byte[] bytes = commandElems.get(3);
+        String tmp = Coder.bytesToString(bytes);
+        if (tmp.equalsIgnoreCase("MATCH")) {
+          bytes = commandElems.get(4);
+          globMatchPattern = Coder.bytesToString(bytes);
+        } else if (tmp.equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(4);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (commandElems.size() > 6) {
+      try {
+        byte[] bytes = commandElems.get(5);
+        String tmp = Coder.bytesToString(bytes);
+        if (tmp.equalsIgnoreCase("MATCH")) {
+          bytes = commandElems.get(6);
+          globMatchPattern = Coder.bytesToString(bytes);
+        } else if (tmp.equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(6);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (count < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+      return;
+    }
+
+    try {
+      matchPattern = convertGlobToRegex(globMatchPattern);
+    } catch (PatternSyntaxException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
+      return;
+    }
+
+    List<Object> returnList =
+        getIteration(new HashSet(keyRegion.entrySet()), matchPattern, count, cursor);
+
+    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  protected List<Object> getIteration(Collection<?> list, Pattern matchPattern, int count,
+      int cursor) {
+    List<Object> returnList = new ArrayList<Object>();
+    int size = list.size();
+    int beforeCursor = 0;
+    int numElements = 0;
+    int i = -1;
+    for (Entry<ByteArrayWrapper, ByteArrayWrapper> entry : (Collection<Entry<ByteArrayWrapper, ByteArrayWrapper>>) list) {
+      ByteArrayWrapper key = entry.getKey();
+      ByteArrayWrapper value = entry.getValue();
+      i++;
+      if (beforeCursor < cursor) {
+        beforeCursor++;
+        continue;
+      } else if (numElements < count) {
+        if (matchPattern != null) {
+          if (matchPattern.matcher(key.toString()).matches()) {
+            returnList.add(key);
+            returnList.add(value);
+            numElements++;
+          }
+        } else {
+          returnList.add(key);
+          returnList.add(value);
+          numElements++;
+        }
+      } else
+        break;
+    }
+
+    if (i == size - 1)
+      returnList.add(0, String.valueOf(0));
+    else
+      returnList.add(0, String.valueOf(i));
+    return returnList;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java
new file mode 100644
index 0000000..64952db
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class HSetExecutor extends HashExecutor implements Extendable {
+
+  private final int EXISTING_FIELD = 0;
+
+  private final int NEW_FIELD = 1;
+
+  private final int VALUE_INDEX = 3;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
+
+    byte[] byteField = commandElems.get(FIELD_INDEX);
+    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
+
+    byte[] value = commandElems.get(VALUE_INDEX);
+
+    Object oldValue;
+
+    if (onlySetOnAbsent())
+      oldValue = keyRegion.putIfAbsent(field, new ByteArrayWrapper(value));
+    else
+      oldValue = keyRegion.put(field, new ByteArrayWrapper(value));
+
+    if (oldValue == null)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NEW_FIELD));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTING_FIELD));
+
+  }
+
+  protected boolean onlySetOnAbsent() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.HSET;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java
new file mode 100644
index 0000000..5312527
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.hash;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class HSetNXExecutor extends HSetExecutor {
+
+  @Override
+  protected boolean onlySetOnAbsent() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.HSETNX;
+  }
+}


[04/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java
new file mode 100644
index 0000000..d63c02f
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetRangeExecutor.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class GetRangeExecutor extends StringExecutor {
+
+  private final String ERROR_NOT_INT = "The indexes provided must be numeric values";
+
+  private final int startIndex = 2;
+
+  private final int stopIndex = 3;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETRANGE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_STRING, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+    if (valueWrapper == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    byte[] value = valueWrapper.toBytes();
+    int length = value.length;
+
+    long start;
+    long end;
+
+
+    try {
+      byte[] startI = commandElems.get(startIndex);
+      byte[] stopI = commandElems.get(stopIndex);
+      start = Coder.bytesToLong(startI);
+      end = Coder.bytesToLong(stopI);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+      return;
+    }
+    start = getBoundedStartIndex(start, length);
+    end = getBoundedEndIndex(end, length);
+
+    /*
+     * If the properly formatted indexes are illegal, send nil
+     */
+    if (start > end || start == length) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+    /*
+     * 1 is added to end because the end in copyOfRange is exclusive but in Redis it is inclusive
+     */
+    if (end != length)
+      end++;
+    byte[] returnRange = Arrays.copyOfRange(value, (int) start, (int) end);
+    if (returnRange == null || returnRange.length == 0) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), returnRange));
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java
new file mode 100644
index 0000000..b0edfd4
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/GetSetExecutor.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class GetSetExecutor extends StringExecutor {
+
+  private final int VALUE_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETSET));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+
+    byte[] newCharValue = commandElems.get(VALUE_INDEX);
+    ByteArrayWrapper newValueWrapper = new ByteArrayWrapper(newCharValue);
+
+    ByteArrayWrapper oldValueWrapper = r.get(key);
+    r.put(key, newValueWrapper);
+
+    if (oldValueWrapper == null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+    } else {
+      command.setResponse(
+          Coder.getBulkStringResponse(context.getByteBufAllocator(), oldValueWrapper.toBytes()));
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java
new file mode 100644
index 0000000..0dac15b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByExecutor.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class IncrByExecutor extends StringExecutor {
+
+  private final String ERROR_VALUE_NOT_USABLE =
+      "The value at this key cannot be incremented numerically";
+
+  private final String ERROR_INCREMENT_NOT_USABLE = "The increment on this key must be numeric";
+
+  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
+
+  private final int INCREMENT_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBY));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+    /*
+     * Try increment
+     */
+
+    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
+    Long increment;
+
+    try {
+      increment = Coder.bytesToLong(incrArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Value does not exist
+     */
+
+    if (valueWrapper == null) {
+      r.put(key, new ByteArrayWrapper(incrArray));
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), increment));
+      return;
+    }
+
+    /*
+     * Value exists
+     */
+
+    String stringValue = Coder.bytesToString(valueWrapper.toBytes());
+    Long value;
+    try {
+      value = Long.parseLong(stringValue);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Check for overflow
+     */
+    if (value >= 0 && increment > (Long.MAX_VALUE - value)) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
+      return;
+    }
+
+    value += increment;
+
+    stringValue = "" + value;
+    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java
new file mode 100644
index 0000000..e1ff80f
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrByFloatExecutor.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class IncrByFloatExecutor extends StringExecutor {
+
+  private final String ERROR_VALUE_NOT_USABLE =
+      "Invalid value at this key and cannot be incremented numerically";
+
+  private final String ERROR_INCREMENT_NOT_USABLE =
+      "The increment on this key must be a valid floating point numeric";
+
+  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
+
+  private final int INCREMENT_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+    if (commandElems.size() < 3) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBYFLOAT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+    /*
+     * Try increment
+     */
+
+    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
+    String doub = Coder.bytesToString(incrArray).toLowerCase();
+    if (doub.contains("inf") || doub.contains("nan")) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
+          "Increment would produce NaN or infinity"));
+      return;
+    } else if (valueWrapper != null && valueWrapper.toString().contains(" ")) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
+      return;
+    }
+
+
+    Double increment;
+
+    try {
+      increment = Coder.stringToDouble(doub);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Value does not exist
+     */
+
+    if (valueWrapper == null) {
+      r.put(key, new ByteArrayWrapper(incrArray));
+      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), increment));
+      return;
+    }
+
+    /*
+     * Value exists
+     */
+
+    String stringValue = Coder.bytesToString(valueWrapper.toBytes());
+
+    Double value;
+    try {
+      value = Coder.stringToDouble(stringValue);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
+      return;
+    }
+
+    /*
+     * Check for overflow
+     */
+    if (value >= 0 && increment > (Double.MAX_VALUE - value)) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
+      return;
+    }
+
+    double result = value + increment;
+    if (Double.isNaN(result) || Double.isInfinite(result)) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_NAN_INF_INCR));
+      return;
+    }
+    value += increment;
+
+    stringValue = "" + value;
+    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
+
+    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), value));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java
new file mode 100644
index 0000000..1e915b2
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/IncrExecutor.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class IncrExecutor extends StringExecutor {
+
+  private final String ERROR_VALUE_NOT_USABLE =
+      "The value at this key cannot be incremented numerically";
+
+  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
+
+  private final int INIT_VALUE_INT = 1;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCR));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+    /*
+     * Value does not exist
+     */
+
+    if (valueWrapper == null) {
+      byte[] newValue = {Coder.NUMBER_1_BYTE};
+      r.put(key, new ByteArrayWrapper(newValue));
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), INIT_VALUE_INT));
+      return;
+    }
+
+    /*
+     * Value exists
+     */
+
+    String stringValue = valueWrapper.toString();
+
+    Long value;
+    try {
+      value = Long.parseLong(stringValue);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
+      return;
+    }
+
+    if (value == Long.MAX_VALUE) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
+      return;
+    }
+
+    value++;
+
+    stringValue = "" + value;
+    r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
+
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java
new file mode 100644
index 0000000..dab7eae
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MGetExecutor.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class MGetExecutor extends StringExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MGET));
+      return;
+    }
+
+    Collection<ByteArrayWrapper> keys = new ArrayList<ByteArrayWrapper>();
+    for (int i = 1; i < commandElems.size(); i++) {
+      byte[] keyArray = commandElems.get(i);
+      ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
+      /*
+       * try { checkDataType(key, RedisDataType.REDIS_STRING, context); } catch
+       * (RedisDataTypeMismatchException e) { keys.ad continue; }
+       */
+      keys.add(key);
+    }
+
+    Map<ByteArrayWrapper, ByteArrayWrapper> results = r.getAll(keys);
+
+    Collection<ByteArrayWrapper> values = new ArrayList<ByteArrayWrapper>();
+
+    /*
+     * This is done to preserve order in the output
+     */
+    for (ByteArrayWrapper key : keys)
+      values.add(results.get(key));
+
+    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), values));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java
new file mode 100644
index 0000000..bf06497
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetExecutor.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MSetExecutor extends StringExecutor {
+
+  private final String SUCCESS = "OK";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSET));
+      return;
+    }
+
+    Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
+    for (int i = 1; i < commandElems.size(); i += 2) {
+      byte[] keyArray = commandElems.get(i);
+      ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
+      try {
+        checkAndSetDataType(key, context);
+      } catch (RedisDataTypeMismatchException e) {
+        continue;
+      }
+      byte[] value = commandElems.get(i + 1);
+      map.put(key, new ByteArrayWrapper(value));
+    }
+    r.putAll(map);
+
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java
new file mode 100644
index 0000000..eefffe9
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/MSetNXExecutor.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MSetNXExecutor extends StringExecutor {
+
+  private final int SET = 1;
+
+  private final int NOT_SET = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSETNX));
+      return;
+    }
+
+    boolean hasEntry = false;
+
+    Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
+    for (int i = 1; i < commandElems.size(); i += 2) {
+      byte[] keyArray = commandElems.get(i);
+      ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
+      try {
+        checkDataType(key, context);
+      } catch (RedisDataTypeMismatchException e) {
+        hasEntry = true;
+        break;
+      }
+      byte[] value = commandElems.get(i + 1);
+      map.put(key, new ByteArrayWrapper(value));
+      if (r.containsKey(key)) {
+        hasEntry = true;
+        break;
+      }
+    }
+    boolean successful = false;
+    if (!hasEntry) {
+      successful = true;
+      for (ByteArrayWrapper k : map.keySet()) {
+        try {
+          checkAndSetDataType(k, context);
+        } catch (RedisDataTypeMismatchException e) {
+          successful = false;
+          break;
+        }
+      }
+      r.putAll(map);
+    }
+    if (successful) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
+    } else {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java
new file mode 100644
index 0000000..c8e6111
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/PSetEXExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class PSetEXExecutor extends SetEXExecutor {
+
+  @Override
+  public boolean timeUnitMillis() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.PSETEX;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
new file mode 100644
index 0000000..7cef3e0
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class SetBitExecutor extends StringExecutor {
+
+  private final String ERROR_NOT_INT = "The number provided must be numeric";
+
+  private final String ERROR_VALUE = "The value is out of range, must be 0 or 1";
+
+  private final String ERROR_ILLEGAL_OFFSET =
+      "The offset is out of range, must be greater than or equal to 0  and at most 4294967295 (512MB)";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETBIT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper wrapper = r.get(key);
+
+    long offset;
+    int value;
+    int returnBit = 0;
+    try {
+      byte[] offAr = commandElems.get(2);
+      byte[] valAr = commandElems.get(3);
+      offset = Coder.bytesToLong(offAr);
+      value = Coder.bytesToInt(valAr);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+      return;
+    }
+
+    if (value != 0 && value != 1) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE));
+      return;
+    }
+
+    if (offset < 0 || offset > 4294967295L) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_OFFSET));
+      return;
+    }
+
+    int byteIndex = (int) (offset / 8);
+    offset %= 8;
+
+    if (wrapper == null) {
+      byte[] bytes = new byte[byteIndex + 1];
+      if (value == 1)
+        bytes[byteIndex] = (byte) (0x80 >> offset);
+      r.put(key, new ByteArrayWrapper(bytes));
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+    } else {
+
+      byte[] bytes = wrapper.toBytes();
+      if (byteIndex < bytes.length)
+        returnBit = (bytes[byteIndex] & (0x80 >> offset)) >> (7 - offset);
+      else
+        returnBit = 0;
+
+      if (byteIndex < bytes.length) {
+        bytes[byteIndex] = value == 1 ? (byte) (bytes[byteIndex] | (0x80 >> offset))
+            : (byte) (bytes[byteIndex] & ~(0x80 >> offset));
+        r.put(key, new ByteArrayWrapper(bytes));
+      } else {
+        byte[] newBytes = new byte[byteIndex + 1];
+        System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
+        newBytes[byteIndex] = value == 1 ? (byte) (newBytes[byteIndex] | (0x80 >> offset))
+            : (byte) (newBytes[byteIndex] & ~(0x80 >> offset));
+        r.put(key, new ByteArrayWrapper(newBytes));
+      }
+
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), returnBit));
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java
new file mode 100644
index 0000000..71498c6
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetEXExecutor.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+import java.util.List;
+
+public class SetEXExecutor extends StringExecutor implements Extendable {
+
+  private final String ERROR_SECONDS_NOT_A_NUMBER =
+      "The expiration argument provided was not a number";
+
+  private final String ERROR_SECONDS_NOT_LEGAL = "The expiration argument must be greater than 0";
+
+  private final String SUCCESS = "OK";
+
+  private final int VALUE_INDEX = 3;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    byte[] value = commandElems.get(VALUE_INDEX);
+
+    byte[] expirationArray = commandElems.get(2);
+    long expiration;
+    try {
+      expiration = Coder.bytesToLong(expirationArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_A_NUMBER));
+      return;
+    }
+
+    if (expiration <= 0) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_LEGAL));
+      return;
+    }
+
+    if (!timeUnitMillis())
+      expiration *= AbstractExecutor.millisInSecond;
+
+    checkAndSetDataType(key, context);
+    r.put(key, new ByteArrayWrapper(value));
+
+    context.getRegionProvider().setExpiration(key, expiration);
+
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+
+  }
+
+  protected boolean timeUnitMillis() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SETEX;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
new file mode 100644
index 0000000..b83e4c1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+import java.util.List;
+
+public class SetExecutor extends StringExecutor {
+
+  private final String SUCCESS = "OK";
+
+  private final int VALUE_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SET));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, context);
+    byte[] value = commandElems.get(VALUE_INDEX);
+    ByteArrayWrapper valueWrapper = new ByteArrayWrapper(value);
+
+    boolean NX = false; // Set only if not exists
+    boolean XX = false; // Set only if exists
+    long expiration = 0L;
+
+    if (commandElems.size() >= 6) {
+      String elem4;
+      String elem5;
+      String elem6;
+
+      elem4 = Coder.bytesToString(commandElems.get(3));
+      elem5 = Coder.bytesToString(commandElems.get(4));
+      elem6 = Coder.bytesToString(commandElems.get(5));
+
+      if (elem4.equalsIgnoreCase("XX") || elem6.equalsIgnoreCase("XX"))
+        XX = true;
+      else if (elem4.equalsIgnoreCase("NX") || elem6.equalsIgnoreCase("NX"))
+        NX = true;
+
+      if (elem4.equalsIgnoreCase("PX"))
+        expiration = getExpirationMillis(elem4, elem5);
+      else if (elem5.equalsIgnoreCase("PX"))
+        expiration = getExpirationMillis(elem5, elem6);
+      else if (elem4.equalsIgnoreCase("EX"))
+        expiration = getExpirationMillis(elem4, elem5);
+      else if (elem5.equalsIgnoreCase("EX"))
+        expiration = getExpirationMillis(elem5, elem6);
+
+    } else if (commandElems.size() >= 5) {
+      String elem4;
+      String expiry;
+
+      elem4 = Coder.bytesToString(commandElems.get(3));
+      expiry = Coder.bytesToString(commandElems.get(4));
+
+      expiration = getExpirationMillis(elem4, expiry);
+    } else if (commandElems.size() >= 4) {
+      byte[] elem4 = commandElems.get(3);
+      if (elem4.length == 2 && Character.toUpperCase(elem4[1]) == 'X') {
+        if (Character.toUpperCase(elem4[0]) == 'N')
+          NX = true;
+        else if (Character.toUpperCase(elem4[0]) == 'X')
+          XX = true;
+      }
+    }
+
+    boolean keyWasSet = false;
+
+    if (NX)
+      keyWasSet = setNX(r, command, key, valueWrapper, context);
+    else if (XX)
+      keyWasSet = setXX(r, command, key, valueWrapper, context);
+    else {
+      checkAndSetDataType(key, context);
+      r.put(key, valueWrapper);
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+      keyWasSet = true;
+    }
+
+    if (keyWasSet && expiration > 0L) {
+      context.getRegionProvider().setExpiration(key, expiration);
+    }
+
+  }
+
+  private boolean setNX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command,
+      ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) {
+    checkAndSetDataType(key, context);
+    Object oldValue = r.putIfAbsent(key, valueWrapper);
+    if (oldValue != null) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return false;
+    } else {
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+      return true;
+    }
+  }
+
+  private boolean setXX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command,
+      ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) {
+    if (r.containsKey(key)) {
+      checkAndSetDataType(key, context);
+      r.put(key, valueWrapper);
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
+      return true;
+    } else {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return false;
+    }
+  }
+
+  private long getExpirationMillis(String expx, String expirationString) {
+    long expiration = 0L;
+    try {
+      expiration = Long.parseLong(expirationString);
+    } catch (NumberFormatException e) {
+      return 0L;
+    }
+
+    if (expx.equalsIgnoreCase("EX"))
+      return expiration * AbstractExecutor.millisInSecond;
+    else if (expx.equalsIgnoreCase("PX"))
+      return expiration;
+    else
+      return 0L;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
new file mode 100644
index 0000000..eb4c75b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class SetNXExecutor extends StringExecutor {
+
+  private final int SET = 1;
+
+  private final int NOT_SET = 0;
+
+  private final int VALUE_INDEX = 2;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETNX));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    byte[] value = commandElems.get(VALUE_INDEX);
+
+    Object oldValue = r.putIfAbsent(key, new ByteArrayWrapper(value));
+
+    if (oldValue != null)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java
new file mode 100644
index 0000000..e1545d0
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetRangeExecutor.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class SetRangeExecutor extends StringExecutor {
+
+  private final String ERROR_NOT_INT = "The number provided must be numeric";
+
+  private final String ERROR_ILLEGAL_OFFSET =
+      "The offset is out of range, must be greater than or equal to 0 and the offset added to the length of the value must be less than 536870911 (512MB), the maximum allowed size";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETRANGE));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkAndSetDataType(key, context);
+    ByteArrayWrapper wrapper = r.get(key);
+
+    int offset;
+    byte[] value = commandElems.get(3);
+    try {
+      byte[] offAr = commandElems.get(2);
+      offset = Coder.bytesToInt(offAr);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
+      return;
+    }
+
+    int totalLength = offset + value.length;
+    if (offset < 0 || totalLength > 536870911) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_OFFSET));
+      return;
+    } else if (value.length == 0) {
+      int length = wrapper == null ? 0 : wrapper.toBytes().length;
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), length));
+      if (wrapper == null)
+        context.getRegionProvider().removeKey(key);
+      return;
+    }
+
+    if (wrapper == null) {
+      byte[] bytes = new byte[totalLength];
+      System.arraycopy(value, 0, bytes, offset, value.length);
+      r.put(key, new ByteArrayWrapper(bytes));
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bytes.length));
+    } else {
+
+      byte[] bytes = wrapper.toBytes();
+      int returnLength;
+      if (totalLength < bytes.length) {
+        System.arraycopy(value, 0, bytes, offset, value.length);
+        r.put(key, new ByteArrayWrapper(bytes));
+        returnLength = bytes.length;
+      } else {
+        byte[] newBytes = new byte[totalLength];
+        System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
+        System.arraycopy(value, 0, newBytes, offset, value.length);
+        returnLength = newBytes.length;
+        r.put(key, new ByteArrayWrapper(newBytes));
+      }
+
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), returnLength));
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java
new file mode 100644
index 0000000..fb91f09
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StringExecutor.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+public abstract class StringExecutor extends AbstractExecutor {
+
+  protected final void checkAndSetDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
+    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)
+      throw new RedisDataTypeMismatchException(
+          "The key name \"" + key + "\" is already used by a " + oldVal.toString());
+  }
+
+  protected void checkDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
+    RedisDataType currentType = context.getRegionProvider().getRedisDataType(key);
+    if (currentType == null)
+      return;
+    if (currentType == RedisDataType.REDIS_PROTECTED)
+      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
+    if (currentType != RedisDataType.REDIS_STRING)
+      throw new RedisDataTypeMismatchException(
+          "The key name \"" + key + "\" is already used by a " + currentType.toString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java
new file mode 100644
index 0000000..345db20
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/StrlenExecutor.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.string;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class StrlenExecutor extends StringExecutor {
+
+  private final int KEY_DOES_NOT_EXIST = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.STRLEN));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_STRING, context);
+    ByteArrayWrapper valueWrapper = r.get(key);
+
+
+    if (valueWrapper == null)
+      command
+          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), KEY_DOES_NOT_EXIST));
+    else
+      command.setResponse(
+          Coder.getIntegerResponse(context.getByteBufAllocator(), valueWrapper.toBytes().length));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java
new file mode 100644
index 0000000..16bf575
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/DiscardExecutor.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.transactions;
+
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.TransactionId;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+
+public class DiscardExecutor extends TransactionExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+
+    CacheTransactionManager txm = context.getCacheTransactionManager();
+
+    if (context.hasTransaction()) {
+      TransactionId transactionId = context.getTransactionID();
+      txm.resume(transactionId);
+      txm.rollback();
+      context.clearTransaction();
+    }
+
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java
new file mode 100644
index 0000000..9f3b402
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/ExecExecutor.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.transactions;
+
+import io.netty.buffer.ByteBuf;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.CommitConflictException;
+import org.apache.geode.cache.TransactionId;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+
+import java.util.Queue;
+
+public class ExecExecutor extends TransactionExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+
+    CacheTransactionManager txm = context.getCacheTransactionManager();
+
+    if (!context.hasTransaction()) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    TransactionId transactionId = context.getTransactionID();
+
+    txm.resume(transactionId);
+
+    boolean hasError = hasError(context.getTransactionQueue());
+
+    if (hasError)
+      txm.rollback();
+    else {
+      try {
+        txm.commit();
+      } catch (CommitConflictException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
+            RedisConstants.ERROR_COMMIT_CONFLICT));
+        context.clearTransaction();
+        return;
+      }
+    }
+
+    ByteBuf response = constructResponseExec(context);
+    command.setResponse(response);
+
+    context.clearTransaction();
+  }
+
+  private ByteBuf constructResponseExec(ExecutionHandlerContext context) {
+    Queue<Command> cQ = context.getTransactionQueue();
+    ByteBuf response = context.getByteBufAllocator().buffer();
+    response.writeByte(Coder.ARRAY_ID);
+    response.writeBytes(Coder.intToBytes(cQ.size()));
+    response.writeBytes(Coder.CRLFar);
+
+    for (Command c : cQ) {
+      ByteBuf r = c.getResponse();
+      response.writeBytes(r);
+    }
+    return response;
+  }
+
+  private boolean hasError(Queue<Command> queue) {
+    for (Command c : queue) {
+      if (c.hasError())
+        return true;
+    }
+    return false;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java
new file mode 100644
index 0000000..21a41d3
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/MultiExecutor.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.transactions;
+
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.TransactionId;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+
+public class MultiExecutor extends TransactionExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+
+    CacheTransactionManager txm = context.getCacheTransactionManager();
+
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
+
+    if (context.hasTransaction()) {
+      throw new IllegalStateException(RedisConstants.ERROR_NESTED_MULTI);
+    }
+
+    txm.begin();
+
+    TransactionId id = txm.suspend();
+
+    context.setTransactionID(id);
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java
new file mode 100644
index 0000000..27ade8f
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/TransactionExecutor.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.transactions;
+
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+public abstract class TransactionExecutor extends AbstractExecutor {
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java
new file mode 100644
index 0000000..2323550
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/UnwatchExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.transactions;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+
+public class UnwatchExecutor extends TransactionExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    command.setResponse(
+        Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_UNWATCH));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java
new file mode 100644
index 0000000..1dbe36e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/transactions/WatchExecutor.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.transactions;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+
+public class WatchExecutor extends TransactionExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    command.setResponse(
+        Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_WATCH));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/Bits.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/Bits.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/Bits.java
new file mode 100644
index 0000000..92cef47
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/Bits.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.IOException;
+
+public class Bits {
+
+  public static int[] getBits(byte[] mBytes) throws IOException {
+    int bitSize = mBytes.length / 4;
+    int[] bits = new int[bitSize];
+    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(mBytes));
+    for (int i = 0; i < bitSize; i++) {
+      bits[i] = dis.readInt();
+    }
+    return bits;
+  }
+
+  /**
+   * This method might be better described as "byte array to int array" or "data input to int array"
+   */
+  public static int[] getBits(DataInput dataIn, int byteLength) throws IOException {
+    int bitSize = byteLength / 4;
+    int[] bits = new int[bitSize];
+    for (int i = 0; i < bitSize; i++) {
+      bits[i] = dataIn.readInt();
+    }
+    return bits;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/CardinalityMergeException.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/CardinalityMergeException.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/CardinalityMergeException.java
new file mode 100644
index 0000000..561c3ef
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/CardinalityMergeException.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2011 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+@SuppressWarnings("serial")
+public abstract class CardinalityMergeException extends Exception {
+
+  public CardinalityMergeException(String message) {
+    super(message);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLog.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLog.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLog.java
new file mode 100644
index 0000000..b89512e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/hll/HyperLogLog.java
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2012 Clearspring Technologies, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.hll;
+
+import org.apache.geode.redis.internal.executor.hll.HllExecutor;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+
+/**
+ * Java implementation of HyperLogLog (HLL) algorithm from this paper:
+ * <p/>
+ * http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf
+ * <p/>
+ * HLL is an improved version of LogLog that is capable of estimating the cardinality of a set with
+ * accuracy = 1.04/sqrt(m) where m = 2^b. So we can control accuracy vs space usage by increasing or
+ * decreasing b.
+ * <p/>
+ * The main benefit of using HLL over LL is that it only requires 64% of the space that LL does to
+ * get the same accuracy.
+ * <p/>
+ * This implementation implements a single counter. If a large (millions) number of counters are
+ * required you may want to refer to:
+ * <p/>
+ * http://dsiutils.dsi.unimi.it/
+ * <p/>
+ * It has a more complex implementation of HLL that supports multiple counters in a single object,
+ * drastically reducing the java overhead from creating a large number of objects.
+ * <p/>
+ * This implementation leveraged a javascript implementation that Yammer has been working on:
+ * <p/>
+ * https://github.com/yammer/probablyjs
+ * <p>
+ * Note that this implementation does not include the long range correction function defined in the
+ * original paper. Empirical evidence shows that the correction function causes more harm than good.
+ * </p>
+ * <p/>
+ * <p>
+ * Users have different motivations to use different types of hashing functions. Rather than try to
+ * keep up with all available hash functions and to remove the concern of causing future binary
+ * incompatibilities this class allows clients to offer the value in hashed int or long form. This
+ * way clients are free to change their hash function on their own time line. We recommend using
+ * Google's Guava Murmur3_128 implementation as it provides good performance and speed when high
+ * precision is required. In our tests the 32bit MurmurHash function included in this project is
+ * faster and produces better results than the 32 bit murmur3 implementation google provides.
+ * </p>
+ */
+public class HyperLogLog implements ICardinality, Serializable {
+
+  private static final long serialVersionUID = -4661220245111112301L;
+  private final RegisterSet registerSet;
+  private final int log2m;
+  private final double alphaMM;
+
+
+  /**
+   * Create a new HyperLogLog instance using the specified standard deviation.
+   *
+   * @param rsd - the relative standard deviation for the counter. smaller values create counters
+   *        that require more space.
+   */
+  public HyperLogLog(double rsd) {
+    this(log2m(rsd));
+  }
+
+  private static int log2m(double rsd) {
+    return (int) (Math.log((1.106 / rsd) * (1.106 / rsd)) / Math.log(2));
+  }
+
+  /**
+   * Create a new HyperLogLog instance. The log2m parameter defines the accuracy of the counter. The
+   * larger the log2m the better the accuracy.
+   * <p/>
+   * accuracy = 1.04/sqrt(2^log2m)
+   *
+   * @param log2m - the number of bits to use as the basis for the HLL instance
+   */
+  public HyperLogLog(int log2m) {
+    this(log2m, new RegisterSet(1 << log2m));
+  }
+
+  /**
+   * Creates a new HyperLogLog instance using the given registers. Used for unmarshalling a
+   * serialized instance and for merging multiple counters together.
+   *
+   * @param registerSet - the initial values for the register set
+   */
+  @Deprecated
+  public HyperLogLog(int log2m, RegisterSet registerSet) {
+    if (log2m < 0 || log2m > 30) {
+      throw new IllegalArgumentException(
+          "log2m argument is " + log2m + " and is outside the range [0, 30]");
+    }
+    this.registerSet = registerSet;
+    this.log2m = log2m;
+    int m = 1 << this.log2m;
+
+    alphaMM = getAlphaMM(log2m, m);
+  }
+
+  @Override
+  public boolean offerHashed(long hashedValue) {
+    // j becomes the binary address determined by the first b log2m of x
+    // j will be between 0 and 2^log2m
+    final int j = (int) (hashedValue >>> (Long.SIZE - log2m));
+    final int r =
+        Long.numberOfLeadingZeros((hashedValue << this.log2m) | (1 << (this.log2m - 1)) + 1) + 1;
+    return registerSet.updateIfGreater(j, r);
+  }
+
+  @Override
+  public boolean offerHashed(int hashedValue) {
+    // j becomes the binary address determined by the first b log2m of x
+    // j will be between 0 and 2^log2m
+    final int j = hashedValue >>> (Integer.SIZE - log2m);
+    final int r =
+        Integer.numberOfLeadingZeros((hashedValue << this.log2m) | (1 << (this.log2m - 1)) + 1) + 1;
+    return registerSet.updateIfGreater(j, r);
+  }
+
+  @Override
+  public boolean offer(Object o) {
+    final int x = MurmurHash.hash(o);
+    return offerHashed(x);
+  }
+
+
+  @Override
+  public long cardinality() {
+    double registerSum = 0;
+    int count = registerSet.count;
+    double zeros = 0.0;
+    for (int j = 0; j < registerSet.count; j++) {
+      int val = registerSet.get(j);
+      registerSum += 1.0 / (1 << val);
+      if (val == 0) {
+        zeros++;
+      }
+    }
+
+    double estimate = alphaMM * (1 / registerSum);
+
+    if (estimate <= (5.0 / 2.0) * count) {
+      // Small Range Estimate
+      return Math.round(linearCounting(count, zeros));
+    } else {
+      return Math.round(estimate);
+    }
+  }
+
+  @Override
+  public int sizeof() {
+    return registerSet.size * 4;
+  }
+
+  @Override
+  public byte[] getBytes() throws IOException {
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    DataOutput dos = new DataOutputStream(baos);
+    writeBytes(dos);
+
+    return baos.toByteArray();
+  }
+
+  private void writeBytes(DataOutput serializedByteStream) throws IOException {
+    serializedByteStream.writeInt(log2m);
+    serializedByteStream.writeInt(registerSet.size * 4);
+    for (int x : registerSet.readOnlyBits()) {
+      serializedByteStream.writeInt(x);
+    }
+  }
+
+  /**
+   * Add all the elements of the other set to this set.
+   * <p/>
+   * This operation does not imply a loss of precision.
+   *
+   * @param other A compatible Hyperloglog instance (same log2m)
+   * @throws CardinalityMergeException if other is not compatible
+   */
+  public void addAll(HyperLogLog other) throws CardinalityMergeException {
+    if (this.sizeof() != other.sizeof()) {
+      throw new HyperLogLogMergeException("Cannot merge estimators of different sizes");
+    }
+
+    registerSet.merge(other.registerSet);
+  }
+
+  @Override
+  public ICardinality merge(ICardinality... estimators) throws CardinalityMergeException {
+    HyperLogLog merged = new HyperLogLog(HllExecutor.DEFAULT_HLL_STD_DEV);// new HyperLogLog(log2m,
+                                                                          // new
+                                                                          // RegisterSet(this.registerSet.count));
+    merged.addAll(this);
+
+    if (estimators == null) {
+      return merged;
+    }
+
+    for (ICardinality estimator : estimators) {
+      if (!(estimator instanceof HyperLogLog)) {
+        throw new HyperLogLogMergeException("Cannot merge estimators of different class");
+      }
+      HyperLogLog hll = (HyperLogLog) estimator;
+      merged.addAll(hll);
+    }
+
+    return merged;
+  }
+
+  private Object writeReplace() {
+    return new SerializationHolder(this);
+  }
+
+  /**
+   * This class exists to support Externalizable semantics for HyperLogLog objects without having to
+   * expose a public constructor, public write/read methods, or pretend final fields aren't final.
+   *
+   * In short, Externalizable allows you to skip some of the more verbose meta-data default
+   * Serializable gets you, but still includes the class name. In that sense, there is some cost to
+   * this holder object because it has a longer class name. I imagine people who care about
+   * optimizing for that have their own work-around for long class names in general, or just use a
+   * custom serialization framework. Therefore we make no attempt to optimize that here (eg. by
+   * raising this from an inner class and giving it an unhelpful name).
+   */
+  private static class SerializationHolder implements Externalizable {
+
+    HyperLogLog hyperLogLogHolder;
+
+    public SerializationHolder(HyperLogLog hyperLogLogHolder) {
+      this.hyperLogLogHolder = hyperLogLogHolder;
+    }
+
+    /**
+     * required for Externalizable
+     */
+    @SuppressWarnings("unused")
+    public SerializationHolder() {
+
+    }
+
+    @Override
+    public void writeExternal(ObjectOutput out) throws IOException {
+      hyperLogLogHolder.writeBytes(out);
+    }
+
+    @Override
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+      hyperLogLogHolder = Builder.build(in);
+    }
+
+    private Object readResolve() {
+      return hyperLogLogHolder;
+    }
+  }
+
+  public static class Builder implements IBuilder<ICardinality>, Serializable {
+
+    private static final long serialVersionUID = -979314356097156719L;
+    private double rsd;
+
+    public Builder(double rsd) {
+      this.rsd = rsd;
+    }
+
+    @Override
+    public HyperLogLog build() {
+      return new HyperLogLog(rsd);
+    }
+
+    @Override
+    public int sizeof() {
+      int log2m = log2m(rsd);
+      int k = 1 << log2m;
+      return RegisterSet.getBits(k) * 4;
+    }
+
+    public static HyperLogLog build(byte[] bytes) throws IOException {
+      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+      return build(new DataInputStream(bais));
+    }
+
+    public static HyperLogLog build(DataInput serializedByteStream) throws IOException {
+      int log2m = serializedByteStream.readInt();
+      int byteArraySize = serializedByteStream.readInt();
+      return new HyperLogLog(log2m,
+          new RegisterSet(1 << log2m, Bits.getBits(serializedByteStream, byteArraySize)));
+    }
+  }
+
+  @SuppressWarnings("serial")
+  protected static class HyperLogLogMergeException extends CardinalityMergeException {
+
+    public HyperLogLogMergeException(String message) {
+      super(message);
+    }
+  }
+
+  protected static double getAlphaMM(final int p, final int m) {
+    // See the paper.
+    switch (p) {
+      case 4:
+        return 0.673 * m * m;
+      case 5:
+        return 0.697 * m * m;
+      case 6:
+        return 0.709 * m * m;
+      default:
+        return (0.7213 / (1 + 1.079 / m)) * m * m;
+    }
+  }
+
+  protected static double linearCounting(int m, double V) {
+    return m * Math.log(m / V);
+  }
+}


[19/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/IBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/IBuilder.java b/geode-core/src/main/java/org/apache/geode/internal/hll/IBuilder.java
deleted file mode 100755
index 10189c8..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/IBuilder.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2011 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-
-public interface IBuilder<T> {
-
-  T build();
-
-  int sizeof();
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/ICardinality.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/ICardinality.java b/geode-core/src/main/java/org/apache/geode/internal/hll/ICardinality.java
deleted file mode 100755
index 125b621..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/ICardinality.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2011 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-
-import java.io.IOException;
-
-
-public interface ICardinality {
-
-  /**
-   * @param o stream element
-   * @return false if the value returned by cardinality() is unaffected by the appearance of o in
-   *         the stream.
-   */
-  boolean offer(Object o);
-
-  /**
-   * Offer the value as a hashed long value
-   *
-   * @param hashedLong - the hash of the item to offer to the estimator
-   * @return false if the value returned by cardinality() is unaffected by the appearance of
-   *         hashedLong in the stream
-   */
-  boolean offerHashed(long hashedLong);
-
-  /**
-   * Offer the value as a hashed long value
-   *
-   * @param hashedInt - the hash of the item to offer to the estimator
-   * @return false if the value returned by cardinality() is unaffected by the appearance of
-   *         hashedInt in the stream
-   */
-  boolean offerHashed(int hashedInt);
-
-  /**
-   * @return the number of unique elements in the stream or an estimate thereof
-   */
-  long cardinality();
-
-  /**
-   * @return size in bytes needed for serialization
-   */
-  int sizeof();
-
-  /**
-   * @return byte[]
-   * @throws IOException
-   */
-  byte[] getBytes() throws IOException;
-
-  /**
-   * Merges estimators to produce a new estimator for the combined streams of this estimator and
-   * those passed as arguments.
-   * <p/>
-   * Nor this estimator nor the one passed as parameters are modified.
-   *
-   * @param estimators Zero or more compatible estimators
-   * @throws CardinalityMergeException If at least one of the estimators is not compatible with this
-   *         one
-   */
-  ICardinality merge(ICardinality... estimators) throws CardinalityMergeException;
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/MurmurHash.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/MurmurHash.java b/geode-core/src/main/java/org/apache/geode/internal/hll/MurmurHash.java
deleted file mode 100755
index be19e29..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/MurmurHash.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-
-/**
- * This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See
- * http://murmurhash.googlepages.com/ for more details.
- * <p/>
- * <p>
- * The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at
- * getopt org).
- * </p>
- */
-public class MurmurHash {
-  public static int hash(Object o) {
-    if (o == null) {
-      return 0;
-    }
-    if (o instanceof Long) {
-      return hashLong((Long) o);
-    }
-    if (o instanceof Integer) {
-      return hashLong((Integer) o);
-    }
-    if (o instanceof Double) {
-      return hashLong(Double.doubleToRawLongBits((Double) o));
-    }
-    if (o instanceof Float) {
-      return hashLong(Float.floatToRawIntBits((Float) o));
-    }
-    if (o instanceof String) {
-      return hash(((String) o).getBytes());
-    }
-    if (o instanceof byte[]) {
-      return hash((byte[]) o);
-    }
-    return hash(o.toString());
-  }
-
-  public static int hash(byte[] data) {
-    return hash(data, 0, data.length, -1);
-  }
-
-  public static int hash(byte[] data, int seed) {
-    return hash(data, 0, data.length, seed);
-  }
-
-  public static int hash(byte[] data, int offset, int length, int seed) {
-    int m = 0x5bd1e995;
-    int r = 24;
-
-    int h = seed ^ length;
-
-    int len_4 = length >> 2;
-
-    for (int i = 0; i < len_4; i++) {
-      int i_4 = i << 2;
-      int k = data[offset + i_4 + 3];
-      k = k << 8;
-      k = k | (data[offset + i_4 + 2] & 0xff);
-      k = k << 8;
-      k = k | (data[offset + i_4 + 1] & 0xff);
-      k = k << 8;
-      k = k | (data[offset + i_4 + 0] & 0xff);
-      k *= m;
-      k ^= k >>> r;
-      k *= m;
-      h *= m;
-      h ^= k;
-    }
-
-    // avoid calculating modulo
-    int len_m = len_4 << 2;
-    int left = length - len_m;
-
-    if (left != 0) {
-      if (left >= 3) {
-        h ^= (int) data[offset + length - 3] << 16;
-      }
-      if (left >= 2) {
-        h ^= (int) data[offset + length - 2] << 8;
-      }
-      if (left >= 1) {
-        h ^= (int) data[offset + length - 1];
-      }
-
-      h *= m;
-    }
-
-    h ^= h >>> 13;
-    h *= m;
-    h ^= h >>> 15;
-
-    return h;
-  }
-
-  public static int hashLong(long data) {
-    int m = 0x5bd1e995;
-    int r = 24;
-
-    int h = 0;
-
-    int k = (int) data * m;
-    k ^= k >>> r;
-    h ^= k * m;
-
-    k = (int) (data >> 32) * m;
-    k ^= k >>> r;
-    h *= m;
-    h ^= k * m;
-
-    h ^= h >>> 13;
-    h *= m;
-    h ^= h >>> 15;
-
-    return h;
-  }
-
-  public static long hash64(Object o) {
-    if (o == null) {
-      return 0l;
-    } else if (o instanceof String) {
-      final byte[] bytes = ((String) o).getBytes();
-      return hash64(bytes, bytes.length);
-    } else if (o instanceof byte[]) {
-      final byte[] bytes = (byte[]) o;
-      return hash64(bytes, bytes.length);
-    }
-    return hash64(o.toString());
-  }
-
-  // 64 bit implementation copied from here: https://github.com/tnm/murmurhash-java
-
-  /**
-   * Generates 64 bit hash from byte array with default seed value.
-   *
-   * @param data byte array to hash
-   * @param length length of the array to hash
-   * @return 64 bit hash of the given string
-   */
-  public static long hash64(final byte[] data, int length) {
-    return hash64(data, length, 0xe17a1465);
-  }
-
-
-  /**
-   * Generates 64 bit hash from byte array of the given length and seed.
-   *
-   * @param data byte array to hash
-   * @param length length of the array to hash
-   * @param seed initial seed value
-   * @return 64 bit hash of the given array
-   */
-  public static long hash64(final byte[] data, int length, int seed) {
-    final long m = 0xc6a4a7935bd1e995L;
-    final int r = 47;
-
-    long h = (seed & 0xffffffffl) ^ (length * m);
-
-    int length8 = length / 8;
-
-    for (int i = 0; i < length8; i++) {
-      final int i8 = i * 8;
-      long k = ((long) data[i8 + 0] & 0xff) + (((long) data[i8 + 1] & 0xff) << 8)
-          + (((long) data[i8 + 2] & 0xff) << 16) + (((long) data[i8 + 3] & 0xff) << 24)
-          + (((long) data[i8 + 4] & 0xff) << 32) + (((long) data[i8 + 5] & 0xff) << 40)
-          + (((long) data[i8 + 6] & 0xff) << 48) + (((long) data[i8 + 7] & 0xff) << 56);
-
-      k *= m;
-      k ^= k >>> r;
-      k *= m;
-
-      h ^= k;
-      h *= m;
-    }
-
-    switch (length % 8) {
-      case 7:
-        h ^= (long) (data[(length & ~7) + 6] & 0xff) << 48;
-      case 6:
-        h ^= (long) (data[(length & ~7) + 5] & 0xff) << 40;
-      case 5:
-        h ^= (long) (data[(length & ~7) + 4] & 0xff) << 32;
-      case 4:
-        h ^= (long) (data[(length & ~7) + 3] & 0xff) << 24;
-      case 3:
-        h ^= (long) (data[(length & ~7) + 2] & 0xff) << 16;
-      case 2:
-        h ^= (long) (data[(length & ~7) + 1] & 0xff) << 8;
-      case 1:
-        h ^= (long) (data[length & ~7] & 0xff);
-        h *= m;
-    };
-
-    h ^= h >>> r;
-    h *= m;
-    h ^= h >>> r;
-
-    return h;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/RegisterSet.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/RegisterSet.java b/geode-core/src/main/java/org/apache/geode/internal/hll/RegisterSet.java
deleted file mode 100755
index cad691b..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/RegisterSet.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2012 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-
-public class RegisterSet {
-
-  public final static int LOG2_BITS_PER_WORD = 6;
-  public final static int REGISTER_SIZE = 5;
-
-  public final int count;
-  public final int size;
-
-  private final int[] M;
-
-  public RegisterSet(int count) {
-    this(count, null);
-  }
-
-  public RegisterSet(int count, int[] initialValues) {
-    this.count = count;
-
-    if (initialValues == null) {
-      this.M = new int[getSizeForCount(count)];
-    } else {
-      this.M = initialValues;
-    }
-    this.size = this.M.length;
-  }
-
-  public static int getBits(int count) {
-    return count / LOG2_BITS_PER_WORD;
-  }
-
-  public static int getSizeForCount(int count) {
-    int bits = getBits(count);
-    if (bits == 0) {
-      return 1;
-    } else if (bits % Integer.SIZE == 0) {
-      return bits;
-    } else {
-      return bits + 1;
-    }
-  }
-
-  public void set(int position, int value) {
-    int bucketPos = position / LOG2_BITS_PER_WORD;
-    int shift = REGISTER_SIZE * (position - (bucketPos * LOG2_BITS_PER_WORD));
-    this.M[bucketPos] = (this.M[bucketPos] & ~(0x1f << shift)) | (value << shift);
-  }
-
-  public int get(int position) {
-    int bucketPos = position / LOG2_BITS_PER_WORD;
-    int shift = REGISTER_SIZE * (position - (bucketPos * LOG2_BITS_PER_WORD));
-    return (this.M[bucketPos] & (0x1f << shift)) >>> shift;
-  }
-
-  public boolean updateIfGreater(int position, int value) {
-    int bucket = position / LOG2_BITS_PER_WORD;
-    int shift = REGISTER_SIZE * (position - (bucket * LOG2_BITS_PER_WORD));
-    int mask = 0x1f << shift;
-
-    // Use long to avoid sign issues with the left-most shift
-    long curVal = this.M[bucket] & mask;
-    long newVal = value << shift;
-    if (curVal < newVal) {
-      this.M[bucket] = (int) ((this.M[bucket] & ~mask) | newVal);
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  public void merge(RegisterSet that) {
-    for (int bucket = 0; bucket < M.length; bucket++) {
-      int word = 0;
-      for (int j = 0; j < LOG2_BITS_PER_WORD; j++) {
-        int mask = 0x1f << (REGISTER_SIZE * j);
-
-        int thisVal = (this.M[bucket] & mask);
-        int thatVal = (that.M[bucket] & mask);
-        word |= (thisVal < thatVal) ? thatVal : thisVal;
-      }
-      this.M[bucket] = word;
-    }
-  }
-
-  int[] readOnlyBits() {
-    return M;
-  }
-
-  public int[] bits() {
-    int[] copy = new int[size];
-    System.arraycopy(M, 0, copy, 0, M.length);
-    return copy;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/FixedPartitionAttributesInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/FixedPartitionAttributesInfo.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/FixedPartitionAttributesInfo.java
index eb0435a..673f1bc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/FixedPartitionAttributesInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/FixedPartitionAttributesInfo.java
@@ -16,7 +16,6 @@ package org.apache.geode.management.internal.cli.domain;
 
 import java.io.Serializable;
 
-import io.netty.util.internal.StringUtil;
 import org.apache.commons.lang.StringUtils;
 
 import org.apache.geode.cache.FixedPartitionAttributes;

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
deleted file mode 100644
index 4c97c98..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
+++ /dev/null
@@ -1,729 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import io.netty.bootstrap.ServerBootstrap;
-import io.netty.buffer.PooledByteBufAllocator;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelOption;
-import io.netty.channel.ChannelPipeline;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.ServerChannel;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.oio.OioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioServerSocketChannel;
-import io.netty.channel.socket.oio.OioServerSocketChannel;
-import io.netty.util.concurrent.Future;
-import org.apache.geode.cache.*;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ByteToCommandDecoder;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.LogWriter;
-import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalRegionArguments;
-import org.apache.geode.internal.hll.HyperLogLogPlus;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.net.SocketCreator;
-
-/**
- * The GeodeRedisServer is a server that understands the Redis protocol. As commands are sent to the
- * server, each command is picked up by a thread, interpreted and then executed and a response is
- * sent back to the client. The default connection port is 6379 but that can be altered when run
- * through GFSH or started through the provided static main class.
- * <p>
- * Each Redis data type instance is stored in a separate {@link Region} except for the Strings and
- * HyperLogLogs which are collectively stored in one Region respectively. That Region along with a
- * meta data region used internally are protected so the client may not store keys with the name
- * {@link GeodeRedisServer#REDIS_META_DATA_REGION} or {@link GeodeRedisServer#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 GeodeRedisServer#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>
- * Supported String commands - APPEND, BITCOUNT, BITOP, BITPOS, DECR, DECRBY, GET, GETBIT, GETRANGE,
- * GETSET, INCR, INCRBY, INCRBYFLOAT, MGET, MSET, MSETNX, PSETEX, SET, SETBIT, SETEX, SETNX, STRLEN
- * <p>
- * Supported List commands - LINDEX, LLEN, LPOP, LPUSH, LPUSHX, LRANGE, LREM, LSET, LTRIM, RPOP,
- * RPUSH, RPUSHX
- * <p>
- * Supported Hash commands - HDEL, HEXISTS, HGET, HGETALL, HINCRBY, HINCRBYFLOAT, HKEYS, HMGET,
- * HMSET, HSETNX, HLEN, HSCAN, HSET, HVALS
- * <p>
- * Supported Set commands - SADD, SCARD, SDIFF, SDIFFSTORE, SINTER, SINTERSTORE, SISMEMBER,
- * SMEMBERS, SMOVE, SREM, SPOP, SRANDMEMBER, SCAN, SUNION, SUNIONSTORE
- * <p>
- * Supported SortedSet commands - ZADD, ZCARD, ZCOUNT, ZINCRBY, ZLEXCOUNT, ZRANGE, ZRANGEBYLEX,
- * ZRANGEBYSCORE, ZRANK, ZREM, ZREMRANGEBYLEX, ZREMRANGEBYRANK, ZREMRANGEBYSCORE, ZREVRANGE,
- * ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE
- * <p>
- * Supported HyperLogLog commands - PFADD, PFCOUNT, PFMERGE
- * <p>
- * Supported Keys commands - DEL, DBSIZE, EXISTS, EXPIRE, EXPIREAT, FLUSHDB, FLUSHALL, KEYS,
- * PERSIST, PEXPIRE, PEXPIREAT, PTTL, SCAN, TTL
- * <p>
- * Supported Transaction commands - DISCARD, EXEC, MULTI
- * <P>
- * Supported Server commands - AUTH, ECHO, PING, TIME, QUIT
- * <p>
- * <p>
- * The command executors are not explicitly documented but the functionality can be found at
- * <a href="http://redis.io/commands">Redis Commands</a>
- * <p>
- * Exceptions to the Redis Commands Documents:
- * <p>
- * <ul>
- * <li>Any command that removes keys and returns a count of removed entries will not return a total
- * remove count but rather a count of how many entries have been removed that existed on the local
- * vm, though all entries will be removed</li>
- * <li>Any command that returns a count of newly set members has an unspecified return value. The
- * command will work just as the Redis protocol states but the count will not necessary reflect the
- * number set compared to overridden.</li>
- * <li>Transactions work just as they would on a Redis instance, they are local transaction.
- * Transactions cannot be executed on data that is not local to the executing server, that is on a
- * partitioned region in a different server instance or on a persistent region that does not have
- * transactions enabled. Also, you cannot watch or unwatch keys as all keys within a GemFire
- * transaction are watched by default.</li>
- * </ul>
- *
- */
-
-public class GeodeRedisServer {
-
-  /**
-   * Thread used to start main method
-   */
-  private static Thread mainThread = null;
-
-  /**
-   * The default Redis port as specified by their protocol, {@value #DEFAULT_REDIS_SERVER_PORT}
-   */
-  public static final int DEFAULT_REDIS_SERVER_PORT = 6379;
-
-  /**
-   * The number of threads that will work on handling requests
-   */
-  private final int numWorkerThreads;
-
-  /**
-   * The number of threads that will work socket selectors
-   */
-  private final int numSelectorThreads;
-
-  /**
-   * The actual port being used by the server
-   */
-  private final int serverPort;
-
-  /**
-   * The address to bind to
-   */
-  private final String bindAddress;
-
-  /**
-   * Connection timeout in milliseconds
-   */
-  private static final int connectTimeoutMillis = 1000;
-
-  /**
-   * Temporary constant whether to use old single thread per connection model for worker group
-   */
-  private boolean singleThreadPerConnection;
-
-  /**
-   * Logging level
-   */
-  private final String logLevel;
-
-  /**
-   * The cache instance pointer on this vm
-   */
-  private Cache cache;
-
-  /**
-   * Channel to be closed when shutting down
-   */
-  private Channel serverChannel;
-
-  /**
-   * Gem logwriter
-   */
-  private LogWriter logger;
-
-  private RegionProvider regionCache;
-
-  private final MetaCacheListener metaListener;
-
-  private EventLoopGroup bossGroup;
-  private EventLoopGroup workerGroup;
-  private final static int numExpirationThreads = 1;
-  private final ScheduledExecutorService expirationExecutor;
-
-  /**
-   * Map of futures to be executed for key expirations
-   */
-  private final ConcurrentMap<ByteArrayWrapper, ScheduledFuture<?>> expirationFutures;
-
-
-  /**
-   * The field that defines the name of the {@link Region} which holds all of the strings. The
-   * current value of this field is {@value #STRING_REGION}.
-   */
-  public static final String STRING_REGION = "ReDiS_StRiNgS";
-
-  /**
-   * The field that defines the name of the {@link Region} which holds all of the HyperLogLogs. The
-   * current value of this field is {@value #HLL_REGION}.
-   */
-  public static final String HLL_REGION = "ReDiS_HlL";
-
-  /**
-   * The field that defines the name of the {@link Region} which holds all of the Redis meta data.
-   * The current value of this field is {@value #REDIS_META_DATA_REGION}.
-   */
-  public static final String REDIS_META_DATA_REGION = "__ReDiS_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}, i.e. "PARTITION" would be used for {@link RegionShortcut#PARTITION}.
-   */
-  public static final String DEFAULT_REGION_SYS_PROP_NAME = "gemfireredis.regiontype";
-
-  /**
-   * System property name that can be used to set the number of threads to be used by the
-   * GeodeRedisServer
-   */
-  public static final String NUM_THREADS_SYS_PROP_NAME = "gemfireredis.numthreads";
-
-  /**
-   * The actual {@link RegionShortcut} type specified by the system property
-   * {@value #DEFAULT_REGION_SYS_PROP_NAME}.
-   */
-  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.
-   * 
-   * @return {@link RegionShortcut}
-   */
-  private static RegionShortcut setRegionType() {
-    String regionType = System.getProperty(DEFAULT_REGION_SYS_PROP_NAME, "PARTITION");
-    RegionShortcut type;
-    try {
-      type = RegionShortcut.valueOf(regionType);
-    } catch (Exception e) {
-      type = RegionShortcut.PARTITION;
-    }
-    return type;
-  }
-
-  /**
-   * Helper method to set the number of worker threads
-   * 
-   * @return If the System property {@value #NUM_THREADS_SYS_PROP_NAME} is set then that number is
-   *         used, otherwise 4 * # of cores
-   */
-  private int setNumWorkerThreads() {
-    String prop = System.getProperty(NUM_THREADS_SYS_PROP_NAME);
-    int numCores = Runtime.getRuntime().availableProcessors();
-    int def = 4 * numCores;
-    if (prop == null || prop.isEmpty())
-      return def;
-    int threads;
-    try {
-      threads = Integer.parseInt(prop);
-    } catch (NumberFormatException e) {
-      return def;
-    }
-    return threads;
-  }
-
-  /**
-   * Constructor for {@link GeodeRedisServer} that will start the server on the given port and bind
-   * to the first non-loopback address
-   * 
-   * @param port The port the server will bind to, will use {@value #DEFAULT_REDIS_SERVER_PORT} by
-   *        default
-   */
-  public GeodeRedisServer(int port) {
-    this(null, port, null);
-  }
-
-  /**
-   * Constructor for {@link GeodeRedisServer} that will start the server and bind to the given
-   * address and port
-   * 
-   * @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
-   */
-  public GeodeRedisServer(String bindAddress, int port) {
-    this(bindAddress, port, null);
-  }
-
-
-  /**
-   * Constructor for {@link GeodeRedisServer} that will start the 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
-   * @param logLevel The logging level to be used by GemFire
-   */
-  public GeodeRedisServer(String bindAddress, int port, String logLevel) {
-    if (port <= 0)
-      this.serverPort = DEFAULT_REDIS_SERVER_PORT;
-    else
-      this.serverPort = port;
-    this.bindAddress = bindAddress;
-    this.logLevel = logLevel;
-    this.numWorkerThreads = setNumWorkerThreads();
-    if (this.numWorkerThreads == 0)
-      this.singleThreadPerConnection = true;
-    this.numSelectorThreads = 1;
-    this.metaListener = new MetaCacheListener();
-    this.expirationFutures = new ConcurrentHashMap<ByteArrayWrapper, ScheduledFuture<?>>();
-    this.expirationExecutor =
-        Executors.newScheduledThreadPool(numExpirationThreads, new ThreadFactory() {
-          private final AtomicInteger counter = new AtomicInteger();
-
-          @Override
-          public Thread newThread(Runnable r) {
-            Thread t = new Thread(r);
-            t.setName("GemFireRedis-ScheduledExecutor-" + counter.incrementAndGet());
-            t.setDaemon(true);
-            return t;
-          }
-
-        });
-    this.DEFAULT_REGION_TYPE = setRegionType();
-    this.shutdown = false;
-    this.started = false;
-  }
-
-  /**
-   * Helper method to get the host name to bind to
-   * 
-   * @return The InetAddress to bind to
-   * @throws UnknownHostException
-   */
-  private InetAddress getBindAddress() throws UnknownHostException {
-    return this.bindAddress == null || this.bindAddress.isEmpty() ? SocketCreator.getLocalHost()
-        : InetAddress.getByName(this.bindAddress);
-  }
-
-  /**
-   * This is function to call on a {@link GeodeRedisServer} instance to start it running
-   */
-  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;
-    }
-  }
-
-  /**
-   * Initializes the {@link Cache}, and creates Redis necessities Region and protects declares that
-   * {@link Region} to be protected. Also, every {@link GeodeRedisServer} will check for entries
-   * already in the meta data Region.
-   */
-  private void startGemFire() {
-    Cache c = GemFireCacheImpl.getInstance();
-    if (c == null) {
-      synchronized (GeodeRedisServer.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) {
-      Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion;
-
-      Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion;
-      Region<String, RedisDataType> redisMetaData;
-      GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache;
-      try {
-        if ((stringsRegion = cache.getRegion(STRING_REGION)) == null) {
-          RegionFactory<ByteArrayWrapper, ByteArrayWrapper> regionFactory =
-              gemFireCache.createRegionFactory(this.DEFAULT_REGION_TYPE);
-          stringsRegion = regionFactory.create(STRING_REGION);
-        }
-        if ((hLLRegion = cache.getRegion(HLL_REGION)) == null) {
-          RegionFactory<ByteArrayWrapper, HyperLogLogPlus> regionFactory =
-              gemFireCache.createRegionFactory(this.DEFAULT_REGION_TYPE);
-          hLLRegion = regionFactory.create(HLL_REGION);
-        }
-        if ((redisMetaData = cache.getRegion(REDIS_META_DATA_REGION)) == null) {
-          AttributesFactory af = new AttributesFactory();
-          af.addCacheListener(metaListener);
-          af.setDataPolicy(DataPolicy.REPLICATE);
-          InternalRegionArguments ira =
-              new InternalRegionArguments().setInternalRegion(true).setIsUsedForMetaRegion(true);
-          redisMetaData = gemFireCache.createVMRegion(REDIS_META_DATA_REGION, af.create(), ira);
-        }
-      } catch (IOException | ClassNotFoundException e) {
-        // only if loading snapshot, not here
-        InternalGemFireError assErr = new InternalGemFireError(
-            LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
-        assErr.initCause(e);
-        throw assErr;
-      }
-      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);
-    }
-    checkForRegions();
-  }
-
-  private void checkForRegions() {
-    Collection<Entry<String, RedisDataType>> entrySet = this.regionCache.metaEntrySet();
-    for (Entry<String, RedisDataType> entry : entrySet) {
-      String regionName = entry.getKey();
-      RedisDataType type = entry.getValue();
-      Region<?, ?> newRegion = cache.getRegion(regionName);
-      if (newRegion == null && type != RedisDataType.REDIS_STRING && type != RedisDataType.REDIS_HLL
-          && type != RedisDataType.REDIS_PROTECTED) {
-        try {
-          this.regionCache
-              .createRemoteRegionReferenceLocally(Coder.stringToByteArrayWrapper(regionName), type);
-        } catch (Exception e) {
-          if (logger.errorEnabled())
-            logger.error(e);
-        }
-      }
-    }
-  }
-
-  /**
-   * Helper method to start the server listening for connections. The server is bound to the port
-   * specified by {@link GeodeRedisServer#serverPort}
-   * 
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  private void startRedisServer() throws IOException, InterruptedException {
-    ThreadFactory selectorThreadFactory = new ThreadFactory() {
-      private final AtomicInteger counter = new AtomicInteger();
-
-      @Override
-      public Thread newThread(Runnable r) {
-        Thread t = new Thread(r);
-        t.setName("GeodeRedisServer-SelectorThread-" + counter.incrementAndGet());
-        t.setDaemon(true);
-        return t;
-      }
-
-    };
-
-    ThreadFactory workerThreadFactory = new ThreadFactory() {
-      private final AtomicInteger counter = new AtomicInteger();
-
-      @Override
-      public Thread newThread(Runnable r) {
-        Thread t = new Thread(r);
-        t.setName("GeodeRedisServer-WorkerThread-" + counter.incrementAndGet());
-        return t;
-      }
-
-    };
-
-    bossGroup = null;
-    workerGroup = null;
-    Class<? extends ServerChannel> socketClass = null;
-    if (singleThreadPerConnection) {
-      bossGroup = new OioEventLoopGroup(Integer.MAX_VALUE, selectorThreadFactory);
-      workerGroup = new OioEventLoopGroup(Integer.MAX_VALUE, workerThreadFactory);
-      socketClass = OioServerSocketChannel.class;
-    } else {
-      bossGroup = new NioEventLoopGroup(this.numSelectorThreads, selectorThreadFactory);
-      workerGroup = new NioEventLoopGroup(this.numWorkerThreads, workerThreadFactory);
-      socketClass = NioServerSocketChannel.class;
-    }
-    InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
-    String pwd = system.getConfig().getRedisPassword();
-    final byte[] pwdB = Coder.stringToBytes(pwd);
-    ServerBootstrap b = new ServerBootstrap();
-    b.group(bossGroup, workerGroup).channel(socketClass)
-        .childHandler(new ChannelInitializer<SocketChannel>() {
-          @Override
-          public void initChannel(SocketChannel ch) throws Exception {
-            if (logger.fineEnabled())
-              logger.fine("GeodeRedisServer-Connection established with " + ch.remoteAddress());
-            ChannelPipeline p = ch.pipeline();
-            p.addLast(ByteToCommandDecoder.class.getSimpleName(), new ByteToCommandDecoder());
-            p.addLast(ExecutionHandlerContext.class.getSimpleName(),
-                new ExecutionHandlerContext(ch, cache, regionCache, GeodeRedisServer.this, pwdB));
-          }
-        }).option(ChannelOption.SO_REUSEADDR, true).option(ChannelOption.SO_RCVBUF, getBufferSize())
-        .childOption(ChannelOption.SO_KEEPALIVE, true)
-        .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, GeodeRedisServer.connectTimeoutMillis)
-        .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
-
-    // Bind and start to accept incoming connections.
-    ChannelFuture f = b.bind(new InetSocketAddress(getBindAddress(), serverPort)).sync();
-    if (this.logger.infoEnabled()) {
-      String logMessage = "GeodeRedisServer started {" + getBindAddress() + ":" + serverPort
-          + "}, Selector threads: " + this.numSelectorThreads;
-      if (this.singleThreadPerConnection)
-        logMessage += ", One worker thread per connection";
-      else
-        logMessage += ", Worker threads: " + this.numWorkerThreads;
-      this.logger.info(logMessage);
-    }
-    this.serverChannel = f.channel();
-  }
-
-  /**
-   * Takes an entry event and processes it. If the entry denotes that a
-   * {@link RedisDataType#REDIS_LIST} or {@link RedisDataType#REDIS_SORTEDSET} was created then this
-   * function will call the necessary calls to create the parameterized queries for those keys.
-   * 
-   * @param event EntryEvent from meta data region
-   */
-  private void afterKeyCreate(EntryEvent<String, RedisDataType> event) {
-    if (event.isOriginRemote()) {
-      final String key = (String) event.getKey();
-      final RedisDataType value = event.getNewValue();
-      if (value != RedisDataType.REDIS_STRING && value != RedisDataType.REDIS_HLL
-          && value != RedisDataType.REDIS_PROTECTED) {
-        try {
-          this.regionCache.createRemoteRegionReferenceLocally(Coder.stringToByteArrayWrapper(key),
-              value);
-        } catch (RegionDestroyedException ignore) { // Region already destroyed, ignore
-        }
-      }
-    }
-  }
-
-  /**
-   * When a key is removed then this function will make sure the associated queries with the key are
-   * also removed from each vm to avoid unnecessary data retention
-   */
-  private void afterKeyDestroy(EntryEvent<String, RedisDataType> event) {
-    if (event.isOriginRemote()) {
-      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) {
-        ByteArrayWrapper kW = Coder.stringToByteArrayWrapper(key);
-        Region<?, ?> r = this.regionCache.getRegion(kW);
-        if (r != null) {
-          this.regionCache.removeRegionReferenceLocally(kW, value);
-        }
-      }
-    }
-  }
-
-  private final class MetaCacheListener extends CacheListenerAdapter<String, RedisDataType> {
-
-    @Override
-    public void afterCreate(EntryEvent<String, RedisDataType> event) {
-      afterKeyCreate(event);
-    }
-
-    @Override
-    public void afterDestroy(EntryEvent<String, RedisDataType> event) {
-      afterKeyDestroy(event);
-    }
-  }
-
-  /**
-   * Helper method to get GemFire set socket buffer size, possibly a default of 32k
-   * 
-   * @return Buffer size to use for server
-   */
-  private int getBufferSize() {
-    InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
-    return system.getConfig().getSocketBufferSize();
-  }
-
-  /**
-   * Shutdown method for {@link GeodeRedisServer}. This closes the {@link Cache}, interrupts all
-   * execution and forcefully closes all connections.
-   */
-  public synchronized void shutdown() {
-    if (!shutdown) {
-      if (logger.infoEnabled())
-        logger.info("GeodeRedisServer 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;
-    }
-  }
-
-  /**
-   * Static main method that allows the {@link GeodeRedisServer} to be started from the command
-   * line. The supported command line arguments are
-   * <p>
-   * -port= <br>
-   * -bind-address= <br>
-   * -log-level=
-   * 
-   * @param args Command line args
-   */
-  public static void main(String[] args) {
-    int port = DEFAULT_REDIS_SERVER_PORT;
-    String bindAddress = null;
-    String logLevel = null;
-    for (String arg : args) {
-      if (arg.startsWith("-port"))
-        port = getPort(arg);
-      else if (arg.startsWith("-bind-address"))
-        bindAddress = getBindAddress(arg);
-      else if (arg.startsWith("-log-level"))
-        logLevel = getLogLevel(arg);
-    }
-    mainThread = Thread.currentThread();
-    GeodeRedisServer server = new GeodeRedisServer(bindAddress, port, logLevel);
-    server.start();
-    while (true) {
-      try {
-        Thread.sleep(Long.MAX_VALUE);
-      } catch (InterruptedException e1) {
-        break;
-      } catch (Exception e) {
-      }
-    }
-  }
-
-  /**
-   * Helper method to parse the port to a number
-   * 
-   * @param arg String where the argument is
-   * @return The port number when the correct syntax was used, otherwise will return
-   *         {@link #DEFAULT_REDIS_SERVER_PORT}
-   */
-  private static int getPort(String arg) {
-    int port = DEFAULT_REDIS_SERVER_PORT;
-    if (arg != null && arg.length() > 6) {
-      if (arg.startsWith("-port")) {
-        String p = arg.substring(arg.indexOf('=') + 1);
-        p = p.trim();
-        try {
-          port = Integer.parseInt(p);
-        } catch (NumberFormatException e) {
-          System.out.println("Unable to parse port, using default port");
-        }
-      }
-    }
-    return port;
-  }
-
-  /**
-   * Helper method to parse bind address
-   * 
-   * @param arg String holding bind address
-   * @return Bind address
-   */
-  private static String getBindAddress(String arg) {
-    String address = null;
-    if (arg != null && arg.length() > 14) {
-      if (arg.startsWith("-bind-address")) {
-        String p = arg.substring(arg.indexOf('=') + 1);
-        address = p.trim();
-      }
-    }
-    return address;
-  }
-
-  /**
-   * Helper method to parse log level
-   * 
-   * @param arg String holding log level
-   * @return Log level
-   */
-  private static String getLogLevel(String arg) {
-    String logLevel = null;
-    if (arg != null && arg.length() > 11) {
-      if (arg.startsWith("-log-level")) {
-        String p = arg.substring(arg.indexOf('=') + 1);
-        logLevel = p.trim();
-      }
-    }
-    return logLevel;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisService.java b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisService.java
new file mode 100644
index 0000000..e625bb9
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis;
+
+import org.apache.geode.internal.cache.CacheService;
+
+/**
+ * Created by ukohlmeyer on 2/9/17.
+ */
+public interface GeodeRedisService extends CacheService {
+
+  void start();
+
+  void stop();
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java b/geode-core/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java
deleted file mode 100755
index 4a0ef59..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/ByteArrayWrapper.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-
-import org.apache.geode.DataSerializable;
-import org.apache.geode.DataSerializer;
-
-/**
- * This class is a wrapper for the any Regions that need to store a byte[]. The only data this an
- * instance will store is a byte[] for the data but it is also serializable and comparable so it is
- * able to be used in querying
- * 
- *
- */
-public class ByteArrayWrapper implements DataSerializable, Comparable<ByteArrayWrapper> {
-  /**
-   * Generated serialVerionUID
-   */
-  private static final long serialVersionUID = 9066391742266642992L;
-
-  /**
-   * The data portion of ValueWrapper
-   */
-  private byte[] value;
-
-  /**
-   * Hash of {@link #value}, this value is cached for performance
-   */
-  private transient int hashCode;
-
-  private transient String toString;
-
-  /**
-   * Empty constructor for serialization
-   */
-  public ByteArrayWrapper() {}
-
-  /**
-   * Default constructor constructs a ValueWrapper and initialize the {@link #value}
-   * 
-   * @param value
-   */
-  public ByteArrayWrapper(byte[] value) {
-    this.value = value;
-    this.hashCode = Arrays.hashCode(value);
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeByteArray(value, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.value = DataSerializer.readByteArray(in);;
-    this.hashCode = Arrays.hashCode(this.value);
-  }
-
-  @Override
-  public String toString() {
-    if (toString == null)
-      toString = Coder.bytesToString(this.value);
-    return toString;
-  }
-
-  public byte[] toBytes() {
-    return this.value;
-  }
-
-  public void setBytes(byte[] bytes) {
-    this.value = bytes;
-    this.toString = null;
-    this.hashCode = Arrays.hashCode(bytes);
-  }
-
-  /**
-   * Getter for the length of the {@link #value} array
-   * 
-   * @return The length of the value array
-   */
-  public int length() {
-    return value.length;
-  }
-
-  /**
-   * Hash code for byte[] wrapped by this object, the actual hashcode is determined by
-   * Arrays.hashCode(byte[])
-   */
-  @Override
-  public int hashCode() {
-    return this.hashCode;
-  }
-
-
-  /**
-   * This equals is neither symmetric and therefore not transitive, because a String with the same
-   * underlying bytes is considered equal. Clearly calling {@link String#equals(Object)} would not
-   * yield the same result
-   */
-  @Override
-  public boolean equals(Object other) {
-    if (other instanceof ByteArrayWrapper)
-      return Arrays.equals(value, ((ByteArrayWrapper) other).value);
-    else if (other instanceof String) {
-      return Arrays.equals(value, Coder.stringToBytes((String) other));
-    }
-    return false;
-  }
-
-  /**
-   * This is a byte to byte comparator, it is not lexicographical but purely compares byte by byte
-   * values
-   */
-  @Override
-  public int compareTo(ByteArrayWrapper other) {
-    return arrayCmp(value, other.value);
-
-  }
-
-  /**
-   * Private helper method to compare two byte arrays, A.compareTo(B). The comparison is basically
-   * numerical, for each byte index, the byte representing the greater value will be the greater
-   * 
-   * @param A byte[]
-   * @param B byte[]
-   * @return 1 if A > B, -1 if B > A, 0 if A == B
-   */
-  private int arrayCmp(byte[] A, byte[] B) {
-    if (A == B)
-      return 0;
-    if (A == null) {
-      return -1;
-    } else if (B == null) {
-      return 1;
-    }
-
-    int len = Math.min(A.length, B.length);
-
-    for (int i = 0; i < len; i++) {
-      byte a = A[i];
-      byte b = B[i];
-      int diff = a - b;
-      if (diff > 0)
-        return 1;
-      else if (diff < 0)
-        return -1;
-    }
-
-    if (A.length > B.length)
-      return 1;
-    else if (B.length > A.length)
-      return -1;
-
-    return 0;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java b/geode-core/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java
deleted file mode 100644
index 124bf75..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/ByteToCommandDecoder.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is the first part of the channel pipeline for Netty. Here incoming bytes are read and a
- * created {@link Command} is sent down the pipeline. It is unfortunate that this class is not
- * {@link io.netty.channel.ChannelHandler.Sharable} because no state is kept in this class. State is
- * kept by {@link ByteToMessageDecoder}, it may be worthwhile to look at a different decoder setup
- * as to avoid allocating a decoder for every new connection.
- * <p>
- * The code flow of the protocol parsing may not be exactly Java like, but this is done very
- * intentionally. It was found that in cases where large Redis requests are sent that end up being
- * fragmented, throwing exceptions when the command could not be fully parsed took up an enormous
- * amount of cpu time. The simplicity of the Redis protocol allows us to just back out and wait for
- * more data, while exceptions are left to malformed requests which should never happen if using a
- * proper Redis client.
- * 
- *
- */
-public class ByteToCommandDecoder extends ByteToMessageDecoder {
-
-  /**
-   * Important note
-   * 
-   * Do not use '' <-- java primitive chars. Redis uses {@link Coder#CHARSET} encoding so we should
-   * not risk java handling char to byte conversions, rather just hard code {@link Coder#CHARSET}
-   * chars as bytes
-   */
-
-  private static final byte rID = 13; // '\r';
-  private static final byte nID = 10; // '\n';
-  private static final byte bulkStringID = 36; // '$';
-  private static final byte arrayID = 42; // '*';
-  private static final int MAX_BULK_STRING_LENGTH = 512 * 1024 * 1024; // 512 MB
-
-  public ByteToCommandDecoder() {}
-
-  @Override
-  protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
-    Command c = null;
-    do {
-      in.markReaderIndex();
-      c = parse(in);
-      if (c == null) {
-        in.resetReaderIndex();
-        return;
-      }
-      out.add(c);
-    } while (in.isReadable()); // Try to take advantage of pipelining if it is being used
-  }
-
-  private Command parse(ByteBuf buffer) throws RedisCommandParserException {
-    if (buffer == null)
-      throw new NullPointerException();
-    if (!buffer.isReadable())
-      return null;
-
-    byte firstB = buffer.readByte();
-    if (firstB != arrayID)
-      throw new RedisCommandParserException(
-          "Expected: " + (char) arrayID + " Actual: " + (char) firstB);
-    ArrayList<byte[]> commandElems = new ArrayList<byte[]>();
-
-    if (!parseArray(commandElems, buffer))
-      return null;
-
-    return new Command(commandElems);
-  }
-
-  private boolean parseArray(ArrayList<byte[]> commandElems, ByteBuf buffer)
-      throws RedisCommandParserException {
-    byte currentChar;
-    int arrayLength = parseCurrentNumber(buffer);
-    if (arrayLength == Integer.MIN_VALUE || !parseRN(buffer))
-      return false;
-    if (arrayLength < 0 || arrayLength > 1000000000)
-      throw new RedisCommandParserException("invalid multibulk length");
-
-    for (int i = 0; i < arrayLength; i++) {
-      if (!buffer.isReadable())
-        return false;
-      currentChar = buffer.readByte();
-      if (currentChar == bulkStringID) {
-        byte[] newBulkString = parseBulkString(buffer);
-        if (newBulkString == null)
-          return false;
-        commandElems.add(newBulkString);
-      } else
-        throw new RedisCommandParserException(
-            "expected: \'$\', got \'" + (char) currentChar + "\'");
-    }
-    return true;
-  }
-
-  /**
-   * Helper method to parse a bulk string when one is seen
-   * 
-   * @param buffer Buffer to read from
-   * @return byte[] representation of the Bulk String read
-   * @throws RedisCommandParserException Thrown when there is illegal syntax
-   */
-  private byte[] parseBulkString(ByteBuf buffer) throws RedisCommandParserException {
-    int bulkStringLength = parseCurrentNumber(buffer);
-    if (bulkStringLength == Integer.MIN_VALUE)
-      return null;
-    if (bulkStringLength > MAX_BULK_STRING_LENGTH)
-      throw new RedisCommandParserException(
-          "invalid bulk length, cannot exceed max length of " + MAX_BULK_STRING_LENGTH);
-    if (!parseRN(buffer))
-      return null;
-
-    if (!buffer.isReadable(bulkStringLength))
-      return null;
-    byte[] bulkString = new byte[bulkStringLength];
-    buffer.readBytes(bulkString);
-
-    if (!parseRN(buffer))
-      return null;
-
-    return bulkString;
-  }
-
-  /**
-   * Helper method to parse the number at the beginning of the buffer
-   * 
-   * @param buffer Buffer to read
-   * @return The number found at the beginning of the buffer
-   */
-  private int parseCurrentNumber(ByteBuf buffer) {
-    int number = 0;
-    int readerIndex = buffer.readerIndex();
-    byte b = 0;
-    while (true) {
-      if (!buffer.isReadable())
-        return Integer.MIN_VALUE;
-      b = buffer.readByte();
-      if (Character.isDigit(b)) {
-        number = number * 10 + (int) (b - '0');
-        readerIndex++;
-      } else {
-        buffer.readerIndex(readerIndex);
-        break;
-      }
-    }
-    return number;
-  }
-
-  /**
-   * Helper method that is called when the next characters are supposed to be "\r\n"
-   * 
-   * @param buffer Buffer to read from
-   * @throws RedisCommandParserException Thrown when the next two characters are not "\r\n"
-   */
-  private boolean parseRN(ByteBuf buffer) throws RedisCommandParserException {
-    if (!buffer.isReadable(2))
-      return false;
-    byte b = buffer.readByte();
-    if (b != rID)
-      throw new RedisCommandParserException(
-          "expected \'" + (char) rID + "\', got \'" + (char) b + "\'");
-    b = buffer.readByte();
-    if (b != nID)
-      throw new RedisCommandParserException(
-          "expected: \'" + (char) nID + "\', got \'" + (char) b + "\'");
-    return true;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/Command.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/Command.java b/geode-core/src/main/java/org/apache/geode/redis/internal/Command.java
deleted file mode 100755
index 2f91218..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/Command.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import io.netty.buffer.ByteBuf;
-
-import java.nio.channels.SocketChannel;
-import java.util.List;
-
-/**
- * The command class is used in holding a received Redis command. Each sent command resides in an
- * instance of this class. This class is designed to be used strictly by getter and setter methods.
- * 
- *
- */
-public class Command {
-
-  private final List<byte[]> commandElems;
-  private final RedisCommandType commandType;
-  private ByteBuf response;
-  private String key;
-  private ByteArrayWrapper bytes;
-
-  /**
-   * Constructor for {@link Command}. Must initialize Command with a {@link SocketChannel} and a
-   * {@link List} of command elements
-   * 
-   * @param commandElems List of elements in command
-   */
-  public Command(List<byte[]> commandElems) {
-    if (commandElems == null || commandElems.isEmpty())
-      throw new IllegalArgumentException(
-          "List of command elements cannot be empty -> List:" + commandElems);
-    this.commandElems = commandElems;
-    this.response = null;
-
-    RedisCommandType type;
-
-    try {
-      byte[] charCommand = commandElems.get(0);
-      String commandName = Coder.bytesToString(charCommand).toUpperCase();
-      type = RedisCommandType.valueOf(commandName);
-    } catch (Exception e) {
-      type = RedisCommandType.UNKNOWN;
-    }
-    this.commandType = type;
-
-  }
-
-  /**
-   * Used to get the command element list
-   * 
-   * @return List of command elements in form of {@link List}
-   */
-  public List<byte[]> getProcessedCommand() {
-    return this.commandElems;
-  }
-
-  /**
-   * Getter method for the command type
-   * 
-   * @return The command type
-   */
-  public RedisCommandType getCommandType() {
-    return this.commandType;
-  }
-
-  /**
-   * Getter method to get the response to be sent
-   * 
-   * @return The response
-   */
-  public ByteBuf getResponse() {
-    return response;
-  }
-
-  /**
-   * Setter method to set the response to be sent
-   * 
-   * @param response The response to be sent
-   */
-  public void setResponse(ByteBuf response) {
-    this.response = response;
-  }
-
-  public boolean hasError() {
-    if (response == null)
-      return false;
-
-    if (response.getByte(0) == Coder.ERROR_ID)
-      return true;
-
-    return false;
-  }
-
-  /**
-   * Convenience method to get a String representation of the key in a Redis command, always at the
-   * second position in the sent command array
-   * 
-   * @return Returns the second element in the parsed command list, which is always the key for
-   *         commands indicating a key
-   */
-  public String getStringKey() {
-    if (this.commandElems.size() > 1) {
-      if (this.bytes == null) {
-        this.bytes = new ByteArrayWrapper(this.commandElems.get(1));
-        this.key = this.bytes.toString();
-      } else if (this.key == null)
-        this.key = this.bytes.toString();
-      return this.key;
-    } else
-      return null;
-  }
-
-  public ByteArrayWrapper getKey() {
-    if (this.commandElems.size() > 1) {
-      if (this.bytes == null)
-        this.bytes = new ByteArrayWrapper(this.commandElems.get(1));
-      return this.bytes;
-    } else
-      return null;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder b = new StringBuilder();
-    for (byte[] bs : this.commandElems) {
-      b.append(Coder.bytesToString(bs));
-      b.append(' ');
-    }
-    return b.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java b/geode-core/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java
deleted file mode 100755
index 60cd130..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/DoubleWrapper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.geode.DataSerializable;
-import org.apache.geode.DataSerializer;
-
-/**
- * This is a wrapper class for doubles, similar to {@link ByteArrayWrapper}
- * 
- *
- */
-public class DoubleWrapper implements DataSerializable, Comparable<Object> {
-
-  private static final long serialVersionUID = 6946858357297398633L;
-
-  public Double score;
-  private String toString;
-
-  public DoubleWrapper() {}
-
-  public DoubleWrapper(Double dubs) {
-    this.score = dubs;
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeDouble(score, out);
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    this.score = DataSerializer.readDouble(in);
-  }
-
-  @Override
-  public int compareTo(Object arg0) {
-    Double other;
-    if (arg0 instanceof DoubleWrapper) {
-      other = ((DoubleWrapper) arg0).score;
-    } else if (arg0 instanceof Double) {
-      other = (Double) arg0;
-    } else
-      return 0;
-    Double diff = this.score - other;
-    if (diff > 0)
-      return 1;
-    else if (diff < 0)
-      return -1;
-    else
-      return 0;
-  }
-
-  public String toString() {
-    if (this.toString == null)
-      this.toString = Coder.doubleToString(score);
-    return this.toString;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java b/geode-core/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java
deleted file mode 100644
index e2b49be..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/ExecutionHandlerContext.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufAllocator;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelInboundHandlerAdapter;
-import io.netty.handler.codec.DecoderException;
-import io.netty.util.concurrent.EventExecutor;
-
-import java.io.IOException;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.geode.LogWriter;
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.RegionDestroyedException;
-import org.apache.geode.cache.TransactionException;
-import org.apache.geode.cache.TransactionId;
-import org.apache.geode.cache.UnsupportedOperationInTransactionException;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.RegionNotFoundException;
-import org.apache.geode.redis.internal.executor.transactions.TransactionExecutor;
-import org.apache.geode.redis.GeodeRedisServer;
-
-/**
- * This class extends {@link ChannelInboundHandlerAdapter} from Netty and it is the last part of the
- * channel pipeline. The {@link ByteToCommandDecoder} forwards a {@link Command} to this class which
- * executes it and sends the result back to the client. Additionally, all exception handling is done
- * by this class.
- * <p>
- * Besides being part of Netty's pipeline, this class also serves as a context to the execution of a
- * command. It abstracts transactions, provides access to the {@link RegionProvider} and anything
- * else an executing {@link Command} may need.
- * 
- *
- */
-public class ExecutionHandlerContext extends ChannelInboundHandlerAdapter {
-
-  private static final int WAIT_REGION_DSTRYD_MILLIS = 100;
-  private static final int MAXIMUM_NUM_RETRIES = (1000 * 60) / WAIT_REGION_DSTRYD_MILLIS; // 60
-                                                                                          // seconds
-                                                                                          // total
-
-  private final Cache cache;
-  private final GeodeRedisServer server;
-  private final LogWriter logger;
-  private final Channel channel;
-  private final AtomicBoolean needChannelFlush;
-  private final Runnable flusher;
-  private final EventExecutor lastExecutor;
-  private final ByteBufAllocator byteBufAllocator;
-  /**
-   * TransactionId for any transactions started by this client
-   */
-  private TransactionId transactionID;
-
-  /**
-   * Queue of commands for a given transaction
-   */
-  private Queue<Command> transactionQueue;
-  private final RegionProvider regionProvider;
-  private final byte[] authPwd;
-
-  private boolean isAuthenticated;
-
-  /**
-   * Default constructor for execution contexts.
-   * 
-   * @param ch Channel used by this context, should be one to one
-   * @param cache The Geode cache instance of this vm
-   * @param regionProvider The region provider of this context
-   * @param server Instance of the server it is attached to, only used so that any execution can
-   *        initiate a shutdwon
-   * @param pwd Authentication password for each context, can be null
-   */
-  public ExecutionHandlerContext(Channel ch, Cache cache, RegionProvider regionProvider,
-      GeodeRedisServer server, byte[] pwd) {
-    if (ch == null || cache == null || regionProvider == null || server == null)
-      throw new IllegalArgumentException("Only the authentication password may be null");
-    this.cache = cache;
-    this.server = server;
-    this.logger = cache.getLogger();
-    this.channel = ch;
-    this.needChannelFlush = new AtomicBoolean(false);
-    this.flusher = new Runnable() {
-
-      @Override
-      public void run() {
-        flushChannel();
-      }
-
-    };
-    this.lastExecutor = channel.pipeline().lastContext().executor();
-    this.byteBufAllocator = channel.alloc();
-    this.transactionID = null;
-    this.transactionQueue = null; // Lazy
-    this.regionProvider = regionProvider;
-    this.authPwd = pwd;
-    this.isAuthenticated = pwd != null ? false : true;
-  }
-
-  private void flushChannel() {
-    while (needChannelFlush.getAndSet(false)) {
-      channel.flush();
-    }
-  }
-
-  private void writeToChannel(ByteBuf message) {
-    channel.write(message, channel.voidPromise());
-    if (!needChannelFlush.getAndSet(true)) {
-      this.lastExecutor.execute(flusher);
-    }
-  }
-
-  /**
-   * This will handle the execution of received commands
-   */
-  @Override
-  public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
-    Command command = (Command) msg;
-    executeCommand(ctx, command);
-  }
-
-  /**
-   * Exception handler for the entire pipeline
-   */
-  @Override
-  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-    if (cause instanceof IOException) {
-      channelInactive(ctx);
-      return;
-    }
-    ByteBuf response = getExceptionResponse(ctx, cause);
-    writeToChannel(response);
-  }
-
-  private ByteBuf getExceptionResponse(ChannelHandlerContext ctx, Throwable cause) {
-    ByteBuf response;
-    if (cause instanceof RedisDataTypeMismatchException)
-      response = Coder.getWrongTypeResponse(this.byteBufAllocator, cause.getMessage());
-    else if (cause instanceof DecoderException
-        && cause.getCause() instanceof RedisCommandParserException)
-      response =
-          Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.PARSING_EXCEPTION_MESSAGE);
-    else if (cause instanceof RegionCreationException) {
-      this.logger.error(cause);
-      response =
-          Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.ERROR_REGION_CREATION);
-    } else if (cause instanceof InterruptedException || cause instanceof CacheClosedException)
-      response =
-          Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.SERVER_ERROR_SHUTDOWN);
-    else if (cause instanceof IllegalStateException) {
-      response = Coder.getErrorResponse(this.byteBufAllocator, cause.getMessage());
-    } else {
-      if (this.logger.errorEnabled())
-        this.logger.error("GeodeRedisServer-Unexpected error handler for " + ctx.channel(), cause);
-      response = Coder.getErrorResponse(this.byteBufAllocator, RedisConstants.SERVER_ERROR_MESSAGE);
-    }
-    return response;
-  }
-
-  @Override
-  public void channelInactive(ChannelHandlerContext ctx) {
-    if (logger.fineEnabled())
-      logger.fine("GeodeRedisServer-Connection closing with " + ctx.channel().remoteAddress());
-    ctx.channel().close();
-    ctx.close();
-  }
-
-  private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception {
-    RedisCommandType type = command.getCommandType();
-    Executor exec = type.getExecutor();
-    if (isAuthenticated) {
-      if (type == RedisCommandType.SHUTDOWN) {
-        this.server.shutdown();
-        return;
-      }
-      if (hasTransaction() && !(exec instanceof TransactionExecutor))
-        executeWithTransaction(ctx, exec, command);
-      else
-        executeWithoutTransaction(exec, command);
-
-      if (hasTransaction() && command.getCommandType() != RedisCommandType.MULTI) {
-        writeToChannel(
-            Coder.getSimpleStringResponse(this.byteBufAllocator, RedisConstants.COMMAND_QUEUED));
-      } else {
-        ByteBuf response = command.getResponse();
-        writeToChannel(response);
-      }
-    } else if (type == RedisCommandType.QUIT) {
-      exec.executeCommand(command, this);
-      ByteBuf response = command.getResponse();
-      writeToChannel(response);
-      channelInactive(ctx);
-    } else if (type == RedisCommandType.AUTH) {
-      exec.executeCommand(command, this);
-      ByteBuf response = command.getResponse();
-      writeToChannel(response);
-    } else {
-      ByteBuf r = Coder.getNoAuthResponse(this.byteBufAllocator, RedisConstants.ERROR_NOT_AUTH);
-      writeToChannel(r);
-    }
-  }
-
-  /**
-   * Private helper method to execute a command without a transaction, done for special exception
-   * handling neatness
-   * 
-   * @param exec Executor to use
-   * @param command Command to execute
-   * @throws Exception Throws exception if exception is from within execution and not to be handled
-   */
-  private void executeWithoutTransaction(final Executor exec, Command command) throws Exception {
-    Exception cause = null;
-    for (int i = 0; i < MAXIMUM_NUM_RETRIES; i++) {
-      try {
-        exec.executeCommand(command, this);
-        return;
-      } catch (Exception e) {
-        cause = e;
-        if (e instanceof RegionDestroyedException || e instanceof RegionNotFoundException
-            || e.getCause() instanceof QueryInvocationTargetException)
-          Thread.sleep(WAIT_REGION_DSTRYD_MILLIS);
-      }
-    }
-    throw cause;
-  }
-
-  private void executeWithTransaction(ChannelHandlerContext ctx, final Executor exec,
-      Command command) throws Exception {
-    CacheTransactionManager txm = cache.getCacheTransactionManager();
-    TransactionId transactionId = getTransactionID();
-    txm.resume(transactionId);
-    try {
-      exec.executeCommand(command, this);
-    } catch (UnsupportedOperationInTransactionException e) {
-      command.setResponse(Coder.getErrorResponse(this.byteBufAllocator,
-          RedisConstants.ERROR_UNSUPPORTED_OPERATION_IN_TRANSACTION));
-    } catch (TransactionException e) {
-      command.setResponse(Coder.getErrorResponse(this.byteBufAllocator,
-          RedisConstants.ERROR_TRANSACTION_EXCEPTION));
-    } catch (Exception e) {
-      ByteBuf response = getExceptionResponse(ctx, e);
-      command.setResponse(response);
-    }
-    getTransactionQueue().add(command);
-    transactionId = txm.suspend();
-    setTransactionID(transactionId);
-  }
-
-  /**
-   * Get the current transacationId
-   * 
-   * @return The current transactionId, null if one doesn't exist
-   */
-  public TransactionId getTransactionID() {
-    return this.transactionID;
-  }
-
-  /**
-   * Check if client has transaction
-   * 
-   * @return True if client has transaction, false otherwise
-   */
-  public boolean hasTransaction() {
-    return transactionID != null;
-  }
-
-  /**
-   * Setter method for transaction
-   * 
-   * @param id TransactionId of current transaction for client
-   */
-  public void setTransactionID(TransactionId id) {
-    this.transactionID = id;
-  }
-
-  /**
-   * Reset the transaction of client
-   */
-  public void clearTransaction() {
-    this.transactionID = null;
-    if (this.transactionQueue != null) {
-      for (Command c : this.transactionQueue) {
-        ByteBuf r = c.getResponse();
-        if (r != null)
-          r.release();
-      }
-      this.transactionQueue.clear();
-    }
-  }
-
-  /**
-   * Getter for transaction command queue
-   * 
-   * @return Command queue
-   */
-  public Queue<Command> getTransactionQueue() {
-    if (this.transactionQueue == null)
-      this.transactionQueue = new ConcurrentLinkedQueue<Command>();
-    return this.transactionQueue;
-  }
-
-  /**
-   * {@link ByteBuf} allocator for this context. All executors must use this pooled allocator as
-   * opposed to having unpooled buffers for maximum performance
-   * 
-   * @return allocator instance
-   */
-  public ByteBufAllocator getByteBufAllocator() {
-    return this.byteBufAllocator;
-  }
-
-  /**
-   * Gets the provider of Regions
-   * 
-   * @return Provider
-   */
-  public RegionProvider getRegionProvider() {
-    return this.regionProvider;
-  }
-
-  /**
-   * Getter for manager to allow pausing and resuming transactions
-   * 
-   * @return Instance
-   */
-  public CacheTransactionManager getCacheTransactionManager() {
-    return this.cache.getCacheTransactionManager();
-  }
-
-  /**
-   * Getter for logger
-   * 
-   * @return instance
-   */
-  public LogWriter getLogger() {
-    return this.cache.getLogger();
-  }
-
-  /**
-   * Get the channel for this context
-   * 
-   * @return instance
-   *
-   *         public Channel getChannel() { return this.channel; }
-   */
-
-  /**
-   * Get the authentication password, this will be same server wide. It is exposed here as opposed
-   * to {@link GeodeRedisServer}.
-   * 
-   * @return password
-   */
-  public byte[] getAuthPwd() {
-    return this.authPwd;
-  }
-
-  /**
-   * Checker if user has authenticated themselves
-   * 
-   * @return True if no authentication required or authentication complete, false otherwise
-   */
-  public boolean isAuthenticated() {
-    return this.isAuthenticated;
-  }
-
-  /**
-   * Lets this context know the authentication is complete
-   */
-  public void setAuthenticationVerified() {
-    this.isAuthenticated = true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/Executor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/Executor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/Executor.java
deleted file mode 100755
index 7698535..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/Executor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-
-/**
- * Interface for executors of a {@link Command}
- * 
- *
- */
-public interface Executor {
-
-  /**
-   * This method executes the command and sets the response. Any runtime errors from this execution
-   * should be handled by caller to ensure the client gets a response
-   * 
-   * @param command The command to be executed
-   * @param context The execution context by which this command is to be executed
-   */
-  public void executeCommand(Command command, ExecutionHandlerContext context);
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/Extendable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/Extendable.java b/geode-core/src/main/java/org/apache/geode/redis/internal/Extendable.java
deleted file mode 100644
index ed36030..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/Extendable.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-/**
- * This defines a command that can be extended, and there may need some level of abstraction
- * 
- *
- */
-public interface Extendable {
-
-  /**
-   * Getter for error message in case of argument arity mismatch
-   * 
-   * @return Error string
-   */
-  public String getArgsError();
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java b/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java
deleted file mode 100755
index 4ec154a..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/RedisCommandParserException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal;
-
-/**
- * Exception thrown by CommandParser (non-existent class) when a command has illegal syntax
- * 
- *
- */
-public class RedisCommandParserException extends Exception {
-
-  private static final long serialVersionUID = 4707944288714910949L;
-
-  public RedisCommandParserException() {
-    super();
-  }
-
-  public RedisCommandParserException(String message) {
-    super(message);
-  }
-
-  public RedisCommandParserException(Throwable cause) {
-    super(cause);
-  }
-
-  public RedisCommandParserException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-}


[16/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java
deleted file mode 100644
index a0a8f63..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/SortedSetQuery.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-public enum SortedSetQuery {
-
-  ZCOUNTNINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score <= $1";
-    }
-  },
-  ZCOUNTNINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score < $1";
-    }
-  },
-  ZCOUNTPINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score >= $1";
-    }
-  },
-  ZCOUNTPINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".values value WHERE value.score > $1";
-    }
-  },
-  ZCOUNTSTI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".values value WHERE value.score >= $1 AND value.score < $2";
-    }
-  },
-  ZCOUNTSTISI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".values value WHERE value.score >= $1 AND value.score <= $2";
-    }
-  },
-  ZCOUNTSI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".values value WHERE value.score > $1 AND value.score <= $2";
-    }
-  },
-  ZCOUNT {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".values value WHERE value.score > $1 AND value.score < $2";
-    }
-  },
-  ZLEXCOUNTNINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) <= 0";
-    }
-  },
-  ZLEXCOUNTNINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) < 0";
-    }
-  },
-  ZLEXCOUNTPINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) >= 0";
-    }
-  },
-  ZLEXCOUNTPINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath + ".keySet key WHERE key.compareTo($1) > 0";
-    }
-  },
-  ZLEXCOUNTSTI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) < 0";
-    }
-  },
-  ZLEXCOUNTSTISI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) <= 0";
-    }
-  },
-  ZLEXCOUNTSI {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) <= 0";
-    }
-  },
-  ZLEXCOUNT {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) < 0";
-    }
-  },
-  ZRANGEBYLEXNINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) <= 0 ORDER BY key asc LIMIT $2";
-    }
-  },
-  ZRANGEBYLEXNINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) < 0 ORDER BY key asc LIMIT $2";
-    }
-  },
-  ZRANGEBYLEXPINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) >= 0 ORDER BY key asc LIMIT $2";
-    }
-  },
-  ZRANGEBYLEXPINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) > 0 ORDER BY key asc LIMIT $2";
-    }
-  },
-  ZRANGEBYLEXSTI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) < 0 ORDER BY key asc LIMIT $3";
-    }
-  },
-  ZRANGEBYLEXSTISI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) >= 0 AND key.compareTo($2) <= 0 ORDER BY key asc LIMIT $3";
-    }
-  },
-  ZRANGEBYLEXSI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) <= 0 ORDER BY key asc LIMIT $3";
-    }
-  },
-  ZRANGEBYLEX {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT * FROM " + fullpath
-          + ".keySet key WHERE key.compareTo($1) > 0 AND key.compareTo($2) < 0 ORDER BY key asc LIMIT $3";
-    }
-  },
-  ZREMRANGEBYRANK {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry ORDER BY entry.value asc LIMIT $1";
-    }
-  },
-  ZRBSNINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE value.score <= $1 ORDER BY entry.value asc LIMIT $2";
-    }
-  },
-  ZRBSNINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score < $1 ORDER BY entry.value asc LIMIT $2";
-    }
-  },
-  ZRBSPINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score >= $1 ORDER BY entry.value asc LIMIT $2";
-    }
-  },
-  ZRBSPINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score > $1 ORDER BY entry.value asc LIMIT $2";
-    }
-  },
-  ZRBSSTISI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score <= $2 ORDER BY entry.value asc LIMIT $3";
-    }
-  },
-  ZRBSSTI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score < $2 ORDER BY entry.value asc LIMIT $3";
-    }
-  },
-  ZRBSSI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score <= $2 ORDER BY entry.value asc LIMIT $3";
-    }
-  },
-  ZRBS {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score < $2 ORDER BY entry.value asc LIMIT $3";
-    }
-  },
-  ZREVRBSNINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE value <= $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
-    }
-  },
-  ZREVRBSNINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score < $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
-    }
-  },
-  ZREVRBSPINFI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score >= $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
-    }
-  },
-  ZREVRBSPINF {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score > $1 ORDER BY entry.value desc, entry.key desc LIMIT $2";
-    }
-  },
-  ZREVRBSSTISI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score <= $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
-    }
-  },
-  ZREVRBSSTI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score >= $1 AND entry.value.score < $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
-    }
-  },
-  ZREVRBSSI {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score <= $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
-    }
-  },
-  ZREVRBS {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry WHERE entry.value.score > $1 AND entry.value.score < $2 ORDER BY entry.value desc, entry.key desc LIMIT $3";
-    }
-  },
-  ZREVRANGE {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry ORDER BY entry.value asc, entry.key asc LIMIT $1";
-    }
-  },
-  ZRANGE {
-    public String getQueryString(String fullpath) {
-      return "SELECT DISTINCT entry.key, entry.value FROM " + fullpath
-          + ".entrySet entry ORDER BY entry.value desc, entry.key desc LIMIT $1";
-    }
-  },
-  ZRANK {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".entrySet entry WHERE entry.value < $1 OR (entry.value = $2 AND entry.key.compareTo($3) < 0)";
-    }
-  },
-  ZREVRANK {
-    public String getQueryString(String fullpath) {
-      return "SELECT COUNT(*) FROM " + fullpath
-          + ".entrySet entry WHERE entry.value > $1 OR (entry.value = $2 AND entry.key.compareTo($3) > 0)";
-    }
-  };
-
-  public abstract String getQueryString(String fullpath);
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java
deleted file mode 100755
index 530e96a..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TTLExecutor.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
-public class TTLExecutor extends AbstractExecutor implements Extendable {
-
-  private final int NOT_EXISTS = -2;
-
-  private final int NO_TIMEOUT = -1;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    RegionProvider rC = context.getRegionProvider();
-    boolean exists = false;
-    RedisDataType val = rC.getRedisDataType(key);
-    if (val != null)
-      exists = true;
-
-    if (!exists) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-    long ttl = rC.getExpirationDelayMillis(key);
-
-    if (ttl == 0L) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NO_TIMEOUT));
-      return;
-    }
-
-    if (!timeUnitMillis())
-      ttl = ttl / millisInSecond;
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), ttl));
-  }
-
-  protected boolean timeUnitMillis() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.TTL;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java
deleted file mode 100755
index 6370f94..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TimeExecutor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import io.netty.buffer.ByteBuf;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-
-public class TimeExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    long timeStamp = System.currentTimeMillis();
-    long seconds = timeStamp / 1000;
-    long microSeconds = (timeStamp - (seconds * 1000)) * 1000;
-    byte[] secAr = Coder.longToBytes(seconds);
-    byte[] micAr = Coder.longToBytes(microSeconds);
-
-    ByteBuf response = context.getByteBufAllocator().buffer(50);
-    response.writeByte(Coder.ARRAY_ID);
-    response.writeByte(50); // #2
-    response.writeBytes(Coder.CRLFar);
-    response.writeByte(Coder.BULK_STRING_ID);
-    response.writeBytes(Coder.intToBytes(secAr.length));
-    response.writeBytes(Coder.CRLFar);
-    response.writeBytes(secAr);
-    response.writeBytes(Coder.CRLFar);
-    response.writeByte(Coder.BULK_STRING_ID);
-    response.writeBytes(Coder.intToBytes(micAr.length));
-    response.writeBytes(Coder.CRLFar);
-    response.writeBytes(micAr);
-    response.writeBytes(Coder.CRLFar);
-    command.setResponse(response);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java
deleted file mode 100755
index d97bc05..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/TypeExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import java.util.List;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class TypeExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.TYPE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    RedisDataType type = context.getRegionProvider().getRedisDataType(key);
-
-    if (type == null)
-      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), "none"));
-    else
-      command
-          .setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), type.toString()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java
deleted file mode 100755
index d5c2bba..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/UnkownExecutor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor;
-
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-
-public class UnkownExecutor extends AbstractExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    command.setResponse(
-        Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_UNKOWN_COMMAND));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java
deleted file mode 100755
index f9f4f19..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HDelExecutor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HDelExecutor extends HashExecutor {
-
-  private final int START_FIELDS_INDEX = 2;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HDEL));
-      return;
-    }
-
-    int numDeleted = 0;
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeleted));
-      return;
-    }
-
-
-    for (int i = START_FIELDS_INDEX; i < commandElems.size(); i++) {
-      ByteArrayWrapper field = new ByteArrayWrapper(commandElems.get(i));
-      Object oldValue = keyRegion.remove(field);
-      if (oldValue != null)
-        numDeleted++;
-    }
-    if (keyRegion.isEmpty()) {
-      context.getRegionProvider().removeKey(key, RedisDataType.REDIS_HASH);
-    }
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeleted));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
deleted file mode 100755
index 9cd673d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HExistsExecutor extends HashExecutor {
-
-  private final int NOT_EXISTS = 0;
-
-  private final int EXISTS = 1;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HEXISTS));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    byte[] byteField = commandElems.get(FIELD_INDEX);
-    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
-
-    boolean hasField = keyRegion.containsKey(field);
-
-    if (hasField)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTS));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java
deleted file mode 100755
index 1dbde81..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetAllExecutor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class HGetAllExecutor extends HashExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HGETALL));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Collection<Map.Entry<ByteArrayWrapper, ByteArrayWrapper>> entries =
-        new ArrayList(keyRegion.entrySet()); // This creates a CopyOnRead behavior
-
-    if (entries.isEmpty()) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    command.setResponse(Coder.getKeyValArrayResponse(context.getByteBufAllocator(), entries));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java
deleted file mode 100755
index 20d2220..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HGetExecutor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HGetExecutor extends HashExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HGET));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    byte[] byteField = commandElems.get(FIELD_INDEX);
-    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
-
-    ByteArrayWrapper valueWrapper = keyRegion.get(field);
-
-    if (valueWrapper != null) {
-      command.setResponse(
-          Coder.getBulkStringResponse(context.getByteBufAllocator(), valueWrapper.toBytes()));
-    } else
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java
deleted file mode 100755
index 695982f..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByExecutor.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HIncrByExecutor extends HashExecutor {
-
-  private final String ERROR_FIELD_NOT_USABLE = "The value at this field is not an integer";
-
-  private final String ERROR_INCREMENT_NOT_USABLE = "The increment on this key must be numeric";
-
-  private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
-  private final int FIELD_INDEX = 2;
-
-  private final int INCREMENT_INDEX = 3;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HINCRBY));
-      return;
-    }
-
-    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
-    long increment;
-
-    try {
-      increment = Coder.bytesToLong(incrArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
-
-    byte[] byteField = commandElems.get(FIELD_INDEX);
-    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
-
-    /*
-     * Put incrememnt as value if field doesn't exist
-     */
-
-    ByteArrayWrapper oldValue = keyRegion.get(field);
-
-    if (oldValue == null) {
-      keyRegion.put(field, new ByteArrayWrapper(incrArray));
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), increment));
-      return;
-    }
-
-    /*
-     * If the field did exist then increment the field
-     */
-
-    long value;
-
-    try {
-      value = Long.parseLong(oldValue.toString());
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_FIELD_NOT_USABLE));
-      return;
-    }
-
-    /*
-     * Check for overflow
-     */
-    if ((value >= 0 && increment > (Long.MAX_VALUE - value))
-        || (value <= 0 && increment < (Long.MIN_VALUE - value))) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
-      return;
-    }
-
-    value += increment;
-    // String newValue = String.valueOf(value);
-
-    keyRegion.put(field, new ByteArrayWrapper(Coder.longToBytes(value)));
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java
deleted file mode 100755
index 4c7cb3c..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HIncrByFloatExecutor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HIncrByFloatExecutor extends HashExecutor {
-
-  private final String ERROR_FIELD_NOT_USABLE =
-      "The value at this field cannot be incremented numerically because it is not a float";
-
-  private final String ERROR_INCREMENT_NOT_USABLE =
-      "The increment on this key must be floating point numeric";
-
-  private final int FIELD_INDEX = 2;
-
-  private final int INCREMENT_INDEX = 3;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HINCRBYFLOAT));
-      return;
-    }
-
-    byte[] incrArray = commandElems.get(INCREMENT_INDEX);
-    Double increment;
-
-    try {
-      increment = Coder.bytesToDouble(incrArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
-
-    byte[] byteField = commandElems.get(FIELD_INDEX);
-    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
-
-    /*
-     * Put incrememnt as value if field doesn't exist
-     */
-
-    ByteArrayWrapper oldValue = keyRegion.get(field);
-
-    if (oldValue == null) {
-      keyRegion.put(field, new ByteArrayWrapper(incrArray));
-      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), increment));
-      return;
-    }
-
-    /*
-     * If the field did exist then increment the field
-     */
-    String valueS = oldValue.toString();
-    if (valueS.contains(" ")) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_FIELD_NOT_USABLE));
-      return;
-    }
-    Double value;
-
-    try {
-      value = Coder.stringToDouble(valueS);
-    } catch (NumberFormatException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_FIELD_NOT_USABLE));
-      return;
-    }
-
-    value += increment;
-    keyRegion.put(field, new ByteArrayWrapper(Coder.doubleToBytes(value)));
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), value));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java
deleted file mode 100755
index 8d0a6b7..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HKeysExecutor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class HKeysExecutor extends HashExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HKEYS));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Set<ByteArrayWrapper> keys = new HashSet(keyRegion.keySet());
-
-    if (keys.isEmpty()) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    // String response = getBulkStringArrayResponse(keys);
-
-    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), keys));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java
deleted file mode 100755
index bcb37f1..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HLenExecutor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HLenExecutor extends HashExecutor {
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HLEN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    final int regionSize = keyRegion.size();
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), regionSize));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java
deleted file mode 100755
index bf1be2b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMGetExecutor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HMGetExecutor extends HashExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HMGET));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-
-    if (keyRegion == null) {
-      command.setResponse(
-          Coder.getArrayOfNils(context.getByteBufAllocator(), commandElems.size() - 2));
-      return;
-    }
-
-    ArrayList<ByteArrayWrapper> fields = new ArrayList<ByteArrayWrapper>();
-    for (int i = 2; i < commandElems.size(); i++) {
-      byte[] fieldArray = commandElems.get(i);
-      ByteArrayWrapper field = new ByteArrayWrapper(fieldArray);
-      fields.add(field);
-    }
-
-    Map<ByteArrayWrapper, ByteArrayWrapper> results = keyRegion.getAll(fields);
-
-    ArrayList<ByteArrayWrapper> values = new ArrayList<ByteArrayWrapper>();
-
-    /*
-     * This is done to preserve order in the output
-     */
-    for (ByteArrayWrapper field : fields)
-      values.add(results.get(field));
-
-    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), values));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java
deleted file mode 100755
index a7be53d..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HMSetExecutor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class HMSetExecutor extends HashExecutor {
-
-  private final String SUCCESS = "OK";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3 || commandElems.size() % 2 == 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HMSET));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
-
-    Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
-    for (int i = 2; i < commandElems.size(); i += 2) {
-      byte[] fieldArray = commandElems.get(i);
-      ByteArrayWrapper field = new ByteArrayWrapper(fieldArray);
-      byte[] value = commandElems.get(i + 1);
-      map.put(field, new ByteArrayWrapper(value));
-    }
-
-    keyRegion.putAll(map);
-
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
deleted file mode 100755
index bb5c394..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-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;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
-
-public class HScanExecutor extends AbstractScanExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HSCAN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
-        (Region<ByteArrayWrapper, ByteArrayWrapper>) context.getRegionProvider().getRegion(key);
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-    if (keyRegion == null) {
-      command.setResponse(
-          Coder.getScanResponse(context.getByteBufAllocator(), new ArrayList<String>()));
-      return;
-    }
-    byte[] cAr = commandElems.get(2);
-    String cursorString = Coder.bytesToString(cAr);
-
-    int cursor = 0;
-    Pattern matchPattern = null;
-    String globMatchPattern = null;
-    int count = DEFUALT_COUNT;
-    try {
-      cursor = Integer.parseInt(cursorString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-    if (cursor < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-
-    if (commandElems.size() > 4) {
-      try {
-        byte[] bytes = commandElems.get(3);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("MATCH")) {
-          bytes = commandElems.get(4);
-          globMatchPattern = Coder.bytesToString(bytes);
-        } else if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(4);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (commandElems.size() > 6) {
-      try {
-        byte[] bytes = commandElems.get(5);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("MATCH")) {
-          bytes = commandElems.get(6);
-          globMatchPattern = Coder.bytesToString(bytes);
-        } else if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(6);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (count < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-      return;
-    }
-
-    try {
-      matchPattern = convertGlobToRegex(globMatchPattern);
-    } catch (PatternSyntaxException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
-      return;
-    }
-
-    List<Object> returnList =
-        getIteration(new HashSet(keyRegion.entrySet()), matchPattern, count, cursor);
-
-    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  protected List<Object> getIteration(Collection<?> list, Pattern matchPattern, int count,
-      int cursor) {
-    List<Object> returnList = new ArrayList<Object>();
-    int size = list.size();
-    int beforeCursor = 0;
-    int numElements = 0;
-    int i = -1;
-    for (Entry<ByteArrayWrapper, ByteArrayWrapper> entry : (Collection<Entry<ByteArrayWrapper, ByteArrayWrapper>>) list) {
-      ByteArrayWrapper key = entry.getKey();
-      ByteArrayWrapper value = entry.getValue();
-      i++;
-      if (beforeCursor < cursor) {
-        beforeCursor++;
-        continue;
-      } else if (numElements < count) {
-        if (matchPattern != null) {
-          if (matchPattern.matcher(key.toString()).matches()) {
-            returnList.add(key);
-            returnList.add(value);
-            numElements++;
-          }
-        } else {
-          returnList.add(key);
-          returnList.add(value);
-          numElements++;
-        }
-      } else
-        break;
-    }
-
-    if (i == size - 1)
-      returnList.add(0, String.valueOf(0));
-    else
-      returnList.add(0, String.valueOf(i));
-    return returnList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java
deleted file mode 100755
index 34b3c8a..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetExecutor.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class HSetExecutor extends HashExecutor implements Extendable {
-
-  private final int EXISTING_FIELD = 0;
-
-  private final int NEW_FIELD = 1;
-
-  private final int VALUE_INDEX = 3;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
-
-    byte[] byteField = commandElems.get(FIELD_INDEX);
-    ByteArrayWrapper field = new ByteArrayWrapper(byteField);
-
-    byte[] value = commandElems.get(VALUE_INDEX);
-
-    Object oldValue;
-
-    if (onlySetOnAbsent())
-      oldValue = keyRegion.putIfAbsent(field, new ByteArrayWrapper(value));
-    else
-      oldValue = keyRegion.put(field, new ByteArrayWrapper(value));
-
-    if (oldValue == null)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NEW_FIELD));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTING_FIELD));
-
-  }
-
-  protected boolean onlySetOnAbsent() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.HSET;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java
deleted file mode 100755
index 5312527..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HSetNXExecutor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class HSetNXExecutor extends HSetExecutor {
-
-  @Override
-  protected boolean onlySetOnAbsent() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.HSETNX;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java
deleted file mode 100755
index 1ca8071..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HValsExecutor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class HValsExecutor extends HashExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HVALS));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_HASH, context);
-
-    Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Collection<ByteArrayWrapper> vals = new ArrayList(keyRegion.values());
-
-    if (vals.isEmpty()) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), vals));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java
deleted file mode 100755
index 1ef7a07..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HashExecutor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hash;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class HashExecutor extends AbstractExecutor {
-
-  protected final int FIELD_INDEX = 2;
-
-  @SuppressWarnings("unchecked")
-  protected Region<ByteArrayWrapper, ByteArrayWrapper> getOrCreateRegion(
-      ExecutionHandlerContext context, ByteArrayWrapper key, RedisDataType type) {
-    return (Region<ByteArrayWrapper, ByteArrayWrapper>) context.getRegionProvider()
-        .getOrCreateRegion(key, type, context);
-  }
-
-  @SuppressWarnings("unchecked")
-  protected Region<ByteArrayWrapper, ByteArrayWrapper> getRegion(ExecutionHandlerContext context,
-      ByteArrayWrapper key) {
-    return (Region<ByteArrayWrapper, ByteArrayWrapper>) context.getRegionProvider().getRegion(key);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java
deleted file mode 100755
index e440c09..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/HllExecutor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hll;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class HllExecutor extends AbstractExecutor {
-
-  public static final Double DEFAULT_HLL_STD_DEV = 0.081;
-  public static final Integer DEFAULT_HLL_DENSE = 18;
-  public static final Integer DEFAULT_HLL_SPARSE = 32;
-
-  protected final void checkAndSetDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
-    Object oldVal = context.getRegionProvider().metaPutIfAbsent(key, RedisDataType.REDIS_HLL);
-    if (oldVal == RedisDataType.REDIS_PROTECTED)
-      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
-    if (oldVal != null && oldVal != RedisDataType.REDIS_HLL)
-      throw new RedisDataTypeMismatchException(
-          "The key name \"" + key + "\" is already used by a " + oldVal.toString());
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java
deleted file mode 100755
index 8b3b337..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFAddExecutor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hll;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.internal.hll.HyperLogLogPlus;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class PFAddExecutor extends HllExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PFADD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    Region<ByteArrayWrapper, HyperLogLogPlus> keyRegion =
-        context.getRegionProvider().gethLLRegion();
-
-    HyperLogLogPlus hll = keyRegion.get(key);
-
-    boolean changed = false;
-
-    if (hll == null)
-      hll = new HyperLogLogPlus(DEFAULT_HLL_DENSE);
-
-    for (int i = 2; i < commandElems.size(); i++) {
-      byte[] bytes = commandElems.get(i);
-      boolean offerChange = hll.offer(bytes);
-      if (offerChange)
-        changed = true;
-    }
-
-    keyRegion.put(key, hll);
-
-    if (changed)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 1));
-    else
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java
deleted file mode 100755
index c550cce..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFCountExecutor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hll;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.internal.hll.CardinalityMergeException;
-import org.apache.geode.internal.hll.HyperLogLogPlus;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class PFCountExecutor extends HllExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PFCOUNT));
-      return;
-    }
-
-    Region<ByteArrayWrapper, HyperLogLogPlus> keyRegion =
-        context.getRegionProvider().gethLLRegion();
-
-    List<HyperLogLogPlus> hlls = new ArrayList<HyperLogLogPlus>();
-
-    for (int i = 1; i < commandElems.size(); i++) {
-      ByteArrayWrapper k = new ByteArrayWrapper(commandElems.get(i));
-      checkDataType(k, RedisDataType.REDIS_HLL, context);
-      HyperLogLogPlus h = keyRegion.get(k);
-      if (h != null)
-        hlls.add(h);
-    }
-    if (hlls.isEmpty()) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    HyperLogLogPlus tmp = hlls.remove(0);
-    HyperLogLogPlus[] estimators = hlls.toArray(new HyperLogLogPlus[hlls.size()]);
-    try {
-      tmp = (HyperLogLogPlus) tmp.merge(estimators);
-    } catch (CardinalityMergeException e) {
-      throw new RuntimeException(e);
-    }
-    long cardinality = tmp.cardinality();
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), cardinality));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java
deleted file mode 100755
index 6d0bb4f..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/hll/PFMergeExecutor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.hll;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.internal.hll.CardinalityMergeException;
-import org.apache.geode.internal.hll.HyperLogLogPlus;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class PFMergeExecutor extends HllExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.PFMERGE));
-      return;
-    }
-
-    ByteArrayWrapper destKey = command.getKey();
-    checkAndSetDataType(destKey, context);
-    Region<ByteArrayWrapper, HyperLogLogPlus> keyRegion =
-        context.getRegionProvider().gethLLRegion();
-    HyperLogLogPlus mergedHLL = keyRegion.get(destKey);
-    if (mergedHLL == null)
-      mergedHLL = new HyperLogLogPlus(DEFAULT_HLL_DENSE);
-    List<HyperLogLogPlus> hlls = new ArrayList<HyperLogLogPlus>();
-
-    for (int i = 2; i < commandElems.size(); i++) {
-      ByteArrayWrapper k = new ByteArrayWrapper(commandElems.get(i));
-      checkDataType(k, RedisDataType.REDIS_HLL, context);
-      HyperLogLogPlus h = keyRegion.get(k);
-      if (h != null)
-        hlls.add(h);
-    }
-    if (hlls.isEmpty()) {
-      context.getRegionProvider().removeKey(destKey);
-      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-      return;
-    }
-
-    HyperLogLogPlus[] estimators = hlls.toArray(new HyperLogLogPlus[hlls.size()]);
-    try {
-      mergedHLL = (HyperLogLogPlus) mergedHLL.merge(estimators);
-    } catch (CardinalityMergeException e) {
-      throw new RuntimeException(e);
-    }
-    keyRegion.put(destKey, mergedHLL);
-    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-  }
-
-}


[06/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java
new file mode 100644
index 0000000..149a7eb
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SCardExecutor.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class SCardExecutor extends SetExecutor {
+
+  private final int NOT_EXISTS = 0;
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SCARD));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_SET, context);
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java
new file mode 100644
index 0000000..5712237
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffExecutor.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+import java.util.Set;
+
+public class SDiffExecutor extends SetOpExecutor {
+
+  @Override
+  protected boolean isStorage() {
+    return false;
+  }
+
+  @Override
+  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
+      List<Set<ByteArrayWrapper>> setList) {
+    if (firstSet == null)
+      return null;
+    for (Set<ByteArrayWrapper> set : setList)
+      firstSet.removeAll(set);
+    return firstSet;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SDIFF;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java
new file mode 100644
index 0000000..63064da
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SDiffStoreExecutor.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class SDiffStoreExecutor extends SDiffExecutor {
+
+  @Override
+  protected boolean isStorage() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SDIFFSTORE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java
new file mode 100644
index 0000000..cc4bbe3
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterExecutor.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+import java.util.Set;
+
+public class SInterExecutor extends SetOpExecutor {
+
+  @Override
+  protected boolean isStorage() {
+    return false;
+  }
+
+  @Override
+  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
+      List<Set<ByteArrayWrapper>> setList) {
+    if (firstSet == null)
+      return null;
+    for (Set<ByteArrayWrapper> set : setList) {
+      if (set == null || set.isEmpty())
+        return null;
+      firstSet.retainAll(set);
+    }
+    return firstSet;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SINTER;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java
new file mode 100644
index 0000000..bef36ff
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SInterStoreExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class SInterStoreExecutor extends SInterExecutor {
+
+  @Override
+  protected boolean isStorage() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SINTERSTORE;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java
new file mode 100644
index 0000000..38593c1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SIsMemberExecutor.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class SIsMemberExecutor extends SetExecutor {
+
+  private final int EXISTS = 1;
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SISMEMBER));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
+
+    checkDataType(key, RedisDataType.REDIS_SET, context);
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    if (keyRegion.containsKey(member))
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTS));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java
new file mode 100644
index 0000000..73abb97
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMembersExecutor.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class SMembersExecutor extends SetExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SMEMBERS));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_SET, context);
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    Set<ByteArrayWrapper> members = new HashSet(keyRegion.keySet()); // Emulate copy on read
+
+    command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), members));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
new file mode 100644
index 0000000..4917b7b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class SMoveExecutor extends SetExecutor {
+
+  private final int MOVED = 1;
+
+  private final int NOT_MOVED = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SMOVE));
+      return;
+    }
+
+    ByteArrayWrapper source = command.getKey();
+    ByteArrayWrapper destination = new ByteArrayWrapper(commandElems.get(2));
+    ByteArrayWrapper mem = new ByteArrayWrapper(commandElems.get(3));
+
+    checkDataType(source, RedisDataType.REDIS_SET, context);
+    checkDataType(destination, RedisDataType.REDIS_SET, context);
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> sourceRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(source);
+
+    if (sourceRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_MOVED));
+      return;
+    }
+
+    Object oldVal = sourceRegion.get(mem);
+    sourceRegion.remove(mem);
+
+    if (oldVal == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_MOVED));
+      return;
+    }
+
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> destinationRegion =
+        (Region<ByteArrayWrapper, Boolean>) getOrCreateRegion(context, destination,
+            RedisDataType.REDIS_SET);
+    destinationRegion.put(mem, true);
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), MOVED));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
new file mode 100644
index 0000000..bf1ffd9
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+import java.util.Random;
+
+public class SPopExecutor extends SetExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SPOP));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+    if (keyRegion == null || keyRegion.isEmpty()) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    Random rand = new Random();
+
+    ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[keyRegion.size()]);
+
+    ByteArrayWrapper pop = entries[rand.nextInt(entries.length)];
+
+    keyRegion.remove(pop);
+    if (keyRegion.isEmpty()) {
+      context.getRegionProvider().removeKey(key);
+    }
+    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), pop.toBytes()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
new file mode 100644
index 0000000..61f6305
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+public class SRandMemberExecutor extends SetExecutor {
+
+  private final static String ERROR_NOT_NUMERIC = "The count provided must be numeric";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SRANDMEMBER));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+
+    int count = 1;
+
+    if (commandElems.size() > 2) {
+      try {
+        count = Coder.bytesToInt(commandElems.get(2));
+      } catch (NumberFormatException e) {
+        command
+            .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+        return;
+      }
+    }
+
+    if (keyRegion == null || count == 0) {
+      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    int members = keyRegion.size();
+
+    if (members <= count && count != 1) {
+      command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(),
+          new HashSet<ByteArrayWrapper>(keyRegion.keySet())));
+      return;
+    }
+
+    Random rand = new Random();
+
+    ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[members]);
+
+    if (count == 1) {
+      ByteArrayWrapper randEntry = entries[rand.nextInt(entries.length)];
+      command.setResponse(
+          Coder.getBulkStringResponse(context.getByteBufAllocator(), randEntry.toBytes()));
+    } else if (count > 0) {
+      Set<ByteArrayWrapper> randEntries = new HashSet<ByteArrayWrapper>();
+      do {
+        ByteArrayWrapper s = entries[rand.nextInt(entries.length)];
+        randEntries.add(s);
+      } while (randEntries.size() < count);
+      command.setResponse(
+          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), randEntries));
+    } else {
+      count = -count;
+      List<ByteArrayWrapper> randEntries = new ArrayList<ByteArrayWrapper>();
+      for (int i = 0; i < count; i++) {
+        ByteArrayWrapper s = entries[rand.nextInt(entries.length)];
+        randEntries.add(s);
+      }
+      command.setResponse(
+          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), randEntries));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
new file mode 100644
index 0000000..f9a97f0
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class SRemExecutor extends SetExecutor {
+
+  private final int NONE_REMOVED = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SREM));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_SET, context);
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NONE_REMOVED));
+      return;
+    }
+
+    int numRemoved = 0;
+
+    for (int i = 2; i < commandElems.size(); i++) {
+      Object oldVal;
+      oldVal = keyRegion.remove(new ByteArrayWrapper(commandElems.get(i)));
+      if (oldVal != null)
+        numRemoved++;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
new file mode 100644
index 0000000..585f75d
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class SScanExecutor extends AbstractScanExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SSCAN));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    checkDataType(key, RedisDataType.REDIS_SET, context);
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, Boolean> keyRegion =
+        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
+    if (keyRegion == null) {
+      command.setResponse(
+          Coder.getScanResponse(context.getByteBufAllocator(), new ArrayList<String>()));
+      return;
+    }
+    byte[] cAr = commandElems.get(2);
+    String cursorString = Coder.bytesToString(cAr);
+    int cursor = 0;
+    Pattern matchPattern = null;
+    String globMatchPattern = null;
+    int count = DEFUALT_COUNT;
+    try {
+      cursor = Integer.parseInt(cursorString);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+    if (cursor < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
+      return;
+    }
+
+    if (commandElems.size() > 4) {
+      try {
+        byte[] bytes = commandElems.get(3);
+        String tmp = Coder.bytesToString(bytes);
+        if (tmp.equalsIgnoreCase("MATCH")) {
+          bytes = commandElems.get(4);
+          globMatchPattern = Coder.bytesToString(bytes);
+        } else if (tmp.equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(4);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (commandElems.size() > 6) {
+      try {
+        byte[] bytes = commandElems.get(5);
+        String tmp = Coder.bytesToString(bytes);
+        if (tmp.equalsIgnoreCase("COUNT")) {
+          bytes = commandElems.get(6);
+          count = Coder.bytesToInt(bytes);
+        }
+      } catch (NumberFormatException e) {
+        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+        return;
+      }
+    }
+
+    if (count < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
+      return;
+    }
+
+    try {
+      matchPattern = convertGlobToRegex(globMatchPattern);
+    } catch (PatternSyntaxException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
+      return;
+    }
+
+    @SuppressWarnings("unchecked")
+    List<ByteArrayWrapper> returnList =
+        (List<ByteArrayWrapper>) getIteration(new ArrayList(keyRegion.keySet()), matchPattern,
+            count, cursor);
+
+    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
+    List<Object> returnList = new ArrayList<Object>();
+    int size = list.size();
+    int beforeCursor = 0;
+    int numElements = 0;
+    int i = -1;
+    for (ByteArrayWrapper value : (Collection<ByteArrayWrapper>) list) {
+      String key = Coder.bytesToString(value.toBytes());
+      i++;
+      if (beforeCursor < cursor) {
+        beforeCursor++;
+        continue;
+      } else if (numElements < count) {
+        if (matchPattern != null) {
+          if (matchPattern.matcher(key).matches()) {
+            returnList.add(value);
+            numElements++;
+          }
+        } else {
+          returnList.add(value);
+          numElements++;
+        }
+      } else
+        break;
+    }
+
+    if (i == size - 1)
+      returnList.add(0, String.valueOf(0));
+    else
+      returnList.add(0, String.valueOf(i));
+    return returnList;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
new file mode 100644
index 0000000..15705c1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class SUnionExecutor extends SetOpExecutor {
+
+  @Override
+  protected boolean isStorage() {
+    return false;
+  }
+
+  @Override
+  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
+      List<Set<ByteArrayWrapper>> setList) {
+    Set<ByteArrayWrapper> addSet = firstSet;
+    for (Set<ByteArrayWrapper> set : setList) {
+      if (addSet == null) {
+        addSet = new HashSet<ByteArrayWrapper>(set);
+        continue;
+      }
+      addSet.addAll(set);
+    }
+    return addSet;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SUNION;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
new file mode 100644
index 0000000..96b07e0
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+
+public class SUnionStoreExecutor extends SUnionExecutor {
+
+  @Override
+  protected boolean isStorage() {
+    return true;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.SUNIONSTORE;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
new file mode 100644
index 0000000..0227e88
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+public abstract class SetExecutor extends AbstractExecutor {
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
new file mode 100644
index 0000000..df757af
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.set;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RegionProvider;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public abstract class SetOpExecutor extends SetExecutor implements Extendable {
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+    int setsStartIndex = isStorage() ? 2 : 1;
+    if (commandElems.size() < setsStartIndex + 1) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+    RegionProvider rC = context.getRegionProvider();
+    ByteArrayWrapper destination = null;
+    if (isStorage())
+      destination = command.getKey();
+
+    ByteArrayWrapper firstSetKey = new ByteArrayWrapper(commandElems.get(setsStartIndex++));
+    if (!isStorage())
+      checkDataType(firstSetKey, RedisDataType.REDIS_SET, context);
+    Region<ByteArrayWrapper, Boolean> region =
+        (Region<ByteArrayWrapper, Boolean>) rC.getRegion(firstSetKey);
+    Set<ByteArrayWrapper> firstSet = null;
+    if (region != null) {
+      firstSet = new HashSet<ByteArrayWrapper>(region.keySet());
+    }
+    ArrayList<Set<ByteArrayWrapper>> setList = new ArrayList<Set<ByteArrayWrapper>>();
+    for (int i = setsStartIndex; i < commandElems.size(); i++) {
+      ByteArrayWrapper key = new ByteArrayWrapper(commandElems.get(i));
+      checkDataType(key, RedisDataType.REDIS_SET, context);
+      region = (Region<ByteArrayWrapper, Boolean>) rC.getRegion(key);
+      if (region != null)
+        setList.add(region.keySet());
+      else if (this instanceof SInterExecutor)
+        setList.add(null);
+    }
+    if (setList.isEmpty()) {
+      if (isStorage()) {
+        command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+        context.getRegionProvider().removeKey(destination);
+      } else {
+        if (firstSet == null)
+          command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+        else
+          command.setResponse(
+              Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), firstSet));
+      }
+      return;
+    }
+
+    Set<ByteArrayWrapper> resultSet = setOp(firstSet, setList);
+    if (isStorage()) {
+      Region<ByteArrayWrapper, Boolean> newRegion = null; // (Region<ByteArrayWrapper, Boolean>)
+                                                          // rC.getRegion(destination);
+      rC.removeKey(destination);
+      if (resultSet != null) {
+        Map<ByteArrayWrapper, Boolean> map = new HashMap<ByteArrayWrapper, Boolean>();
+        for (ByteArrayWrapper entry : resultSet)
+          map.put(entry, Boolean.TRUE);
+        if (!map.isEmpty()) {
+          newRegion = (Region<ByteArrayWrapper, Boolean>) rC.getOrCreateRegion(destination,
+              RedisDataType.REDIS_SET, context);
+          newRegion.putAll(map);
+        }
+        command
+            .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), resultSet.size()));
+      } else {
+        command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
+      }
+    } else {
+      if (resultSet == null || resultSet.isEmpty())
+        command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      else
+        command.setResponse(
+            Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), resultSet));
+    }
+  }
+
+  protected abstract boolean isStorage();
+
+  protected abstract Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
+      List<Set<ByteArrayWrapper>> setList);
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
new file mode 100644
index 0000000..5330c80
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.AbstractExecutor;
+
+public abstract class SortedSetExecutor extends AbstractExecutor {
+
+  @Override
+  protected Region<ByteArrayWrapper, DoubleWrapper> getOrCreateRegion(
+      ExecutionHandlerContext context, ByteArrayWrapper key, RedisDataType type) {
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, DoubleWrapper> r = (Region<ByteArrayWrapper, DoubleWrapper>) context
+        .getRegionProvider().getOrCreateRegion(key, type, context);
+    return r;
+  }
+
+  protected Region<ByteArrayWrapper, DoubleWrapper> getRegion(ExecutionHandlerContext context,
+      ByteArrayWrapper key) {
+    @SuppressWarnings("unchecked")
+    Region<ByteArrayWrapper, DoubleWrapper> r =
+        (Region<ByteArrayWrapper, DoubleWrapper>) context.getRegionProvider().getRegion(key);
+    return r;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
new file mode 100644
index 0000000..40fda1b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ZAddExecutor extends SortedSetExecutor {
+
+  private final String ERROR_NOT_NUMERICAL = "The inteded score is not a float";
+
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4 || commandElems.size() % 2 == 1) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZADD));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    int numberOfAdds = 0;
+
+    if (commandElems.size() > 4) {
+      Map<ByteArrayWrapper, DoubleWrapper> map = new HashMap<ByteArrayWrapper, DoubleWrapper>();
+      for (int i = 2; i < commandElems.size(); i++) {
+        byte[] scoreArray = commandElems.get(i++);
+        byte[] memberArray = commandElems.get(i);
+
+        Double score;
+        try {
+          score = Coder.bytesToDouble(scoreArray);
+        } catch (NumberFormatException e) {
+          command.setResponse(
+              Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERICAL));
+          return;
+        }
+
+        map.put(new ByteArrayWrapper(memberArray), new DoubleWrapper(score));
+        numberOfAdds++;
+      }
+      Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
+          getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
+      keyRegion.putAll(map);
+    } else {
+      byte[] scoreArray = commandElems.get(2);
+      byte[] memberArray = commandElems.get(3);
+      Double score;
+      try {
+        score = Coder.bytesToDouble(scoreArray);
+      } catch (NumberFormatException e) {
+        command.setResponse(
+            Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERICAL));
+        return;
+      }
+      Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
+          getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
+      Object oldVal = keyRegion.put(new ByteArrayWrapper(memberArray), new DoubleWrapper(score));
+
+      if (oldVal == null)
+        numberOfAdds = 1;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numberOfAdds));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
new file mode 100644
index 0000000..ad8130e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class ZCardExecutor extends SortedSetExecutor {
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCARD));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+
+    if (keyRegion == null)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+    else
+      command
+          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size()));
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
new file mode 100644
index 0000000..21c62c8
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.List;
+
+public class ZCountExecutor extends SortedSetExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCOUNT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    boolean startInclusive = true;
+    boolean stopInclusive = true;
+    double start;
+    double stop;
+
+    byte[] startArray = commandElems.get(2);
+    byte[] stopArray = commandElems.get(3);
+    String startString = Coder.bytesToString(startArray);
+    String stopString = Coder.bytesToString(stopArray);
+
+    if (startArray[0] == Coder.OPEN_BRACE_ID) {
+      startString = startString.substring(1);
+      startInclusive = false;
+    }
+    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
+      stopString = stopString.substring(1);
+      stopInclusive = false;
+    }
+
+    try {
+      start = Coder.stringToDouble(startString);
+      stop = Coder.stringToDouble(stopString);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+
+    int count;
+    try {
+      count = getCount(key, keyRegion, context, start, stop, startInclusive, stopInclusive);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), count));
+  }
+
+  private int getCount(ByteArrayWrapper key, Region<ByteArrayWrapper, DoubleWrapper> keyRegion,
+      ExecutionHandlerContext context, double start, double stop, boolean startInclusive,
+      boolean stopInclusive) throws FunctionDomainException, TypeMismatchException,
+      NameResolutionException, QueryInvocationTargetException {
+    if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY)
+      return keyRegion.size();
+    else if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY)
+      return 0;
+
+    Query query;
+    Object[] params;
+    if (start == Double.NEGATIVE_INFINITY) {
+      if (stopInclusive) {
+        query = getQuery(key, SortedSetQuery.ZCOUNTNINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZCOUNTNINF, context);
+      }
+      params = new Object[] {stop};
+    } else if (stop == Double.POSITIVE_INFINITY) {
+      if (startInclusive) {
+        query = getQuery(key, SortedSetQuery.ZCOUNTPINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZCOUNTPINF, context);
+      }
+      params = new Object[] {start};
+    } else {
+      if (startInclusive) {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZCOUNTSTISI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZCOUNTSTI, context);
+        }
+      } else {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZCOUNTSI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZCOUNT, context);
+        }
+      }
+      params = new Object[] {start, stop};
+    }
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    return (Integer) results.asList().get(0);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
new file mode 100644
index 0000000..ff3195a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class ZIncrByExecutor extends SortedSetExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
+  private final String ERROR_NAN = "This increment is illegal because it would result in a NaN";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() != 4) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZINCRBY));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
+
+    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(3));
+
+    double incr;
+
+    try {
+      byte[] incrArray = commandElems.get(2);
+      incr = Coder.bytesToDouble(incrArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+      return;
+    }
+
+    DoubleWrapper score = keyRegion.get(member);
+
+    if (score == null) {
+      keyRegion.put(member, new DoubleWrapper(incr));
+      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), incr));
+      return;
+    }
+    double result = score.score + incr;
+    if (Double.isNaN(result)) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NAN));
+      return;
+    }
+    score.score = result;
+    keyRegion.put(member, score);
+    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), score.score));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
new file mode 100644
index 0000000..df326c7
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.List;
+
+public class ZLexCountExecutor extends SortedSetExecutor {
+
+  private final String ERROR_ILLEGAL_SYNTAX =
+      "The min and max strings must either start with a (, [ or be - or +";
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZLEXCOUNT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
+    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+      return;
+    }
+
+    boolean minInclusive = false;
+    boolean maxInclusive = false;
+
+    byte[] minArray = commandElems.get(2);
+    byte[] maxArray = commandElems.get(3);
+    String startString = Coder.bytesToString(minArray);
+    String stopString = Coder.bytesToString(maxArray);
+
+    if (minArray[0] == Coder.OPEN_BRACE_ID) {
+      startString = startString.substring(1);
+      minInclusive = false;
+    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
+      startString = startString.substring(1);
+      minInclusive = true;
+    } else if (minArray[0] != Coder.HYPHEN_ID) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
+      return;
+    }
+
+    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
+      stopString = stopString.substring(1);
+      maxInclusive = false;
+    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
+      stopString = stopString.substring(1);
+      maxInclusive = true;
+    } else if (maxArray[0] != Coder.PLUS_ID) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
+      return;
+    }
+
+
+    int count;
+    try {
+      count = getCount(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
+          Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive);
+    } catch (Exception e) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), e.toString()));
+      return;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), count));
+  }
+
+  private int getCount(ByteArrayWrapper key, Region<ByteArrayWrapper, DoubleWrapper> keyRegion,
+      ExecutionHandlerContext context, ByteArrayWrapper start, ByteArrayWrapper stop,
+      boolean startInclusive, boolean stopInclusive) throws Exception {
+    if (start.equals("-") && stop.equals("+"))
+      return keyRegion.size();
+    else if (start.equals("+") || stop.equals("-"))
+      return 0;
+
+    Query query;
+    Object[] params;
+    if (start.equals("-")) {
+      if (stopInclusive) {
+        query = getQuery(key, SortedSetQuery.ZLEXCOUNTNINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZLEXCOUNTNINF, context);
+      }
+      params = new Object[] {stop};
+    } else if (stop.equals("+")) {
+      if (startInclusive) {
+        query = getQuery(key, SortedSetQuery.ZLEXCOUNTPINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZLEXCOUNTPINF, context);
+      }
+      params = new Object[] {start};
+    } else {
+      if (startInclusive) {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSTISI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSTI, context);
+        }
+      } else {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZLEXCOUNT, context);
+        }
+      }
+      params = new Object[] {start, stop};
+    }
+
+    SelectResults<?> results = (SelectResults<?>) query.execute(params);
+
+    return (Integer) results.asList().get(0);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
new file mode 100644
index 0000000..e41b730
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import io.netty.buffer.ByteBuf;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.DoubleWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+public class ZRangeByLexExecutor extends SortedSetExecutor {
+
+  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
+
+  private final String ERROR_ILLEGAL_SYNTAX =
+      "The min and max strings must either start with a (, [ or be - or +";
+
+  private final String ERROR_LIMIT = "The offset and count cannot be negative";
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 4) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZRANGEBYLEX));
+      return;
+    }
+
+    boolean existsLimit = false;
+
+    if (commandElems.size() >= 7) {
+      byte[] fifthElem = commandElems.get(4);
+      existsLimit = Coder.bytesToString(fifthElem).equalsIgnoreCase("LIMIT");
+    }
+
+    int offset = 0;
+    int limit = 0;
+
+    if (existsLimit) {
+      try {
+        byte[] offsetArray = commandElems.get(5);
+        byte[] limitArray = commandElems.get(6);
+        offset = Coder.bytesToInt(offsetArray);
+        limit = Coder.bytesToInt(limitArray);
+      } catch (NumberFormatException e) {
+        command
+            .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
+        return;
+      }
+    }
+
+    if (offset < 0 || limit < 0) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_LIMIT));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
+        getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
+
+    if (keyRegion == null) {
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+      return;
+    }
+
+    boolean minInclusive = false;
+    boolean maxInclusive = false;
+
+    byte[] minArray = commandElems.get(2);
+    byte[] maxArray = commandElems.get(3);
+    String startString = Coder.bytesToString(minArray);
+    String stopString = Coder.bytesToString(maxArray);
+    if (minArray[0] == Coder.OPEN_BRACE_ID) {
+      startString = startString.substring(1);
+      minInclusive = false;
+    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
+      startString = startString.substring(1);
+      minInclusive = true;
+    } else if (minArray[0] != Coder.HYPHEN_ID) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
+      return;
+    }
+
+    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
+      stopString = stopString.substring(1);
+      maxInclusive = false;
+    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
+      stopString = stopString.substring(1);
+      maxInclusive = true;
+    } else if (maxArray[0] != Coder.PLUS_ID) {
+      command
+          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
+      return;
+    }
+    Collection<ByteArrayWrapper> list = null;
+    if (!(existsLimit && limit == 0)) {
+      try {
+        list = getRange(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
+            Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive, offset, limit);
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+    }
+    if (list == null)
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+    else
+      command.setResponse(getCustomBulkStringArrayResponse(list, context));
+  }
+
+  private List<ByteArrayWrapper> getRange(ByteArrayWrapper key,
+      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
+      ByteArrayWrapper start, ByteArrayWrapper stop, boolean startInclusive, boolean stopInclusive,
+      int offset, int limit) throws FunctionDomainException, TypeMismatchException,
+      NameResolutionException, QueryInvocationTargetException {
+    if (start.equals("-") && stop.equals("+")) {
+      List<ByteArrayWrapper> l = new ArrayList<ByteArrayWrapper>(keyRegion.keySet());
+      int size = l.size();
+      Collections.sort(l);
+      if (limit == 0)
+        limit += size;
+      l = l.subList(Math.min(size, offset), Math.min(offset + limit, size));
+      return l;
+    } else if (start.equals("+") || stop.equals("-"))
+      return null;
+
+    Query query;
+    Object[] params;
+    if (start.equals("-")) {
+      if (stopInclusive) {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINF, context);
+      }
+      params = new Object[] {stop, INFINITY_LIMIT};
+    } else if (stop.equals("+")) {
+      if (startInclusive) {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINFI, context);
+      } else {
+        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINF, context);
+      }
+      params = new Object[] {start, INFINITY_LIMIT};
+    } else {
+      if (startInclusive) {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTISI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTI, context);
+        }
+      } else {
+        if (stopInclusive) {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSI, context);
+        } else {
+          query = getQuery(key, SortedSetQuery.ZRANGEBYLEX, context);
+        }
+      }
+      params = new Object[] {start, stop, INFINITY_LIMIT};
+    }
+    if (limit > 0)
+      params[params.length - 1] = (limit + offset);
+    SelectResults<ByteArrayWrapper> results =
+        (SelectResults<ByteArrayWrapper>) query.execute(params);
+    List<ByteArrayWrapper> list = results.asList();
+    int size = list.size();
+    return list.subList(Math.min(size, offset), size);
+
+  }
+
+  private final ByteBuf getCustomBulkStringArrayResponse(Collection<ByteArrayWrapper> items,
+      ExecutionHandlerContext context) {
+    Iterator<ByteArrayWrapper> it = items.iterator();
+    ByteBuf response = context.getByteBufAllocator().buffer();
+    response.writeByte(Coder.ARRAY_ID);
+    response.writeBytes(Coder.intToBytes(items.size()));
+    response.writeBytes(Coder.CRLFar);
+
+    while (it.hasNext()) {
+      ByteArrayWrapper next = it.next();
+      byte[] byteAr = next.toBytes();
+      response.writeByte(Coder.BULK_STRING_ID);
+      response.writeBytes(Coder.intToBytes(byteAr.length));
+      response.writeBytes(Coder.CRLFar);
+      response.writeBytes(byteAr);
+      response.writeBytes(Coder.CRLFar);
+    }
+
+    return response;
+  }
+
+}


[20/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLogPlus.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLogPlus.java b/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLogPlus.java
deleted file mode 100755
index fc4b6e5..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLogPlus.java
+++ /dev/null
@@ -1,1866 +0,0 @@
-/*
- * Copyright (C) 2011 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-import org.apache.geode.redis.internal.executor.hll.Varint;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-
-/**
- * Implementation of HyperLogLog++ described in
- * <p/>
- * <p>
- * http://static.googleusercontent.com/external_content/untrusted_dlcp/research.google.com/en/us/pubs/archive/40671.pdf
- * </p>
- * <p/>
- * Brief HyperLogLog++ Overview
- * <p/>
- * Uses 64 bit hashing instead of 32 Has two representation modes: sparse and normal
- * <p/>
- * 'normal' is approximately the same as regular hyperloglog (still uses 64 bits)
- * <p/>
- * 'sparse' handles lower cardinality values with a highly accurate but poorly scaling strategy and
- * leverages data compression to compete with 'normal' for as long as possible (sparse has the
- * advantage on accuracy per unit of memory at low cardinality but quickly falls behind).
- */
-public class HyperLogLogPlus implements ICardinality, Serializable {
-
-  private static final long serialVersionUID = 7504952025744337762L;
-
-  private enum Format {
-    SPARSE, NORMAL
-  }
-
-  /**
-   * used to mark codec version for serialization
-   */
-  private static final int VERSION = 2;
-
-  // threshold and bias data taken from google's bias correction data set:
-  // https://docs.google.com/document/d/1gyjfMHy43U9OWBXxfaeG-3MjGzejW1dlpyMwEYAAWEI/view?fullscreen#
-  static final double[] thresholdData =
-      {10, 20, 40, 80, 220, 400, 900, 1800, 3100, 6500, 15500, 20000, 50000, 120000, 350000};
-
-  static final double[][] rawEstimateData = {
-      // precision 4
-      {11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722,
-          17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766,
-          24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996,
-          32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966,
-          41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506,
-          51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482,
-          61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928,
-          70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394,},
-      // precision 5
-      {23, 23.1194, 23.8208, 24.2318, 24.77, 25.2436, 25.7774, 26.2848, 26.8224, 27.3742, 27.9336,
-          28.503, 29.0494, 29.6292, 30.2124, 30.798, 31.367, 31.9728, 32.5944, 33.217, 33.8438,
-          34.3696, 35.0956, 35.7044, 36.324, 37.0668, 37.6698, 38.3644, 39.049, 39.6918, 40.4146,
-          41.082, 41.687, 42.5398, 43.2462, 43.857, 44.6606, 45.4168, 46.1248, 46.9222, 47.6804,
-          48.447, 49.3454, 49.9594, 50.7636, 51.5776, 52.331, 53.19, 53.9676, 54.7564, 55.5314,
-          56.4442, 57.3708, 57.9774, 58.9624, 59.8796, 60.755, 61.472, 62.2076, 63.1024, 63.8908,
-          64.7338, 65.7728, 66.629, 67.413, 68.3266, 69.1524, 70.2642, 71.1806, 72.0566, 72.9192,
-          73.7598, 74.3516, 75.5802, 76.4386, 77.4916, 78.1524, 79.1892, 79.8414, 80.8798, 81.8376,
-          82.4698, 83.7656, 84.331, 85.5914, 86.6012, 87.7016, 88.5582, 89.3394, 90.3544, 91.4912,
-          92.308, 93.3552, 93.9746, 95.2052, 95.727, 97.1322, 98.3944, 98.7588, 100.242, 101.1914,
-          102.2538, 102.8776, 103.6292, 105.1932, 105.9152, 107.0868, 107.6728, 108.7144, 110.3114,
-          110.8716, 111.245, 112.7908, 113.7064, 114.636, 115.7464, 116.1788, 117.7464, 118.4896,
-          119.6166, 120.5082, 121.7798, 122.9028, 123.4426, 124.8854, 125.705, 126.4652, 128.3464,
-          128.3462, 130.0398, 131.0342, 131.0042, 132.4766, 133.511, 134.7252, 135.425, 136.5172,
-          138.0572, 138.6694, 139.3712, 140.8598, 141.4594, 142.554, 143.4006, 144.7374, 146.1634,
-          146.8994, 147.605, 147.9304, 149.1636, 150.2468, 151.5876, 152.2096, 153.7032, 154.7146,
-          155.807, 156.9228, 157.0372, 158.5852,},
-      // precision 6
-      {46, 46.1902, 47.271, 47.8358, 48.8142, 49.2854, 50.317, 51.354, 51.8924, 52.9436, 53.4596,
-          54.5262, 55.6248, 56.1574, 57.2822, 57.837, 58.9636, 60.074, 60.7042, 61.7976, 62.4772,
-          63.6564, 64.7942, 65.5004, 66.686, 67.291, 68.5672, 69.8556, 70.4982, 71.8204, 72.4252,
-          73.7744, 75.0786, 75.8344, 77.0294, 77.8098, 79.0794, 80.5732, 81.1878, 82.5648, 83.2902,
-          84.6784, 85.3352, 86.8946, 88.3712, 89.0852, 90.499, 91.2686, 92.6844, 94.2234, 94.9732,
-          96.3356, 97.2286, 98.7262, 100.3284, 101.1048, 102.5962, 103.3562, 105.1272, 106.4184,
-          107.4974, 109.0822, 109.856, 111.48, 113.2834, 114.0208, 115.637, 116.5174, 118.0576,
-          119.7476, 120.427, 122.1326, 123.2372, 125.2788, 126.6776, 127.7926, 129.1952, 129.9564,
-          131.6454, 133.87, 134.5428, 136.2, 137.0294, 138.6278, 139.6782, 141.792, 143.3516,
-          144.2832, 146.0394, 147.0748, 148.4912, 150.849, 151.696, 153.5404, 154.073, 156.3714,
-          157.7216, 158.7328, 160.4208, 161.4184, 163.9424, 165.2772, 166.411, 168.1308, 168.769,
-          170.9258, 172.6828, 173.7502, 175.706, 176.3886, 179.0186, 180.4518, 181.927, 183.4172,
-          184.4114, 186.033, 188.5124, 189.5564, 191.6008, 192.4172, 193.8044, 194.997, 197.4548,
-          198.8948, 200.2346, 202.3086, 203.1548, 204.8842, 206.6508, 206.6772, 209.7254, 210.4752,
-          212.7228, 214.6614, 215.1676, 217.793, 218.0006, 219.9052, 221.66, 223.5588, 225.1636,
-          225.6882, 227.7126, 229.4502, 231.1978, 232.9756, 233.1654, 236.727, 238.1974, 237.7474,
-          241.1346, 242.3048, 244.1948, 245.3134, 246.879, 249.1204, 249.853, 252.6792, 253.857,
-          254.4486, 257.2362, 257.9534, 260.0286, 260.5632, 262.663, 264.723, 265.7566, 267.2566,
-          267.1624, 270.62, 272.8216, 273.2166, 275.2056, 276.2202, 278.3726, 280.3344, 281.9284,
-          283.9728, 284.1924, 286.4872, 287.587, 289.807, 291.1206, 292.769, 294.8708, 296.665,
-          297.1182, 299.4012, 300.6352, 302.1354, 304.1756, 306.1606, 307.3462, 308.5214, 309.4134,
-          310.8352, 313.9684, 315.837, 316.7796, 318.9858,},
-      // precision 7
-      {92, 93.4934, 94.9758, 96.4574, 97.9718, 99.4954, 101.5302, 103.0756, 104.6374, 106.1782,
-          107.7888, 109.9522, 111.592, 113.2532, 114.9086, 116.5938, 118.9474, 120.6796, 122.4394,
-          124.2176, 125.9768, 128.4214, 130.2528, 132.0102, 133.8658, 135.7278, 138.3044, 140.1316,
-          142.093, 144.0032, 145.9092, 148.6306, 150.5294, 152.5756, 154.6508, 156.662, 159.552,
-          161.3724, 163.617, 165.5754, 167.7872, 169.8444, 172.7988, 174.8606, 177.2118, 179.3566,
-          181.4476, 184.5882, 186.6816, 189.0824, 191.0258, 193.6048, 196.4436, 198.7274, 200.957,
-          203.147, 205.4364, 208.7592, 211.3386, 213.781, 215.8028, 218.656, 221.6544, 223.996,
-          226.4718, 229.1544, 231.6098, 234.5956, 237.0616, 239.5758, 242.4878, 244.5244, 248.2146,
-          250.724, 252.8722, 255.5198, 258.0414, 261.941, 264.9048, 266.87, 269.4304, 272.028,
-          274.4708, 278.37, 281.0624, 283.4668, 286.5532, 289.4352, 293.2564, 295.2744, 298.2118,
-          300.7472, 304.1456, 307.2928, 309.7504, 312.5528, 315.979, 318.2102, 322.1834, 324.3494,
-          327.325, 330.6614, 332.903, 337.2544, 339.9042, 343.215, 345.2864, 348.0814, 352.6764,
-          355.301, 357.139, 360.658, 363.1732, 366.5902, 369.9538, 373.0828, 375.922, 378.9902,
-          382.7328, 386.4538, 388.1136, 391.2234, 394.0878, 396.708, 401.1556, 404.1852, 406.6372,
-          409.6822, 412.7796, 416.6078, 418.4916, 422.131, 424.5376, 428.1988, 432.211, 434.4502,
-          438.5282, 440.912, 444.0448, 447.7432, 450.8524, 453.7988, 456.7858, 458.8868, 463.9886,
-          466.5064, 468.9124, 472.6616, 475.4682, 478.582, 481.304, 485.2738, 488.6894, 490.329,
-          496.106, 497.6908, 501.1374, 504.5322, 506.8848, 510.3324, 513.4512, 516.179, 520.4412,
-          522.6066, 526.167, 528.7794, 533.379, 536.067, 538.46, 542.9116, 545.692, 547.9546,
-          552.493, 555.2722, 557.335, 562.449, 564.2014, 569.0738, 571.0974, 574.8564, 578.2996,
-          581.409, 583.9704, 585.8098, 589.6528, 594.5998, 595.958, 600.068, 603.3278, 608.2016,
-          609.9632, 612.864, 615.43, 620.7794, 621.272, 625.8644, 629.206, 633.219, 634.5154,
-          638.6102,},
-      // precision 8
-      {184.2152, 187.2454, 190.2096, 193.6652, 196.6312, 199.6822, 203.249, 206.3296, 210.0038,
-          213.2074, 216.4612, 220.27, 223.5178, 227.4412, 230.8032, 234.1634, 238.1688, 241.6074,
-          245.6946, 249.2664, 252.8228, 257.0432, 260.6824, 264.9464, 268.6268, 272.2626, 276.8376,
-          280.4034, 284.8956, 288.8522, 292.7638, 297.3552, 301.3556, 305.7526, 309.9292, 313.8954,
-          318.8198, 322.7668, 327.298, 331.6688, 335.9466, 340.9746, 345.1672, 349.3474, 354.3028,
-          358.8912, 364.114, 368.4646, 372.9744, 378.4092, 382.6022, 387.843, 392.5684, 397.1652,
-          402.5426, 407.4152, 412.5388, 417.3592, 422.1366, 427.486, 432.3918, 437.5076, 442.509,
-          447.3834, 453.3498, 458.0668, 463.7346, 469.1228, 473.4528, 479.7, 484.644, 491.0518,
-          495.5774, 500.9068, 506.432, 512.1666, 517.434, 522.6644, 527.4894, 533.6312, 538.3804,
-          544.292, 550.5496, 556.0234, 562.8206, 566.6146, 572.4188, 579.117, 583.6762, 590.6576,
-          595.7864, 601.509, 607.5334, 612.9204, 619.772, 624.2924, 630.8654, 636.1836, 642.745,
-          649.1316, 655.0386, 660.0136, 666.6342, 671.6196, 678.1866, 684.4282, 689.3324, 695.4794,
-          702.5038, 708.129, 713.528, 720.3204, 726.463, 732.7928, 739.123, 744.7418, 751.2192,
-          756.5102, 762.6066, 769.0184, 775.2224, 781.4014, 787.7618, 794.1436, 798.6506, 805.6378,
-          811.766, 819.7514, 824.5776, 828.7322, 837.8048, 843.6302, 849.9336, 854.4798, 861.3388,
-          867.9894, 873.8196, 880.3136, 886.2308, 892.4588, 899.0816, 905.4076, 912.0064, 917.3878,
-          923.619, 929.998, 937.3482, 943.9506, 947.991, 955.1144, 962.203, 968.8222, 975.7324,
-          981.7826, 988.7666, 994.2648, 1000.3128, 1007.4082, 1013.7536, 1020.3376, 1026.7156,
-          1031.7478, 1037.4292, 1045.393, 1051.2278, 1058.3434, 1062.8726, 1071.884, 1076.806,
-          1082.9176, 1089.1678, 1095.5032, 1102.525, 1107.2264, 1115.315, 1120.93, 1127.252,
-          1134.1496, 1139.0408, 1147.5448, 1153.3296, 1158.1974, 1166.5262, 1174.3328, 1175.657,
-          1184.4222, 1190.9172, 1197.1292, 1204.4606, 1210.4578, 1218.8728, 1225.3336, 1226.6592,
-          1236.5768, 1241.363, 1249.4074, 1254.6566, 1260.8014, 1266.5454, 1274.5192,},
-      // precision 9
-      {369, 374.8294, 381.2452, 387.6698, 394.1464, 400.2024, 406.8782, 413.6598, 420.462, 427.2826,
-          433.7102, 440.7416, 447.9366, 455.1046, 462.285, 469.0668, 476.306, 483.8448, 491.301,
-          498.9886, 506.2422, 513.8138, 521.7074, 529.7428, 537.8402, 545.1664, 553.3534, 561.594,
-          569.6886, 577.7876, 585.65, 594.228, 602.8036, 611.1666, 620.0818, 628.0824, 637.2574,
-          646.302, 655.1644, 664.0056, 672.3802, 681.7192, 690.5234, 700.2084, 708.831, 718.485,
-          728.1112, 737.4764, 746.76, 756.3368, 766.5538, 775.5058, 785.2646, 795.5902, 804.3818,
-          814.8998, 824.9532, 835.2062, 845.2798, 854.4728, 864.9582, 875.3292, 886.171, 896.781,
-          906.5716, 916.7048, 927.5322, 937.875, 949.3972, 958.3464, 969.7274, 980.2834, 992.1444,
-          1003.4264, 1013.0166, 1024.018, 1035.0438, 1046.34, 1057.6856, 1068.9836, 1079.0312,
-          1091.677, 1102.3188, 1113.4846, 1124.4424, 1135.739, 1147.1488, 1158.9202, 1169.406,
-          1181.5342, 1193.2834, 1203.8954, 1216.3286, 1226.2146, 1239.6684, 1251.9946, 1262.123,
-          1275.4338, 1285.7378, 1296.076, 1308.9692, 1320.4964, 1333.0998, 1343.9864, 1357.7754,
-          1368.3208, 1380.4838, 1392.7388, 1406.0758, 1416.9098, 1428.9728, 1440.9228, 1453.9292,
-          1462.617, 1476.05, 1490.2996, 1500.6128, 1513.7392, 1524.5174, 1536.6322, 1548.2584,
-          1562.3766, 1572.423, 1587.1232, 1596.5164, 1610.5938, 1622.5972, 1633.1222, 1647.7674,
-          1658.5044, 1671.57, 1683.7044, 1695.4142, 1708.7102, 1720.6094, 1732.6522, 1747.841,
-          1756.4072, 1769.9786, 1782.3276, 1797.5216, 1808.3186, 1819.0694, 1834.354, 1844.575,
-          1856.2808, 1871.1288, 1880.7852, 1893.9622, 1906.3418, 1920.6548, 1932.9302, 1945.8584,
-          1955.473, 1968.8248, 1980.6446, 1995.9598, 2008.349, 2019.8556, 2033.0334, 2044.0206,
-          2059.3956, 2069.9174, 2082.6084, 2093.7036, 2106.6108, 2118.9124, 2132.301, 2144.7628,
-          2159.8422, 2171.0212, 2183.101, 2193.5112, 2208.052, 2221.3194, 2233.3282, 2247.295,
-          2257.7222, 2273.342, 2286.5638, 2299.6786, 2310.8114, 2322.3312, 2335.516, 2349.874,
-          2363.5968, 2373.865, 2387.1918, 2401.8328, 2414.8496, 2424.544, 2436.7592, 2447.1682,
-          2464.1958, 2474.3438, 2489.0006, 2497.4526, 2513.6586, 2527.19, 2540.7028, 2553.768,},
-      // precision 10
-      {738.1256, 750.4234, 763.1064, 775.4732, 788.4636, 801.0644, 814.488, 827.9654, 841.0832,
-          854.7864, 868.1992, 882.2176, 896.5228, 910.1716, 924.7752, 938.899, 953.6126, 968.6492,
-          982.9474, 998.5214, 1013.1064, 1028.6364, 1044.2468, 1059.4588, 1075.3832, 1091.0584,
-          1106.8606, 1123.3868, 1139.5062, 1156.1862, 1172.463, 1189.339, 1206.1936, 1223.1292,
-          1240.1854, 1257.2908, 1275.3324, 1292.8518, 1310.5204, 1328.4854, 1345.9318, 1364.552,
-          1381.4658, 1400.4256, 1419.849, 1438.152, 1456.8956, 1474.8792, 1494.118, 1513.62,
-          1532.5132, 1551.9322, 1570.7726, 1590.6086, 1610.5332, 1630.5918, 1650.4294, 1669.7662,
-          1690.4106, 1710.7338, 1730.9012, 1750.4486, 1770.1556, 1791.6338, 1812.7312, 1833.6264,
-          1853.9526, 1874.8742, 1896.8326, 1918.1966, 1939.5594, 1961.07, 1983.037, 2003.1804,
-          2026.071, 2047.4884, 2070.0848, 2091.2944, 2114.333, 2135.9626, 2158.2902, 2181.0814,
-          2202.0334, 2224.4832, 2246.39, 2269.7202, 2292.1714, 2314.2358, 2338.9346, 2360.891,
-          2384.0264, 2408.3834, 2430.1544, 2454.8684, 2476.9896, 2501.4368, 2522.8702, 2548.0408,
-          2570.6738, 2593.5208, 2617.0158, 2640.2302, 2664.0962, 2687.4986, 2714.2588, 2735.3914,
-          2759.6244, 2781.8378, 2808.0072, 2830.6516, 2856.2454, 2877.2136, 2903.4546, 2926.785,
-          2951.2294, 2976.468, 3000.867, 3023.6508, 3049.91, 3073.5984, 3098.162, 3121.5564,
-          3146.2328, 3170.9484, 3195.5902, 3221.3346, 3242.7032, 3271.6112, 3296.5546, 3317.7376,
-          3345.072, 3369.9518, 3394.326, 3418.1818, 3444.6926, 3469.086, 3494.2754, 3517.8698,
-          3544.248, 3565.3768, 3588.7234, 3616.979, 3643.7504, 3668.6812, 3695.72, 3719.7392,
-          3742.6224, 3770.4456, 3795.6602, 3819.9058, 3844.002, 3869.517, 3895.6824, 3920.8622,
-          3947.1364, 3973.985, 3995.4772, 4021.62, 4046.628, 4074.65, 4096.2256, 4121.831,
-          4146.6406, 4173.276, 4195.0744, 4223.9696, 4251.3708, 4272.9966, 4300.8046, 4326.302,
-          4353.1248, 4374.312, 4403.0322, 4426.819, 4450.0598, 4478.5206, 4504.8116, 4528.8928,
-          4553.9584, 4578.8712, 4603.8384, 4632.3872, 4655.5128, 4675.821, 4704.6222, 4731.9862,
-          4755.4174, 4781.2628, 4804.332, 4832.3048, 4862.8752, 4883.4148, 4906.9544, 4935.3516,
-          4954.3532, 4984.0248, 5011.217, 5035.3258, 5057.3672, 5084.1828,},
-      // precision 11
-      {1477, 1501.6014, 1526.5802, 1551.7942, 1577.3042, 1603.2062, 1629.8402, 1656.2292, 1682.9462,
-          1709.9926, 1737.3026, 1765.4252, 1793.0578, 1821.6092, 1849.626, 1878.5568, 1908.527,
-          1937.5154, 1967.1874, 1997.3878, 2027.37, 2058.1972, 2089.5728, 2120.1012, 2151.9668,
-          2183.292, 2216.0772, 2247.8578, 2280.6562, 2313.041, 2345.714, 2380.3112, 2414.1806,
-          2447.9854, 2481.656, 2516.346, 2551.5154, 2586.8378, 2621.7448, 2656.6722, 2693.5722,
-          2729.1462, 2765.4124, 2802.8728, 2838.898, 2876.408, 2913.4926, 2951.4938, 2989.6776,
-          3026.282, 3065.7704, 3104.1012, 3143.7388, 3181.6876, 3221.1872, 3261.5048, 3300.0214,
-          3339.806, 3381.409, 3421.4144, 3461.4294, 3502.2286, 3544.651, 3586.6156, 3627.337,
-          3670.083, 3711.1538, 3753.5094, 3797.01, 3838.6686, 3882.1678, 3922.8116, 3967.9978,
-          4009.9204, 4054.3286, 4097.5706, 4140.6014, 4185.544, 4229.5976, 4274.583, 4316.9438,
-          4361.672, 4406.2786, 4451.8628, 4496.1834, 4543.505, 4589.1816, 4632.5188, 4678.2294,
-          4724.8908, 4769.0194, 4817.052, 4861.4588, 4910.1596, 4956.4344, 5002.5238, 5048.13,
-          5093.6374, 5142.8162, 5187.7894, 5237.3984, 5285.6078, 5331.0858, 5379.1036, 5428.6258,
-          5474.6018, 5522.7618, 5571.5822, 5618.59, 5667.9992, 5714.88, 5763.454, 5808.6982,
-          5860.3644, 5910.2914, 5953.571, 6005.9232, 6055.1914, 6104.5882, 6154.5702, 6199.7036,
-          6251.1764, 6298.7596, 6350.0302, 6398.061, 6448.4694, 6495.933, 6548.0474, 6597.7166,
-          6646.9416, 6695.9208, 6742.6328, 6793.5276, 6842.1934, 6894.2372, 6945.3864, 6996.9228,
-          7044.2372, 7094.1374, 7142.2272, 7192.2942, 7238.8338, 7288.9006, 7344.0908, 7394.8544,
-          7443.5176, 7490.4148, 7542.9314, 7595.6738, 7641.9878, 7694.3688, 7743.0448, 7797.522,
-          7845.53, 7899.594, 7950.3132, 7996.455, 8050.9442, 8092.9114, 8153.1374, 8197.4472,
-          8252.8278, 8301.8728, 8348.6776, 8401.4698, 8453.551, 8504.6598, 8553.8944, 8604.1276,
-          8657.6514, 8710.3062, 8758.908, 8807.8706, 8862.1702, 8910.4668, 8960.77, 9007.2766,
-          9063.164, 9121.0534, 9164.1354, 9218.1594, 9267.767, 9319.0594, 9372.155, 9419.7126,
-          9474.3722, 9520.1338, 9572.368, 9622.7702, 9675.8448, 9726.5396, 9778.7378, 9827.6554,
-          9878.1922, 9928.7782, 9978.3984, 10026.578, 10076.5626, 10137.1618, 10177.5244,
-          10229.9176,},
-      // precision 12
-      {2954, 3003.4782, 3053.3568, 3104.3666, 3155.324, 3206.9598, 3259.648, 3312.539, 3366.1474,
-          3420.2576, 3474.8376, 3530.6076, 3586.451, 3643.38, 3700.4104, 3757.5638, 3815.9676,
-          3875.193, 3934.838, 3994.8548, 4055.018, 4117.1742, 4178.4482, 4241.1294, 4304.4776,
-          4367.4044, 4431.8724, 4496.3732, 4561.4304, 4627.5326, 4693.949, 4761.5532, 4828.7256,
-          4897.6182, 4965.5186, 5034.4528, 5104.865, 5174.7164, 5244.6828, 5316.6708, 5387.8312,
-          5459.9036, 5532.476, 5604.8652, 5679.6718, 5753.757, 5830.2072, 5905.2828, 5980.0434,
-          6056.6264, 6134.3192, 6211.5746, 6290.0816, 6367.1176, 6447.9796, 6526.5576, 6606.1858,
-          6686.9144, 6766.1142, 6847.0818, 6927.9664, 7010.9096, 7091.0816, 7175.3962, 7260.3454,
-          7344.018, 7426.4214, 7511.3106, 7596.0686, 7679.8094, 7765.818, 7852.4248, 7936.834,
-          8022.363, 8109.5066, 8200.4554, 8288.5832, 8373.366, 8463.4808, 8549.7682, 8642.0522,
-          8728.3288, 8820.9528, 8907.727, 9001.0794, 9091.2522, 9179.988, 9269.852, 9362.6394,
-          9453.642, 9546.9024, 9640.6616, 9732.6622, 9824.3254, 9917.7484, 10007.9392, 10106.7508,
-          10196.2152, 10289.8114, 10383.5494, 10482.3064, 10576.8734, 10668.7872, 10764.7156,
-          10862.0196, 10952.793, 11049.9748, 11146.0702, 11241.4492, 11339.2772, 11434.2336,
-          11530.741, 11627.6136, 11726.311, 11821.5964, 11918.837, 12015.3724, 12113.0162,
-          12213.0424, 12306.9804, 12408.4518, 12504.8968, 12604.586, 12700.9332, 12798.705,
-          12898.5142, 12997.0488, 13094.788, 13198.475, 13292.7764, 13392.9698, 13486.8574,
-          13590.1616, 13686.5838, 13783.6264, 13887.2638, 13992.0978, 14081.0844, 14189.9956,
-          14280.0912, 14382.4956, 14486.4384, 14588.1082, 14686.2392, 14782.276, 14888.0284,
-          14985.1864, 15088.8596, 15187.0998, 15285.027, 15383.6694, 15495.8266, 15591.3736,
-          15694.2008, 15790.3246, 15898.4116, 15997.4522, 16095.5014, 16198.8514, 16291.7492,
-          16402.6424, 16499.1266, 16606.2436, 16697.7186, 16796.3946, 16902.3376, 17005.7672,
-          17100.814, 17206.8282, 17305.8262, 17416.0744, 17508.4092, 17617.0178, 17715.4554,
-          17816.758, 17920.1748, 18012.9236, 18119.7984, 18223.2248, 18324.2482, 18426.6276,
-          18525.0932, 18629.8976, 18733.2588, 18831.0466, 18940.1366, 19032.2696, 19131.729,
-          19243.4864, 19349.6932, 19442.866, 19547.9448, 19653.2798, 19754.4034, 19854.0692,
-          19965.1224, 20065.1774, 20158.2212, 20253.353, 20366.3264, 20463.22,},
-      // precision 13
-      {5908.5052, 6007.2672, 6107.347, 6208.5794, 6311.2622, 6414.5514, 6519.3376, 6625.6952,
-          6732.5988, 6841.3552, 6950.5972, 7061.3082, 7173.5646, 7287.109, 7401.8216, 7516.4344,
-          7633.3802, 7751.2962, 7870.3784, 7990.292, 8110.79, 8233.4574, 8356.6036, 8482.2712,
-          8607.7708, 8735.099, 8863.1858, 8993.4746, 9123.8496, 9255.6794, 9388.5448, 9522.7516,
-          9657.3106, 9792.6094, 9930.5642, 10068.794, 10206.7256, 10347.81, 10490.3196, 10632.0778,
-          10775.9916, 10920.4662, 11066.124, 11213.073, 11358.0362, 11508.1006, 11659.1716,
-          11808.7514, 11959.4884, 12112.1314, 12265.037, 12420.3756, 12578.933, 12734.311,
-          12890.0006, 13047.2144, 13207.3096, 13368.5144, 13528.024, 13689.847, 13852.7528,
-          14018.3168, 14180.5372, 14346.9668, 14513.5074, 14677.867, 14846.2186, 15017.4186,
-          15184.9716, 15356.339, 15529.2972, 15697.3578, 15871.8686, 16042.187, 16216.4094,
-          16389.4188, 16565.9126, 16742.3272, 16919.0042, 17094.7592, 17273.965, 17451.8342,
-          17634.4254, 17810.5984, 17988.9242, 18171.051, 18354.7938, 18539.466, 18721.0408,
-          18904.9972, 19081.867, 19271.9118, 19451.8694, 19637.9816, 19821.2922, 20013.1292,
-          20199.3858, 20387.8726, 20572.9514, 20770.7764, 20955.1714, 21144.751, 21329.9952,
-          21520.709, 21712.7016, 21906.3868, 22096.2626, 22286.0524, 22475.051, 22665.5098,
-          22862.8492, 23055.5294, 23249.6138, 23437.848, 23636.273, 23826.093, 24020.3296,
-          24213.3896, 24411.7392, 24602.9614, 24805.7952, 24998.1552, 25193.9588, 25389.0166,
-          25585.8392, 25780.6976, 25981.2728, 26175.977, 26376.5252, 26570.1964, 26773.387,
-          26962.9812, 27163.0586, 27368.164, 27565.0534, 27758.7428, 27961.1276, 28163.2324,
-          28362.3816, 28565.7668, 28758.644, 28956.9768, 29163.4722, 29354.7026, 29561.1186,
-          29767.9948, 29959.9986, 30164.0492, 30366.9818, 30562.5338, 30762.9928, 30976.1592,
-          31166.274, 31376.722, 31570.3734, 31770.809, 31974.8934, 32179.5286, 32387.5442,
-          32582.3504, 32794.076, 32989.9528, 33191.842, 33392.4684, 33595.659, 33801.8672,
-          34000.3414, 34200.0922, 34402.6792, 34610.0638, 34804.0084, 35011.13, 35218.669,
-          35418.6634, 35619.0792, 35830.6534, 36028.4966, 36229.7902, 36438.6422, 36630.7764,
-          36833.3102, 37048.6728, 37247.3916, 37453.5904, 37669.3614, 37854.5526, 38059.305,
-          38268.0936, 38470.2516, 38674.7064, 38876.167, 39068.3794, 39281.9144, 39492.8566,
-          39684.8628, 39898.4108, 40093.1836, 40297.6858, 40489.7086, 40717.2424,},
-      // precision 14
-      {11817.475, 12015.0046, 12215.3792, 12417.7504, 12623.1814, 12830.0086, 13040.0072, 13252.503,
-          13466.178, 13683.2738, 13902.0344, 14123.9798, 14347.394, 14573.7784, 14802.6894,
-          15033.6824, 15266.9134, 15502.8624, 15741.4944, 15980.7956, 16223.8916, 16468.6316,
-          16715.733, 16965.5726, 17217.204, 17470.666, 17727.8516, 17986.7886, 18247.6902,
-          18510.9632, 18775.304, 19044.7486, 19314.4408, 19587.202, 19862.2576, 20135.924,
-          20417.0324, 20697.9788, 20979.6112, 21265.0274, 21550.723, 21841.6906, 22132.162,
-          22428.1406, 22722.127, 23020.5606, 23319.7394, 23620.4014, 23925.2728, 24226.9224,
-          24535.581, 24845.505, 25155.9618, 25470.3828, 25785.9702, 26103.7764, 26420.4132,
-          26742.0186, 27062.8852, 27388.415, 27714.6024, 28042.296, 28365.4494, 28701.1526,
-          29031.8008, 29364.2156, 29704.497, 30037.1458, 30380.111, 30723.8168, 31059.5114,
-          31404.9498, 31751.6752, 32095.2686, 32444.7792, 32794.767, 33145.204, 33498.4226,
-          33847.6502, 34209.006, 34560.849, 34919.4838, 35274.9778, 35635.1322, 35996.3266,
-          36359.1394, 36722.8266, 37082.8516, 37447.7354, 37815.9606, 38191.0692, 38559.4106,
-          38924.8112, 39294.6726, 39663.973, 40042.261, 40416.2036, 40779.2036, 41161.6436,
-          41540.9014, 41921.1998, 42294.7698, 42678.5264, 43061.3464, 43432.375, 43818.432,
-          44198.6598, 44583.0138, 44970.4794, 45353.924, 45729.858, 46118.2224, 46511.5724,
-          46900.7386, 47280.6964, 47668.1472, 48055.6796, 48446.9436, 48838.7146, 49217.7296,
-          49613.7796, 50010.7508, 50410.0208, 50793.7886, 51190.2456, 51583.1882, 51971.0796,
-          52376.5338, 52763.319, 53165.5534, 53556.5594, 53948.2702, 54346.352, 54748.7914,
-          55138.577, 55543.4824, 55941.1748, 56333.7746, 56745.1552, 57142.7944, 57545.2236,
-          57935.9956, 58348.5268, 58737.5474, 59158.5962, 59542.6896, 59958.8004, 60349.3788,
-          60755.0212, 61147.6144, 61548.194, 61946.0696, 62348.6042, 62763.603, 63162.781,
-          63560.635, 63974.3482, 64366.4908, 64771.5876, 65176.7346, 65597.3916, 65995.915,
-          66394.0384, 66822.9396, 67203.6336, 67612.2032, 68019.0078, 68420.0388, 68821.22,
-          69235.8388, 69640.0724, 70055.155, 70466.357, 70863.4266, 71276.2482, 71677.0306,
-          72080.2006, 72493.0214, 72893.5952, 73314.5856, 73714.9852, 74125.3022, 74521.2122,
-          74933.6814, 75341.5904, 75743.0244, 76166.0278, 76572.1322, 76973.1028, 77381.6284,
-          77800.6092, 78189.328, 78607.0962, 79012.2508, 79407.8358, 79825.725, 80238.701,
-          80646.891, 81035.6436, 81460.0448, 81876.3884,},
-      // precision 15
-      {23635.0036, 24030.8034, 24431.4744, 24837.1524, 25246.7928, 25661.326, 26081.3532,
-          26505.2806, 26933.9892, 27367.7098, 27805.318, 28248.799, 28696.4382, 29148.8244,
-          29605.5138, 30066.8668, 30534.2344, 31006.32, 31480.778, 31962.2418, 32447.3324,
-          32938.0232, 33432.731, 33930.728, 34433.9896, 34944.1402, 35457.5588, 35974.5958,
-          36497.3296, 37021.9096, 37554.326, 38088.0826, 38628.8816, 39171.3192, 39723.2326,
-          40274.5554, 40832.3142, 41390.613, 41959.5908, 42532.5466, 43102.0344, 43683.5072,
-          44266.694, 44851.2822, 45440.7862, 46038.0586, 46640.3164, 47241.064, 47846.155,
-          48454.7396, 49076.9168, 49692.542, 50317.4778, 50939.65, 51572.5596, 52210.2906,
-          52843.7396, 53481.3996, 54127.236, 54770.406, 55422.6598, 56078.7958, 56736.7174,
-          57397.6784, 58064.5784, 58730.308, 59404.9784, 60077.0864, 60751.9158, 61444.1386,
-          62115.817, 62808.7742, 63501.4774, 64187.5454, 64883.6622, 65582.7468, 66274.5318,
-          66976.9276, 67688.7764, 68402.138, 69109.6274, 69822.9706, 70543.6108, 71265.5202,
-          71983.3848, 72708.4656, 73433.384, 74158.4664, 74896.4868, 75620.9564, 76362.1434,
-          77098.3204, 77835.7662, 78582.6114, 79323.9902, 80067.8658, 80814.9246, 81567.0136,
-          82310.8536, 83061.9952, 83821.4096, 84580.8608, 85335.547, 86092.5802, 86851.6506,
-          87612.311, 88381.2016, 89146.3296, 89907.8974, 90676.846, 91451.4152, 92224.5518,
-          92995.8686, 93763.5066, 94551.2796, 95315.1944, 96096.1806, 96881.0918, 97665.679,
-          98442.68, 99229.3002, 100011.0994, 100790.6386, 101580.1564, 102377.7484, 103152.1392,
-          103944.2712, 104730.216, 105528.6336, 106324.9398, 107117.6706, 107890.3988, 108695.2266,
-          109485.238, 110294.7876, 111075.0958, 111878.0496, 112695.2864, 113464.5486, 114270.0474,
-          115068.608, 115884.3626, 116673.2588, 117483.3716, 118275.097, 119085.4092, 119879.2808,
-          120687.5868, 121499.9944, 122284.916, 123095.9254, 123912.5038, 124709.0454, 125503.7182,
-          126323.259, 127138.9412, 127943.8294, 128755.646, 129556.5354, 130375.3298, 131161.4734,
-          131971.1962, 132787.5458, 133588.1056, 134431.351, 135220.2906, 136023.398, 136846.6558,
-          137667.0004, 138463.663, 139283.7154, 140074.6146, 140901.3072, 141721.8548, 142543.2322,
-          143356.1096, 144173.7412, 144973.0948, 145794.3162, 146609.5714, 147420.003, 148237.9784,
-          149050.5696, 149854.761, 150663.1966, 151494.0754, 152313.1416, 153112.6902, 153935.7206,
-          154746.9262, 155559.547, 156401.9746, 157228.7036, 158008.7254, 158820.75, 159646.9184,
-          160470.4458, 161279.5348, 162093.3114, 162918.542, 163729.2842,},
-      // precision 16
-      {47271, 48062.3584, 48862.7074, 49673.152, 50492.8416, 51322.9514, 52161.03, 53009.407,
-          53867.6348, 54734.206, 55610.5144, 56496.2096, 57390.795, 58297.268, 59210.6448,
-          60134.665, 61068.0248, 62010.4472, 62962.5204, 63923.5742, 64895.0194, 65876.4182,
-          66862.6136, 67862.6968, 68868.8908, 69882.8544, 70911.271, 71944.0924, 72990.0326,
-          74040.692, 75100.6336, 76174.7826, 77252.5998, 78340.2974, 79438.2572, 80545.4976,
-          81657.2796, 82784.6336, 83915.515, 85059.7362, 86205.9368, 87364.4424, 88530.3358,
-          89707.3744, 90885.9638, 92080.197, 93275.5738, 94479.391, 95695.918, 96919.2236,
-          98148.4602, 99382.3474, 100625.6974, 101878.0284, 103141.6278, 104409.4588, 105686.2882,
-          106967.5402, 108261.6032, 109548.1578, 110852.0728, 112162.231, 113479.0072, 114806.2626,
-          116137.9072, 117469.5048, 118813.5186, 120165.4876, 121516.2556, 122875.766, 124250.5444,
-          125621.2222, 127003.2352, 128387.848, 129775.2644, 131181.7776, 132577.3086, 133979.9458,
-          135394.1132, 136800.9078, 138233.217, 139668.5308, 141085.212, 142535.2122, 143969.0684,
-          145420.2872, 146878.1542, 148332.7572, 149800.3202, 151269.66, 152743.6104, 154213.0948,
-          155690.288, 157169.4246, 158672.1756, 160160.059, 161650.6854, 163145.7772, 164645.6726,
-          166159.1952, 167682.1578, 169177.3328, 170700.0118, 172228.8964, 173732.6664, 175265.5556,
-          176787.799, 178317.111, 179856.6914, 181400.865, 182943.4612, 184486.742, 186033.4698,
-          187583.7886, 189148.1868, 190688.4526, 192250.1926, 193810.9042, 195354.2972, 196938.7682,
-          198493.5898, 200079.2824, 201618.912, 203205.5492, 204765.5798, 206356.1124, 207929.3064,
-          209498.7196, 211086.229, 212675.1324, 214256.7892, 215826.2392, 217412.8474, 218995.6724,
-          220618.6038, 222207.1166, 223781.0364, 225387.4332, 227005.7928, 228590.4336, 230217.8738,
-          231805.1054, 233408.9, 234995.3432, 236601.4956, 238190.7904, 239817.2548, 241411.2832,
-          243002.4066, 244640.1884, 246255.3128, 247849.3508, 249479.9734, 251106.8822, 252705.027,
-          254332.9242, 255935.129, 257526.9014, 259154.772, 260777.625, 262390.253, 264004.4906,
-          265643.59, 267255.4076, 268873.426, 270470.7252, 272106.4804, 273722.4456, 275337.794,
-          276945.7038, 278592.9154, 280204.3726, 281841.1606, 283489.171, 285130.1716, 286735.3362,
-          288364.7164, 289961.1814, 291595.5524, 293285.683, 294899.6668, 296499.3434, 298128.0462,
-          299761.8946, 301394.2424, 302997.6748, 304615.1478, 306269.7724, 307886.114, 309543.1028,
-          311153.2862, 312782.8546, 314421.2008, 316033.2438, 317692.9636, 319305.2648, 320948.7406,
-          322566.3364, 324228.4224, 325847.1542,},
-      // precision 17
-      {94542, 96125.811, 97728.019, 99348.558, 100987.9705, 102646.7565, 104324.5125, 106021.7435,
-          107736.7865, 109469.272, 111223.9465, 112995.219, 114787.432, 116593.152, 118422.71,
-          120267.2345, 122134.6765, 124020.937, 125927.2705, 127851.255, 129788.9485, 131751.016,
-          133726.8225, 135722.592, 137736.789, 139770.568, 141821.518, 143891.343, 145982.1415,
-          148095.387, 150207.526, 152355.649, 154515.6415, 156696.05, 158887.7575, 161098.159,
-          163329.852, 165569.053, 167837.4005, 170121.6165, 172420.4595, 174732.6265, 177062.77,
-          179412.502, 181774.035, 184151.939, 186551.6895, 188965.691, 191402.8095, 193857.949,
-          196305.0775, 198774.6715, 201271.2585, 203764.78, 206299.3695, 208818.1365, 211373.115,
-          213946.7465, 216532.076, 219105.541, 221714.5375, 224337.5135, 226977.5125, 229613.0655,
-          232270.2685, 234952.2065, 237645.3555, 240331.1925, 243034.517, 245756.0725, 248517.6865,
-          251232.737, 254011.3955, 256785.995, 259556.44, 262368.335, 265156.911, 267965.266,
-          270785.583, 273616.0495, 276487.4835, 279346.639, 282202.509, 285074.3885, 287942.2855,
-          290856.018, 293774.0345, 296678.5145, 299603.6355, 302552.6575, 305492.9785, 308466.8605,
-          311392.581, 314347.538, 317319.4295, 320285.9785, 323301.7325, 326298.3235, 329301.3105,
-          332301.987, 335309.791, 338370.762, 341382.923, 344431.1265, 347464.1545, 350507.28,
-          353619.2345, 356631.2005, 359685.203, 362776.7845, 365886.488, 368958.2255, 372060.6825,
-          375165.4335, 378237.935, 381328.311, 384430.5225, 387576.425, 390683.242, 393839.648,
-          396977.8425, 400101.9805, 403271.296, 406409.8425, 409529.5485, 412678.7, 415847.423,
-          419020.8035, 422157.081, 425337.749, 428479.6165, 431700.902, 434893.1915, 438049.582,
-          441210.5415, 444379.2545, 447577.356, 450741.931, 453959.548, 457137.0935, 460329.846,
-          463537.4815, 466732.3345, 469960.5615, 473164.681, 476347.6345, 479496.173, 482813.1645,
-          486025.6995, 489249.4885, 492460.1945, 495675.8805, 498908.0075, 502131.802, 505374.3855,
-          508550.9915, 511806.7305, 515026.776, 518217.0005, 521523.9855, 524705.9855, 527950.997,
-          531210.0265, 534472.497, 537750.7315, 540926.922, 544207.094, 547429.4345, 550666.3745,
-          553975.3475, 557150.7185, 560399.6165, 563662.697, 566916.7395, 570146.1215, 573447.425,
-          576689.6245, 579874.5745, 583202.337, 586503.0255, 589715.635, 592910.161, 596214.3885,
-          599488.035, 602740.92, 605983.0685, 609248.67, 612491.3605, 615787.912, 619107.5245,
-          622307.9555, 625577.333, 628840.4385, 632085.2155, 635317.6135, 638691.7195, 641887.467,
-          645139.9405, 648441.546, 651666.252, 654941.845,},
-      // precision 18
-      {189084, 192250.913, 195456.774, 198696.946, 201977.762, 205294.444, 208651.754, 212042.099,
-          215472.269, 218941.91, 222443.912, 225996.845, 229568.199, 233193.568, 236844.457,
-          240543.233, 244279.475, 248044.27, 251854.588, 255693.2, 259583.619, 263494.621,
-          267445.385, 271454.061, 275468.769, 279549.456, 283646.446, 287788.198, 291966.099,
-          296181.164, 300431.469, 304718.618, 309024.004, 313393.508, 317760.803, 322209.731,
-          326675.061, 331160.627, 335654.47, 340241.442, 344841.833, 349467.132, 354130.629,
-          358819.432, 363574.626, 368296.587, 373118.482, 377914.93, 382782.301, 387680.669,
-          392601.981, 397544.323, 402529.115, 407546.018, 412593.658, 417638.657, 422762.865,
-          427886.169, 433017.167, 438213.273, 443441.254, 448692.421, 453937.533, 459239.049,
-          464529.569, 469910.083, 475274.03, 480684.473, 486070.26, 491515.237, 496995.651,
-          502476.617, 507973.609, 513497.19, 519083.233, 524726.509, 530305.505, 535945.728,
-          541584.404, 547274.055, 552967.236, 558667.862, 564360.216, 570128.148, 575965.08,
-          581701.952, 587532.523, 593361.144, 599246.128, 605033.418, 610958.779, 616837.117,
-          622772.818, 628672.04, 634675.369, 640574.831, 646585.739, 652574.547, 658611.217,
-          664642.684, 670713.914, 676737.681, 682797.313, 688837.897, 694917.874, 701009.882,
-          707173.648, 713257.254, 719415.392, 725636.761, 731710.697, 737906.209, 744103.074,
-          750313.39, 756504.185, 762712.579, 768876.985, 775167.859, 781359, 787615.959, 793863.597,
-          800245.477, 806464.582, 812785.294, 819005.925, 825403.057, 831676.197, 837936.284,
-          844266.968, 850642.711, 856959.756, 863322.774, 869699.931, 876102.478, 882355.787,
-          888694.463, 895159.952, 901536.143, 907872.631, 914293.672, 920615.14, 927130.974,
-          933409.404, 939922.178, 946331.47, 952745.93, 959209.264, 965590.224, 972077.284,
-          978501.961, 984953.19, 991413.271, 997817.479, 1004222.658, 1010725.676, 1017177.138,
-          1023612.529, 1030098.236, 1036493.719, 1043112.207, 1049537.036, 1056008.096, 1062476.184,
-          1068942.337, 1075524.95, 1081932.864, 1088426.025, 1094776.005, 1101327.448, 1107901.673,
-          1114423.639, 1120884.602, 1127324.923, 1133794.24, 1140328.886, 1146849.376, 1153346.682,
-          1159836.502, 1166478.703, 1172953.304, 1179391.502, 1185950.982, 1192544.052, 1198913.41,
-          1205430.994, 1212015.525, 1218674.042, 1225121.683, 1231551.101, 1238126.379, 1244673.795,
-          1251260.649, 1257697.86, 1264320.983, 1270736.319, 1277274.694, 1283804.95, 1290211.514,
-          1296858.568, 1303455.691,}};
-
-  static final double[][] biasData = {
-      // precision 4
-      {10, 9.717, 9.207, 8.7896, 8.2882, 7.8204, 7.3772, 6.9342, 6.5202, 6.161, 5.7722, 5.4636,
-          5.0396, 4.6766, 4.3566, 4.0454, 3.7936, 3.4856, 3.2666, 2.9946, 2.766, 2.4692, 2.3638,
-          2.0764, 1.7864, 1.7602, 1.4814, 1.433, 1.2926, 1.0664, 0.999600000000001, 0.7956, 0.5366,
-          0.589399999999998, 0.573799999999999, 0.269799999999996, 0.368200000000002,
-          0.0544000000000011, 0.234200000000001, 0.0108000000000033, -0.203400000000002,
-          -0.0701999999999998, -0.129600000000003, -0.364199999999997, -0.480600000000003,
-          -0.226999999999997, -0.322800000000001, -0.382599999999996, -0.511200000000002,
-          -0.669600000000003, -0.749400000000001, -0.500399999999999, -0.617600000000003, -0.6922,
-          -0.601599999999998, -0.416200000000003, -0.338200000000001, -0.782600000000002,
-          -0.648600000000002, -0.919800000000002, -0.851799999999997, -0.962400000000002, -0.6402,
-          -1.1922, -1.0256, -1.086, -1.21899999999999, -0.819400000000002, -0.940600000000003,
-          -1.1554, -1.2072, -1.1752, -1.16759999999999, -1.14019999999999, -1.3754,
-          -1.29859999999999, -1.607, -1.3292, -1.7606,},
-      // precision 5
-      {22, 21.1194, 20.8208, 20.2318, 19.77, 19.2436, 18.7774, 18.2848, 17.8224, 17.3742, 16.9336,
-          16.503, 16.0494, 15.6292, 15.2124, 14.798, 14.367, 13.9728, 13.5944, 13.217, 12.8438,
-          12.3696, 12.0956, 11.7044, 11.324, 11.0668, 10.6698, 10.3644, 10.049, 9.6918, 9.4146,
-          9.082, 8.687, 8.5398, 8.2462, 7.857, 7.6606, 7.4168, 7.1248, 6.9222, 6.6804, 6.447,
-          6.3454, 5.9594, 5.7636, 5.5776, 5.331, 5.19, 4.9676, 4.7564, 4.5314, 4.4442, 4.3708,
-          3.9774, 3.9624, 3.8796, 3.755, 3.472, 3.2076, 3.1024, 2.8908, 2.7338, 2.7728, 2.629,
-          2.413, 2.3266, 2.1524, 2.2642, 2.1806, 2.0566, 1.9192, 1.7598, 1.3516, 1.5802,
-          1.43859999999999, 1.49160000000001, 1.1524, 1.1892, 0.841399999999993, 0.879800000000003,
-          0.837599999999995, 0.469800000000006, 0.765600000000006, 0.331000000000003,
-          0.591399999999993, 0.601200000000006, 0.701599999999999, 0.558199999999999,
-          0.339399999999998, 0.354399999999998, 0.491200000000006, 0.308000000000007,
-          0.355199999999996, -0.0254000000000048, 0.205200000000005, -0.272999999999996,
-          0.132199999999997, 0.394400000000005, -0.241200000000006, 0.242000000000004,
-          0.191400000000002, 0.253799999999998, -0.122399999999999, -0.370800000000003,
-          0.193200000000004, -0.0848000000000013, 0.0867999999999967, -0.327200000000005,
-          -0.285600000000002, 0.311400000000006, -0.128399999999999, -0.754999999999995,
-          -0.209199999999996, -0.293599999999998, -0.364000000000004, -0.253600000000006,
-          -0.821200000000005, -0.253600000000006, -0.510400000000004, -0.383399999999995,
-          -0.491799999999998, -0.220200000000006, -0.0972000000000008, -0.557400000000001,
-          -0.114599999999996, -0.295000000000002, -0.534800000000004, 0.346399999999988,
-          -0.65379999999999, 0.0398000000000138, 0.0341999999999985, -0.995800000000003,
-          -0.523400000000009, -0.489000000000004, -0.274799999999999, -0.574999999999989,
-          -0.482799999999997, 0.0571999999999946, -0.330600000000004, -0.628800000000012,
-          -0.140199999999993, -0.540600000000012, -0.445999999999998, -0.599400000000003,
-          -0.262599999999992, 0.163399999999996, -0.100599999999986, -0.39500000000001,
-          -1.06960000000001, -0.836399999999998, -0.753199999999993, -0.412399999999991,
-          -0.790400000000005, -0.29679999999999, -0.28540000000001, -0.193000000000012,
-          -0.0772000000000048, -0.962799999999987, -0.414800000000014,},
-      // precision 6
-      {45, 44.1902, 43.271, 42.8358, 41.8142, 41.2854, 40.317, 39.354, 38.8924, 37.9436, 37.4596,
-          36.5262, 35.6248, 35.1574, 34.2822, 33.837, 32.9636, 32.074, 31.7042, 30.7976, 30.4772,
-          29.6564, 28.7942, 28.5004, 27.686, 27.291, 26.5672, 25.8556, 25.4982, 24.8204, 24.4252,
-          23.7744, 23.0786, 22.8344, 22.0294, 21.8098, 21.0794, 20.5732, 20.1878, 19.5648, 19.2902,
-          18.6784, 18.3352, 17.8946, 17.3712, 17.0852, 16.499, 16.2686, 15.6844, 15.2234, 14.9732,
-          14.3356, 14.2286, 13.7262, 13.3284, 13.1048, 12.5962, 12.3562, 12.1272, 11.4184, 11.4974,
-          11.0822, 10.856, 10.48, 10.2834, 10.0208, 9.637, 9.51739999999999, 9.05759999999999,
-          8.74760000000001, 8.42700000000001, 8.1326, 8.2372, 8.2788, 7.6776, 7.79259999999999,
-          7.1952, 6.9564, 6.6454, 6.87, 6.5428, 6.19999999999999, 6.02940000000001,
-          5.62780000000001, 5.6782, 5.792, 5.35159999999999, 5.28319999999999, 5.0394,
-          5.07480000000001, 4.49119999999999, 4.84899999999999, 4.696, 4.54040000000001,
-          4.07300000000001, 4.37139999999999, 3.7216, 3.7328, 3.42080000000001, 3.41839999999999,
-          3.94239999999999, 3.27719999999999, 3.411, 3.13079999999999, 2.76900000000001,
-          2.92580000000001, 2.68279999999999, 2.75020000000001, 2.70599999999999, 2.3886,
-          3.01859999999999, 2.45179999999999, 2.92699999999999, 2.41720000000001, 2.41139999999999,
-          2.03299999999999, 2.51240000000001, 2.5564, 2.60079999999999, 2.41720000000001,
-          1.80439999999999, 1.99700000000001, 2.45480000000001, 1.8948, 2.2346, 2.30860000000001,
-          2.15479999999999, 1.88419999999999, 1.6508, 0.677199999999999, 1.72540000000001, 1.4752,
-          1.72280000000001, 1.66139999999999, 1.16759999999999, 1.79300000000001, 1.00059999999999,
-          0.905200000000008, 0.659999999999997, 1.55879999999999, 1.1636, 0.688199999999995,
-          0.712600000000009, 0.450199999999995, 1.1978, 0.975599999999986, 0.165400000000005, 1.727,
-          1.19739999999999, -0.252600000000001, 1.13460000000001, 1.3048, 1.19479999999999,
-          0.313400000000001, 0.878999999999991, 1.12039999999999, 0.853000000000009,
-          1.67920000000001, 0.856999999999999, 0.448599999999999, 1.2362, 0.953399999999988,
-          1.02859999999998, 0.563199999999995, 0.663000000000011, 0.723000000000013,
-          0.756599999999992, 0.256599999999992, -0.837600000000009, 0.620000000000005,
-          0.821599999999989, 0.216600000000028, 0.205600000000004, 0.220199999999977,
-          0.372599999999977, 0.334400000000016, 0.928400000000011, 0.972800000000007,
-          0.192400000000021, 0.487199999999973, -0.413000000000011, 0.807000000000016,
-          0.120600000000024, 0.769000000000005, 0.870799999999974, 0.66500000000002,
-          0.118200000000002, 0.401200000000017, 0.635199999999998, 0.135400000000004,
-          0.175599999999974, 1.16059999999999, 0.34620000000001, 0.521400000000028,
-          -0.586599999999976, -1.16480000000001, 0.968399999999974, 0.836999999999989,
-          0.779600000000016, 0.985799999999983,},
-      // precision 7
-      {91, 89.4934, 87.9758, 86.4574, 84.9718, 83.4954, 81.5302, 80.0756, 78.6374, 77.1782, 75.7888,
-          73.9522, 72.592, 71.2532, 69.9086, 68.5938, 66.9474, 65.6796, 64.4394, 63.2176, 61.9768,
-          60.4214, 59.2528, 58.0102, 56.8658, 55.7278, 54.3044, 53.1316, 52.093, 51.0032, 49.9092,
-          48.6306, 47.5294, 46.5756, 45.6508, 44.662, 43.552, 42.3724, 41.617, 40.5754, 39.7872,
-          38.8444, 37.7988, 36.8606, 36.2118, 35.3566, 34.4476, 33.5882, 32.6816, 32.0824, 31.0258,
-          30.6048, 29.4436, 28.7274, 27.957, 27.147, 26.4364, 25.7592, 25.3386, 24.781, 23.8028,
-          23.656, 22.6544, 21.996, 21.4718, 21.1544, 20.6098, 19.5956, 19.0616, 18.5758, 18.4878,
-          17.5244, 17.2146, 16.724, 15.8722, 15.5198, 15.0414, 14.941, 14.9048, 13.87, 13.4304,
-          13.028, 12.4708, 12.37, 12.0624, 11.4668, 11.5532, 11.4352, 11.2564, 10.2744, 10.2118,
-          9.74720000000002, 10.1456, 9.2928, 8.75040000000001, 8.55279999999999, 8.97899999999998,
-          8.21019999999999, 8.18340000000001, 7.3494, 7.32499999999999, 7.66140000000001,
-          6.90300000000002, 7.25439999999998, 6.9042, 7.21499999999997, 6.28640000000001,
-          6.08139999999997, 6.6764, 6.30099999999999, 5.13900000000001, 5.65800000000002,
-          5.17320000000001, 4.59019999999998, 4.9538, 5.08280000000002, 4.92200000000003,
-          4.99020000000002, 4.7328, 5.4538, 4.11360000000002, 4.22340000000003, 4.08780000000002,
-          3.70800000000003, 4.15559999999999, 4.18520000000001, 3.63720000000001, 3.68220000000002,
-          3.77960000000002, 3.6078, 2.49160000000001, 3.13099999999997, 2.5376, 3.19880000000001,
-          3.21100000000001, 2.4502, 3.52820000000003, 2.91199999999998, 3.04480000000001, 2.7432,
-          2.85239999999999, 2.79880000000003, 2.78579999999999, 1.88679999999999, 2.98860000000002,
-          2.50639999999999, 1.91239999999999, 2.66160000000002, 2.46820000000002, 1.58199999999999,
-          1.30399999999997, 2.27379999999999, 2.68939999999998, 1.32900000000001, 3.10599999999999,
-          1.69080000000002, 2.13740000000001, 2.53219999999999, 1.88479999999998, 1.33240000000001,
-          1.45119999999997, 1.17899999999997, 2.44119999999998, 1.60659999999996, 2.16700000000003,
-          0.77940000000001, 2.37900000000002, 2.06700000000001, 1.46000000000004, 2.91160000000002,
-          1.69200000000001, 0.954600000000028, 2.49300000000005, 2.2722, 1.33500000000004,
-          2.44899999999996, 1.20140000000004, 3.07380000000001, 2.09739999999999, 2.85640000000001,
-          2.29960000000005, 2.40899999999999, 1.97040000000004, 0.809799999999996, 1.65279999999996,
-          2.59979999999996, 0.95799999999997, 2.06799999999998, 2.32780000000002, 4.20159999999998,
-          1.96320000000003, 1.86400000000003, 1.42999999999995, 3.77940000000001, 1.27200000000005,
-          1.86440000000005, 2.20600000000002, 3.21900000000005, 1.5154, 2.61019999999996,},
-      // precision 8
-      {183.2152, 180.2454, 177.2096, 173.6652, 170.6312, 167.6822, 164.249, 161.3296, 158.0038,
-          155.2074, 152.4612, 149.27, 146.5178, 143.4412, 140.8032, 138.1634, 135.1688, 132.6074,
-          129.6946, 127.2664, 124.8228, 122.0432, 119.6824, 116.9464, 114.6268, 112.2626, 109.8376,
-          107.4034, 104.8956, 102.8522, 100.7638, 98.3552, 96.3556, 93.7526, 91.9292, 89.8954,
-          87.8198, 85.7668, 83.298, 81.6688, 79.9466, 77.9746, 76.1672, 74.3474, 72.3028, 70.8912,
-          69.114, 67.4646, 65.9744, 64.4092, 62.6022, 60.843, 59.5684, 58.1652, 56.5426, 55.4152,
-          53.5388, 52.3592, 51.1366, 49.486, 48.3918, 46.5076, 45.509, 44.3834, 43.3498, 42.0668,
-          40.7346, 40.1228, 38.4528, 37.7, 36.644, 36.0518, 34.5774, 33.9068, 32.432, 32.1666,
-          30.434, 29.6644, 28.4894, 27.6312, 26.3804, 26.292, 25.5496000000001, 25.0234, 24.8206,
-          22.6146, 22.4188, 22.117, 20.6762, 20.6576, 19.7864, 19.509, 18.5334, 17.9204, 17.772,
-          16.2924, 16.8654, 15.1836, 15.745, 15.1316, 15.0386, 14.0136, 13.6342, 12.6196, 12.1866,
-          12.4281999999999, 11.3324, 10.4794000000001, 11.5038, 10.129, 9.52800000000002,
-          10.3203999999999, 9.46299999999997, 9.79280000000006, 9.12300000000005, 8.74180000000001,
-          9.2192, 7.51020000000005, 7.60659999999996, 7.01840000000004, 7.22239999999999,
-          7.40139999999997, 6.76179999999999, 7.14359999999999, 5.65060000000005, 5.63779999999997,
-          5.76599999999996, 6.75139999999999, 5.57759999999996, 3.73220000000003, 5.8048,
-          5.63019999999995, 4.93359999999996, 3.47979999999995, 4.33879999999999, 3.98940000000005,
-          3.81960000000004, 3.31359999999995, 3.23080000000004, 3.4588, 3.08159999999998, 3.4076,
-          3.00639999999999, 2.38779999999997, 2.61900000000003, 1.99800000000005, 3.34820000000002,
-          2.95060000000001, 0.990999999999985, 2.11440000000005, 2.20299999999997, 2.82219999999995,
-          2.73239999999998, 2.7826, 3.76660000000004, 2.26480000000004, 2.31280000000004,
-          2.40819999999997, 2.75360000000001, 3.33759999999995, 2.71559999999999, 1.7478000000001,
-          1.42920000000004, 2.39300000000003, 2.22779999999989, 2.34339999999997, 0.87259999999992,
-          3.88400000000001, 1.80600000000004, 1.91759999999999, 1.16779999999994, 1.50320000000011,
-          2.52500000000009, 0.226400000000012, 2.31500000000005, 0.930000000000064,
-          1.25199999999995, 2.14959999999996, 0.0407999999999902, 2.5447999999999, 1.32960000000003,
-          0.197400000000016, 2.52620000000002, 3.33279999999991, -1.34300000000007,
-          0.422199999999975, 0.917200000000093, 1.12920000000008, 1.46060000000011,
-          1.45779999999991, 2.8728000000001, 3.33359999999993, -1.34079999999994, 1.57680000000005,
-          0.363000000000056, 1.40740000000005, 0.656600000000026, 0.801400000000058,
-          -0.454600000000028, 1.51919999999996,},
-      // precision 9
-      {368, 361.8294, 355.2452, 348.6698, 342.1464, 336.2024, 329.8782, 323.6598, 317.462, 311.2826,
-          305.7102, 299.7416, 293.9366, 288.1046, 282.285, 277.0668, 271.306, 265.8448, 260.301,
-          254.9886, 250.2422, 244.8138, 239.7074, 234.7428, 229.8402, 225.1664, 220.3534, 215.594,
-          210.6886, 205.7876, 201.65, 197.228, 192.8036, 188.1666, 184.0818, 180.0824, 176.2574,
-          172.302, 168.1644, 164.0056, 160.3802, 156.7192, 152.5234, 149.2084, 145.831, 142.485,
-          139.1112, 135.4764, 131.76, 129.3368, 126.5538, 122.5058, 119.2646, 116.5902, 113.3818,
-          110.8998, 107.9532, 105.2062, 102.2798, 99.4728, 96.9582, 94.3292, 92.171,
-          89.7809999999999, 87.5716, 84.7048, 82.5322, 79.875, 78.3972, 75.3464, 73.7274, 71.2834,
-          70.1444, 68.4263999999999, 66.0166, 64.018, 62.0437999999999, 60.3399999999999, 58.6856,
-          57.9836, 55.0311999999999, 54.6769999999999, 52.3188, 51.4846, 49.4423999999999, 47.739,
-          46.1487999999999, 44.9202, 43.4059999999999, 42.5342000000001, 41.2834, 38.8954000000001,
-          38.3286000000001, 36.2146, 36.6684, 35.9946, 33.123, 33.4338, 31.7378000000001, 29.076,
-          28.9692, 27.4964, 27.0998, 25.9864, 26.7754, 24.3208, 23.4838, 22.7388000000001,
-          24.0758000000001, 21.9097999999999, 20.9728, 19.9228000000001, 19.9292, 16.617, 17.05,
-          18.2996000000001, 15.6128000000001, 15.7392, 14.5174, 13.6322, 12.2583999999999,
-          13.3766000000001, 11.423, 13.1232, 9.51639999999998, 10.5938000000001, 9.59719999999993,
-          8.12220000000002, 9.76739999999995, 7.50440000000003, 7.56999999999994, 6.70440000000008,
-          6.41419999999994, 6.71019999999999, 5.60940000000005, 4.65219999999999, 6.84099999999989,
-          3.4072000000001, 3.97859999999991, 3.32760000000007, 5.52160000000003, 3.31860000000006,
-          2.06940000000009, 4.35400000000004, 1.57500000000005, 0.280799999999999, 2.12879999999996,
-          -0.214799999999968, -0.0378000000000611, -0.658200000000079, 0.654800000000023,
-          -0.0697999999999865, 0.858400000000074, -2.52700000000004, -2.1751999999999,
-          -3.35539999999992, -1.04019999999991, -0.651000000000067, -2.14439999999991,
-          -1.96659999999997, -3.97939999999994, -0.604400000000169, -3.08260000000018,
-          -3.39159999999993, -5.29640000000018, -5.38920000000007, -5.08759999999984,
-          -4.69900000000007, -5.23720000000003, -3.15779999999995, -4.97879999999986,
-          -4.89899999999989, -7.48880000000008, -5.94799999999987, -5.68060000000014,
-          -6.67180000000008, -4.70499999999993, -7.27779999999984, -4.6579999999999,
-          -4.4362000000001, -4.32139999999981, -5.18859999999995, -6.66879999999992,
-          -6.48399999999992, -5.1260000000002, -4.4032000000002, -6.13500000000022,
-          -5.80819999999994, -4.16719999999987, -4.15039999999999, -7.45600000000013,
-          -7.24080000000004, -9.83179999999993, -5.80420000000004, -8.6561999999999,
-          -6.99940000000015, -10.5473999999999, -7.34139999999979, -6.80999999999995,
-          -6.29719999999998, -6.23199999999997,},
-      // precision 10
-      {737.1256, 724.4234, 711.1064, 698.4732, 685.4636, 673.0644, 660.488, 647.9654, 636.0832,
-          623.7864, 612.1992, 600.2176, 588.5228, 577.1716, 565.7752, 554.899, 543.6126, 532.6492,
-          521.9474, 511.5214, 501.1064, 490.6364, 480.2468, 470.4588, 460.3832, 451.0584, 440.8606,
-          431.3868, 422.5062, 413.1862, 404.463, 395.339, 386.1936, 378.1292, 369.1854, 361.2908,
-          353.3324, 344.8518, 337.5204, 329.4854, 321.9318, 314.552, 306.4658, 299.4256, 292.849,
-          286.152, 278.8956, 271.8792, 265.118, 258.62, 252.5132, 245.9322, 239.7726, 233.6086,
-          227.5332, 222.5918, 216.4294, 210.7662, 205.4106, 199.7338, 194.9012, 188.4486, 183.1556,
-          178.6338, 173.7312, 169.6264, 163.9526, 159.8742, 155.8326, 151.1966, 147.5594, 143.07,
-          140.037, 134.1804, 131.071, 127.4884, 124.0848, 120.2944, 117.333, 112.9626, 110.2902,
-          107.0814, 103.0334, 99.4832000000001, 96.3899999999999, 93.7202000000002,
-          90.1714000000002, 87.2357999999999, 85.9346, 82.8910000000001, 80.0264000000002,
-          78.3834000000002, 75.1543999999999, 73.8683999999998, 70.9895999999999, 69.4367999999999,
-          64.8701999999998, 65.0408000000002, 61.6738, 59.5207999999998, 57.0158000000001, 54.2302,
-          53.0962, 50.4985999999999, 52.2588000000001, 47.3914, 45.6244000000002, 42.8377999999998,
-          43.0072, 40.6516000000001, 40.2453999999998, 35.2136, 36.4546, 33.7849999999999,
-          33.2294000000002, 32.4679999999998, 30.8670000000002, 28.6507999999999, 28.9099999999999,
-          27.5983999999999, 26.1619999999998, 24.5563999999999, 23.2328000000002, 21.9484000000002,
-          21.5902000000001, 21.3346000000001, 17.7031999999999, 20.6111999999998, 19.5545999999999,
-          15.7375999999999, 17.0720000000001, 16.9517999999998, 15.326, 13.1817999999998,
-          14.6925999999999, 13.0859999999998, 13.2754, 10.8697999999999, 11.248, 7.3768,
-          4.72339999999986, 7.97899999999981, 8.7503999999999, 7.68119999999999, 9.7199999999998,
-          7.73919999999998, 5.6224000000002, 7.44560000000001, 6.6601999999998, 5.9058,
-          4.00199999999995, 4.51699999999983, 4.68240000000014, 3.86220000000003, 5.13639999999987,
-          5.98500000000013, 2.47719999999981, 2.61999999999989, 1.62800000000016, 4.65000000000009,
-          0.225599999999758, 0.831000000000131, -0.359400000000278, 1.27599999999984,
-          -2.92559999999958, -0.0303999999996449, 2.37079999999969, -2.0033999999996,
-          0.804600000000391, 0.30199999999968, 1.1247999999996, -2.6880000000001,
-          0.0321999999996478, -1.18099999999959, -3.9402, -1.47940000000017, -0.188400000000001,
-          -2.10720000000038, -2.04159999999956, -3.12880000000041, -4.16160000000036,
-          -0.612799999999879, -3.48719999999958, -8.17900000000009, -5.37780000000021,
-          -4.01379999999972, -5.58259999999973, -5.73719999999958, -7.66799999999967,
-          -5.69520000000011, -1.1247999999996, -5.58520000000044, -8.04560000000038,
-          -4.64840000000004, -11.6468000000004, -7.97519999999986, -5.78300000000036,
-          -7.67420000000038, -10.6328000000003, -9.81720000000041,},
-      // precision 11
-      {1476, 1449.6014, 1423.5802, 1397.7942, 1372.3042, 1347.2062, 1321.8402, 1297.2292, 1272.9462,
-          1248.9926, 1225.3026, 1201.4252, 1178.0578, 1155.6092, 1132.626, 1110.5568, 1088.527,
-          1066.5154, 1045.1874, 1024.3878, 1003.37, 982.1972, 962.5728, 942.1012, 922.9668, 903.292,
-          884.0772, 864.8578, 846.6562, 828.041, 809.714, 792.3112, 775.1806, 757.9854, 740.656,
-          724.346, 707.5154, 691.8378, 675.7448, 659.6722, 645.5722, 630.1462, 614.4124, 600.8728,
-          585.898, 572.408, 558.4926, 544.4938, 531.6776, 517.282, 505.7704, 493.1012, 480.7388,
-          467.6876, 456.1872, 445.5048, 433.0214, 420.806, 411.409, 400.4144, 389.4294, 379.2286,
-          369.651, 360.6156, 350.337, 342.083, 332.1538, 322.5094, 315.01, 305.6686, 298.1678,
-          287.8116, 280.9978, 271.9204, 265.3286, 257.5706, 249.6014, 242.544, 235.5976, 229.583,
-          220.9438, 214.672, 208.2786, 201.8628, 195.1834, 191.505, 186.1816, 178.5188, 172.2294,
-          167.8908, 161.0194, 158.052, 151.4588, 148.1596, 143.4344, 138.5238, 133.13, 127.6374,
-          124.8162, 118.7894, 117.3984, 114.6078, 109.0858, 105.1036, 103.6258, 98.6018000000004,
-          95.7618000000002, 93.5821999999998, 88.5900000000001, 86.9992000000002, 82.8800000000001,
-          80.4539999999997, 74.6981999999998, 74.3644000000004, 73.2914000000001, 65.5709999999999,
-          66.9232000000002, 65.1913999999997, 62.5882000000001, 61.5702000000001, 55.7035999999998,
-          56.1764000000003, 52.7596000000003, 53.0302000000001, 49.0609999999997, 48.4694, 44.933,
-          46.0474000000004, 44.7165999999997, 41.9416000000001, 39.9207999999999, 35.6328000000003,
-          35.5276000000003, 33.1934000000001, 33.2371999999996, 33.3864000000003, 33.9228000000003,
-          30.2371999999996, 29.1373999999996, 25.2272000000003, 24.2942000000003, 19.8338000000003,
-          18.9005999999999, 23.0907999999999, 21.8544000000002, 19.5176000000001, 15.4147999999996,
-          16.9314000000004, 18.6737999999996, 12.9877999999999, 14.3688000000002, 12.0447999999997,
-          15.5219999999999, 12.5299999999997, 14.5940000000001, 14.3131999999996, 9.45499999999993,
-          12.9441999999999, 3.91139999999996, 13.1373999999996, 5.44720000000052, 9.82779999999912,
-          7.87279999999919, 3.67760000000089, 5.46980000000076, 5.55099999999948, 5.65979999999945,
-          3.89439999999922, 3.1275999999998, 5.65140000000065, 6.3062000000009, 3.90799999999945,
-          1.87060000000019, 5.17020000000048, 2.46680000000015, 0.770000000000437,
-          -3.72340000000077, 1.16400000000067, 8.05340000000069, 0.135399999999208,
-          2.15940000000046, 0.766999999999825, 1.0594000000001, 3.15500000000065,
-          -0.287399999999252, 2.37219999999979, -2.86620000000039, -1.63199999999961,
-          -2.22979999999916, -0.15519999999924, -1.46039999999994, -0.262199999999211,
-          -2.34460000000036, -2.8078000000005, -3.22179999999935, -5.60159999999996,
-          -8.42200000000048, -9.43740000000071, 0.161799999999857, -10.4755999999998,
-          -10.0823999999993,},
-      // precision 12
-      {2953, 2900.4782, 2848.3568, 2796.3666, 2745.324, 2694.9598, 2644.648, 2595.539, 2546.1474,
-          2498.2576, 2450.8376, 2403.6076, 2357.451, 2311.38, 2266.4104, 2221.5638, 2176.9676,
-          2134.193, 2090.838, 2048.8548, 2007.018, 1966.1742, 1925.4482, 1885.1294, 1846.4776,
-          1807.4044, 1768.8724, 1731.3732, 1693.4304, 1657.5326, 1621.949, 1586.5532, 1551.7256,
-          1517.6182, 1483.5186, 1450.4528, 1417.865, 1385.7164, 1352.6828, 1322.6708, 1291.8312,
-          1260.9036, 1231.476, 1201.8652, 1173.6718, 1145.757, 1119.2072, 1092.2828, 1065.0434,
-          1038.6264, 1014.3192, 988.5746, 965.0816, 940.1176, 917.9796, 894.5576, 871.1858,
-          849.9144, 827.1142, 805.0818, 783.9664, 763.9096, 742.0816, 724.3962, 706.3454, 688.018,
-          667.4214, 650.3106, 633.0686, 613.8094, 597.818, 581.4248, 563.834, 547.363, 531.5066,
-          520.455400000001, 505.583199999999, 488.366, 476.480799999999, 459.7682, 450.0522,
-          434.328799999999, 423.952799999999, 408.727000000001, 399.079400000001, 387.252200000001,
-          373.987999999999, 360.852000000001, 351.6394, 339.642, 330.902400000001, 322.661599999999,
-          311.662200000001, 301.3254, 291.7484, 279.939200000001, 276.7508, 263.215200000001,
-          254.811400000001, 245.5494, 242.306399999999, 234.8734, 223.787200000001, 217.7156,
-          212.0196, 200.793, 195.9748, 189.0702, 182.449199999999, 177.2772, 170.2336, 164.741,
-          158.613600000001, 155.311, 147.5964, 142.837, 137.3724, 132.0162, 130.0424, 121.9804,
-          120.451800000001, 114.8968, 111.585999999999, 105.933199999999, 101.705, 98.5141999999996,
-          95.0488000000005, 89.7880000000005, 91.4750000000004, 83.7764000000006, 80.9698000000008,
-          72.8574000000008, 73.1615999999995, 67.5838000000003, 62.6263999999992, 63.2638000000006,
-          66.0977999999996, 52.0843999999997, 58.9956000000002, 47.0912000000008, 46.4956000000002,
-          48.4383999999991, 47.1082000000006, 43.2392, 37.2759999999998, 40.0283999999992,
-          35.1864000000005, 35.8595999999998, 32.0998, 28.027, 23.6694000000007, 33.8266000000003,
-          26.3736000000008, 27.2008000000005, 21.3245999999999, 26.4115999999995, 23.4521999999997,
-          19.5013999999992, 19.8513999999996, 10.7492000000002, 18.6424000000006, 13.1265999999996,
-          18.2436000000016, 6.71860000000015, 3.39459999999963, 6.33759999999893, 7.76719999999841,
-          0.813999999998487, 3.82819999999992, 0.826199999999517, 8.07440000000133,
-          -1.59080000000176, 5.01780000000144, 0.455399999998917, -0.24199999999837,
-          0.174800000000687, -9.07640000000174, -4.20160000000033, -3.77520000000004,
-          -4.75179999999818, -5.3724000000002, -8.90680000000066, -6.10239999999976,
-          -5.74120000000039, -9.95339999999851, -3.86339999999836, -13.7304000000004,
-          -16.2710000000006, -7.51359999999841, -3.30679999999847, -13.1339999999982,
-          -10.0551999999989, -6.72019999999975, -8.59660000000076, -10.9307999999983,
-          -1.8775999999998, -4.82259999999951, -13.7788, -21.6470000000008, -10.6735999999983,
-          -15.7799999999988,},
-      // precision 13
-      {5907.5052, 5802.2672, 5697.347, 5593.5794, 5491.2622, 5390.5514, 5290.3376, 5191.6952,
-          5093.5988, 4997.3552, 4902.5972, 4808.3082, 4715.5646, 4624.109, 4533.8216, 4444.4344,
-          4356.3802, 4269.2962, 4183.3784, 4098.292, 4014.79, 3932.4574, 3850.6036, 3771.2712,
-          3691.7708, 3615.099, 3538.1858, 3463.4746, 3388.8496, 3315.6794, 3244.5448, 3173.7516,
-          3103.3106, 3033.6094, 2966.5642, 2900.794, 2833.7256, 2769.81, 2707.3196, 2644.0778,
-          2583.9916, 2523.4662, 2464.124, 2406.073, 2347.0362, 2292.1006, 2238.1716, 2182.7514,
-          2128.4884, 2077.1314, 2025.037, 1975.3756, 1928.933, 1879.311, 1831.0006, 1783.2144,
-          1738.3096, 1694.5144, 1649.024, 1606.847, 1564.7528, 1525.3168, 1482.5372, 1443.9668,
-          1406.5074, 1365.867, 1329.2186, 1295.4186, 1257.9716, 1225.339, 1193.2972, 1156.3578,
-          1125.8686, 1091.187, 1061.4094, 1029.4188, 1000.9126, 972.3272, 944.004199999999,
-          915.7592, 889.965, 862.834200000001, 840.4254, 812.598399999999, 785.924200000001,
-          763.050999999999, 741.793799999999, 721.466, 699.040799999999, 677.997200000002,
-          649.866999999998, 634.911800000002, 609.8694, 591.981599999999, 570.2922,
-          557.129199999999, 538.3858, 521.872599999999, 502.951400000002, 495.776399999999,
-          475.171399999999, 459.751, 439.995200000001, 426.708999999999, 413.7016, 402.3868,
-          387.262599999998, 372.0524, 357.050999999999, 342.5098, 334.849200000001,
-          322.529399999999, 311.613799999999, 295.848000000002, 289.273000000001, 274.093000000001,
-          263.329600000001, 251.389599999999, 245.7392, 231.9614, 229.7952, 217.155200000001,
-          208.9588, 199.016599999999, 190.839199999999, 180.6976, 176.272799999999,
-          166.976999999999, 162.5252, 151.196400000001, 149.386999999999, 133.981199999998,
-          130.0586, 130.164000000001, 122.053400000001, 110.7428, 108.1276, 106.232400000001,
-          100.381600000001, 98.7668000000012, 86.6440000000002, 79.9768000000004, 82.4722000000002,
-          68.7026000000005, 70.1186000000016, 71.9948000000004, 58.998599999999, 59.0492000000013,
-          56.9818000000014, 47.5338000000011, 42.9928, 51.1591999999982, 37.2740000000013,
-          42.7220000000016, 31.3734000000004, 26.8090000000011, 25.8934000000008, 26.5286000000015,
-          29.5442000000003, 19.3503999999994, 26.0760000000009, 17.9527999999991, 14.8419999999969,
-          10.4683999999979, 8.65899999999965, 9.86720000000059, 4.34139999999752,
-          -0.907800000000861, -3.32080000000133, -0.936199999996461, -11.9916000000012,
-          -8.87000000000262, -6.33099999999831, -11.3366000000024, -15.9207999999999,
-          -9.34659999999712, -15.5034000000014, -19.2097999999969, -15.357799999998,
-          -28.2235999999975, -30.6898000000001, -19.3271999999997, -25.6083999999973,
-          -24.409599999999, -13.6385999999984, -33.4473999999973, -32.6949999999997,
-          -28.9063999999998, -31.7483999999968, -32.2935999999972, -35.8329999999987,
-          -47.620600000002, -39.0855999999985, -33.1434000000008, -46.1371999999974,
-          -37.5892000000022, -46.8164000000033, -47.3142000000007, -60.2914000000019,
-          -37.7575999999972,},
-      // precision 14
-      {11816.475, 11605.0046, 11395.3792, 11188.7504, 10984.1814, 10782.0086, 10582.0072, 10384.503,
-          10189.178, 9996.2738, 9806.0344, 9617.9798, 9431.394, 9248.7784, 9067.6894, 8889.6824,
-          8712.9134, 8538.8624, 8368.4944, 8197.7956, 8031.8916, 7866.6316, 7703.733, 7544.5726,
-          7386.204, 7230.666, 7077.8516, 6926.7886, 6778.6902, 6631.9632, 6487.304, 6346.7486,
-          6206.4408, 6070.202, 5935.2576, 5799.924, 5671.0324, 5541.9788, 5414.6112, 5290.0274,
-          5166.723, 5047.6906, 4929.162, 4815.1406, 4699.127, 4588.5606, 4477.7394, 4369.4014,
-          4264.2728, 4155.9224, 4055.581, 3955.505, 3856.9618, 3761.3828, 3666.9702, 3575.7764,
-          3482.4132, 3395.0186, 3305.8852, 3221.415, 3138.6024, 3056.296, 2970.4494, 2896.1526,
-          2816.8008, 2740.2156, 2670.497, 2594.1458, 2527.111, 2460.8168, 2387.5114, 2322.9498,
-          2260.6752, 2194.2686, 2133.7792, 2074.767, 2015.204, 1959.4226, 1898.6502, 1850.006,
-          1792.849, 1741.4838, 1687.9778, 1638.1322, 1589.3266, 1543.1394, 1496.8266, 1447.8516,
-          1402.7354, 1361.9606, 1327.0692, 1285.4106, 1241.8112, 1201.6726, 1161.973, 1130.261,
-          1094.2036, 1048.2036, 1020.6436, 990.901400000002, 961.199800000002, 924.769800000002,
-          899.526400000002, 872.346400000002, 834.375, 810.432000000001, 780.659800000001,
-          756.013800000001, 733.479399999997, 707.923999999999, 673.858, 652.222399999999,
-          636.572399999997, 615.738599999997, 586.696400000001, 564.147199999999, 541.679600000003,
-          523.943599999999, 505.714599999999, 475.729599999999, 461.779600000002, 449.750800000002,
-          439.020799999998, 412.7886, 400.245600000002, 383.188199999997, 362.079599999997,
-          357.533799999997, 334.319000000003, 327.553399999997, 308.559399999998, 291.270199999999,
-          279.351999999999, 271.791400000002, 252.576999999997, 247.482400000001, 236.174800000001,
-          218.774599999997, 220.155200000001, 208.794399999999, 201.223599999998, 182.995600000002,
-          185.5268, 164.547400000003, 176.5962, 150.689599999998, 157.8004, 138.378799999999,
-          134.021200000003, 117.614399999999, 108.194000000003, 97.0696000000025, 89.6042000000016,
-          95.6030000000028, 84.7810000000027, 72.635000000002, 77.3482000000004, 59.4907999999996,
-          55.5875999999989, 50.7346000000034, 61.3916000000027, 50.9149999999936, 39.0384000000049,
-          58.9395999999979, 29.633600000001, 28.2032000000036, 26.0078000000067, 17.0387999999948,
-          9.22000000000116, 13.8387999999977, 8.07240000000456, 14.1549999999988, 15.3570000000036,
-          3.42660000000615, 6.24820000000182, -2.96940000000177, -8.79940000000352,
-          -5.97860000000219, -14.4048000000039, -3.4143999999942, -13.0148000000045,
-          -11.6977999999945, -25.7878000000055, -22.3185999999987, -24.409599999999,
-          -31.9756000000052, -18.9722000000038, -22.8678000000073, -30.8972000000067,
-          -32.3715999999986, -22.3907999999938, -43.6720000000059, -35.9038, -39.7492000000057,
-          -54.1641999999993, -45.2749999999942, -42.2989999999991, -44.1089999999967,
-          -64.3564000000042, -49.9551999999967, -42.6116000000038,},
-      // precision 15
-      {23634.0036, 23210.8034, 22792.4744, 22379.1524, 21969.7928, 21565.326, 21165.3532,
-          20770.2806, 20379.9892, 19994.7098, 19613.318, 19236.799, 18865.4382, 18498.8244,
-          18136.5138, 17778.8668, 17426.2344, 17079.32, 16734.778, 16397.2418, 16063.3324,
-          15734.0232, 15409.731, 15088.728, 14772.9896, 14464.1402, 14157.5588, 13855.5958,
-          13559.3296, 13264.9096, 12978.326, 12692.0826, 12413.8816, 12137.3192, 11870.2326,
-          11602.5554, 11340.3142, 11079.613, 10829.5908, 10583.5466, 10334.0344, 10095.5072,
-          9859.694, 9625.2822, 9395.7862, 9174.0586, 8957.3164, 8738.064, 8524.155, 8313.7396,
-          8116.9168, 7913.542, 7718.4778, 7521.65, 7335.5596, 7154.2906, 6968.7396, 6786.3996,
-          6613.236, 6437.406, 6270.6598, 6107.7958, 5945.7174, 5787.6784, 5635.5784, 5482.308,
-          5337.9784, 5190.0864, 5045.9158, 4919.1386, 4771.817, 4645.7742, 4518.4774, 4385.5454,
-          4262.6622, 4142.74679999999, 4015.5318, 3897.9276, 3790.7764, 3685.13800000001, 3573.6274,
-          3467.9706, 3368.61079999999, 3271.5202, 3170.3848, 3076.4656, 2982.38400000001, 2888.4664,
-          2806.4868, 2711.9564, 2634.1434, 2551.3204, 2469.7662, 2396.61139999999, 2318.9902,
-          2243.8658, 2171.9246, 2105.01360000001, 2028.8536, 1960.9952, 1901.4096, 1841.86079999999,
-          1777.54700000001, 1714.5802, 1654.65059999999, 1596.311, 1546.2016, 1492.3296, 1433.8974,
-          1383.84600000001, 1339.4152, 1293.5518, 1245.8686, 1193.50659999999, 1162.27959999999,
-          1107.19439999999, 1069.18060000001, 1035.09179999999, 999.679000000004, 957.679999999993,
-          925.300199999998, 888.099400000006, 848.638600000006, 818.156400000007, 796.748399999997,
-          752.139200000005, 725.271200000003, 692.216, 671.633600000001, 647.939799999993,
-          621.670599999998, 575.398799999995, 561.226599999995, 532.237999999998, 521.787599999996,
-          483.095799999996, 467.049599999998, 465.286399999997, 415.548599999995, 401.047399999996,
-          380.607999999993, 377.362599999993, 347.258799999996, 338.371599999999, 310.096999999994,
-          301.409199999995, 276.280799999993, 265.586800000005, 258.994399999996, 223.915999999997,
-          215.925399999993, 213.503800000006, 191.045400000003, 166.718200000003, 166.259000000005,
-          162.941200000001, 148.829400000002, 141.645999999993, 123.535399999993, 122.329800000007,
-          89.473399999988, 80.1962000000058, 77.5457999999926, 59.1056000000099, 83.3509999999951,
-          52.2906000000075, 36.3979999999865, 40.6558000000077, 42.0003999999899, 19.6630000000005,
-          19.7153999999864, -8.38539999999921, -0.692799999989802, 0.854800000000978,
-          3.23219999999856, -3.89040000000386, -5.25880000001052, -24.9052000000083,
-          -22.6837999999989, -26.4286000000138, -34.997000000003, -37.0216000000073,
-          -43.430400000012, -58.2390000000014, -68.8034000000043, -56.9245999999985,
-          -57.8583999999973, -77.3097999999882, -73.2793999999994, -81.0738000000129,
-          -87.4530000000086, -65.0254000000132, -57.296399999992, -96.2746000000043, -103.25,
-          -96.081600000005, -91.5542000000132, -102.465200000006, -107.688599999994,
-          -101.458000000013, -109.715800000005,},
-      // precision 16
-      {47270, 46423.3584, 45585.7074, 44757.152, 43938.8416, 43130.9514, 42330.03, 41540.407,
-          40759.6348, 39988.206, 39226.5144, 38473.2096, 37729.795, 36997.268, 36272.6448,
-          35558.665, 34853.0248, 34157.4472, 33470.5204, 32793.5742, 32127.0194, 31469.4182,
-          30817.6136, 30178.6968, 29546.8908, 28922.8544, 28312.271, 27707.0924, 27114.0326,
-          26526.692, 25948.6336, 25383.7826, 24823.5998, 24272.2974, 23732.2572, 23201.4976,
-          22674.2796, 22163.6336, 21656.515, 21161.7362, 20669.9368, 20189.4424, 19717.3358,
-          19256.3744, 18795.9638, 18352.197, 17908.5738, 17474.391, 17052.918, 16637.2236,
-          16228.4602, 15823.3474, 15428.6974, 15043.0284, 14667.6278, 14297.4588, 13935.2882,
-          13578.5402, 13234.6032, 12882.1578, 12548.0728, 12219.231, 11898.0072, 11587.2626,
-          11279.9072, 10973.5048, 10678.5186, 10392.4876, 10105.2556, 9825.766, 9562.5444,
-          9294.2222, 9038.2352, 8784.848, 8533.2644, 8301.7776, 8058.30859999999, 7822.94579999999,
-          7599.11319999999, 7366.90779999999, 7161.217, 6957.53080000001, 6736.212,
-          6548.21220000001, 6343.06839999999, 6156.28719999999, 5975.15419999999, 5791.75719999999,
-          5621.32019999999, 5451.66, 5287.61040000001, 5118.09479999999, 4957.288, 4798.4246,
-          4662.17559999999, 4512.05900000001, 4364.68539999999, 4220.77720000001, 4082.67259999999,
-          3957.19519999999, 3842.15779999999, 3699.3328, 3583.01180000001, 3473.8964,
-          3338.66639999999, 3233.55559999999, 3117.799, 3008.111, 2909.69140000001,
-          2814.86499999999, 2719.46119999999, 2624.742, 2532.46979999999, 2444.7886, 2370.1868,
-          2272.45259999999, 2196.19260000001, 2117.90419999999, 2023.2972, 1969.76819999999,
-          1885.58979999999, 1833.2824, 1733.91200000001, 1682.54920000001, 1604.57980000001,
-          1556.11240000001, 1491.3064, 1421.71960000001, 1371.22899999999, 1322.1324, 1264.7892,
-          1196.23920000001, 1143.8474, 1088.67240000001, 1073.60380000001, 1023.11660000001,
-          959.036400000012, 927.433199999999, 906.792799999996, 853.433599999989, 841.873800000001,
-          791.1054, 756.899999999994, 704.343200000003, 672.495599999995, 622.790399999998,
-          611.254799999995, 567.283200000005, 519.406599999988, 519.188400000014, 495.312800000014,
-          451.350799999986, 443.973399999988, 431.882199999993, 392.027000000002, 380.924200000009,
-          345.128999999986, 298.901400000002, 287.771999999997, 272.625, 247.253000000026,
-          222.490600000019, 223.590000000026, 196.407599999977, 176.425999999978, 134.725199999986,
-          132.4804, 110.445599999977, 86.7939999999944, 56.7038000000175, 64.915399999998,
-          38.3726000000024, 37.1606000000029, 46.170999999973, 49.1716000000015, 15.3362000000197,
-          6.71639999997569, -34.8185999999987, -39.4476000000141, 12.6830000000191,
-          -12.3331999999937, -50.6565999999875, -59.9538000000175, -65.1054000000004,
-          -70.7576000000117, -106.325200000021, -126.852200000023, -110.227599999984,
-          -132.885999999999, -113.897200000007, -142.713800000027, -151.145399999979,
-          -150.799200000009, -177.756200000003, -156.036399999983, -182.735199999996,
-          -177.259399999981, -198.663600000029, -174.577600000019, -193.84580000001,},
-      // precision 17
-      {94541, 92848.811, 91174.019, 89517.558, 87879.9705, 86262.7565, 84663.5125, 83083.7435,
-          81521.7865, 79977.272, 78455.9465, 76950.219, 75465.432, 73994.152, 72546.71, 71115.2345,
-          69705.6765, 68314.937, 66944.2705, 65591.255, 64252.9485, 62938.016, 61636.8225,
-          60355.592, 59092.789, 57850.568, 56624.518, 55417.343, 54231.1415, 53067.387, 51903.526,
-          50774.649, 49657.6415, 48561.05, 47475.7575, 46410.159, 45364.852, 44327.053, 43318.4005,
-          42325.6165, 41348.4595, 40383.6265, 39436.77, 38509.502, 37594.035, 36695.939, 35818.6895,
-          34955.691, 34115.8095, 33293.949, 32465.0775, 31657.6715, 30877.2585, 30093.78,
-          29351.3695, 28594.1365, 27872.115, 27168.7465, 26477.076, 25774.541, 25106.5375,
-          24452.5135, 23815.5125, 23174.0655, 22555.2685, 21960.2065, 21376.3555, 20785.1925,
-          20211.517, 19657.0725, 19141.6865, 18579.737, 18081.3955, 17578.995, 17073.44, 16608.335,
-          16119.911, 15651.266, 15194.583, 14749.0495, 14343.4835, 13925.639, 13504.509, 13099.3885,
-          12691.2855, 12328.018, 11969.0345, 11596.5145, 11245.6355, 10917.6575, 10580.9785,
-          10277.8605, 9926.58100000001, 9605.538, 9300.42950000003, 8989.97850000003,
-          8728.73249999998, 8448.3235, 8175.31050000002, 7898.98700000002, 7629.79100000003,
-          7413.76199999999, 7149.92300000001, 6921.12650000001, 6677.1545, 6443.28000000003,
-          6278.23450000002, 6014.20049999998, 5791.20299999998, 5605.78450000001, 5438.48800000001,
-          5234.2255, 5059.6825, 4887.43349999998, 4682.935, 4496.31099999999, 4322.52250000002,
-          4191.42499999999, 4021.24200000003, 3900.64799999999, 3762.84250000003, 3609.98050000001,
-          3502.29599999997, 3363.84250000003, 3206.54849999998, 3079.70000000001, 2971.42300000001,
-          2867.80349999998, 2727.08100000001, 2630.74900000001, 2496.6165, 2440.902,
-          2356.19150000002, 2235.58199999999, 2120.54149999999, 2012.25449999998, 1933.35600000003,
-          1820.93099999998, 1761.54800000001, 1663.09350000002, 1578.84600000002, 1509.48149999999,
-          1427.3345, 1379.56150000001, 1306.68099999998, 1212.63449999999, 1084.17300000001,
-          1124.16450000001, 1060.69949999999, 1007.48849999998, 941.194499999983, 879.880500000028,
-          836.007500000007, 782.802000000025, 748.385499999975, 647.991500000004, 626.730500000005,
-          570.776000000013, 484.000500000024, 513.98550000001, 418.985499999952, 386.996999999974,
-          370.026500000036, 355.496999999974, 356.731499999994, 255.92200000002, 259.094000000041,
-          205.434499999974, 165.374500000034, 197.347500000033, 95.718499999959, 67.6165000000037,
-          54.6970000000438, 31.7395000000251, -15.8784999999916, 8.42500000004657,
-          -26.3754999999655, -118.425500000012, -66.6629999999423, -42.9745000000112,
-          -107.364999999991, -189.839000000036, -162.611499999999, -164.964999999967,
-          -189.079999999958, -223.931499999948, -235.329999999958, -269.639500000048,
-          -249.087999999989, -206.475499999942, -283.04449999996, -290.667000000016,
-          -304.561499999953, -336.784499999951, -380.386500000022, -283.280499999993,
-          -364.533000000054, -389.059499999974, -364.454000000027, -415.748000000021,
-          -417.155000000028,},
-      // precision 18
-      {189083, 185696.913, 182348.774, 179035.946, 175762.762, 172526.444, 169329.754, 166166.099,
-          163043.269, 159958.91, 156907.912, 153906.845, 150924.199, 147996.568, 145093.457,
-          142239.233, 139421.475, 136632.27, 133889.588, 131174.2, 128511.619, 125868.621,
-          123265.385, 120721.061, 118181.769, 115709.456, 113252.446, 110840.198, 108465.099,
-          106126.164, 103823.469, 101556.618, 99308.004, 97124.508, 94937.803, 92833.731, 90745.061,
-          88677.627, 86617.47, 84650.442, 82697.833, 80769.132, 78879.629, 77014.432, 75215.626,
-          73384.587, 71652.482, 69895.93, 68209.301, 66553.669, 64921.981, 63310.323, 61742.115,
-          60205.018, 58698.658, 57190.657, 55760.865, 54331.169, 52908.167, 51550.273, 50225.254,
-          48922.421, 47614.533, 46362.049, 45098.569, 43926.083, 42736.03, 41593.473, 40425.26,
-          39316.237, 38243.651, 37170.617, 36114.609, 35084.19, 34117.233, 33206.509, 32231.505,
-          31318.728, 30403.404, 29540.0550000001, 28679.236, 27825.862, 26965.216, 26179.148,
-          25462.08, 24645.952, 23922.523, 23198.144, 22529.128, 21762.4179999999, 21134.779,
-          20459.117, 19840.818, 19187.04, 18636.3689999999, 17982.831, 17439.7389999999, 16874.547,
-          16358.2169999999, 15835.684, 15352.914, 14823.681, 14329.313, 13816.897, 13342.874,
-          12880.882, 12491.648, 12021.254, 11625.392, 11293.7610000001, 10813.697, 10456.209,
-          10099.074, 9755.39000000001, 9393.18500000006, 9047.57900000003, 8657.98499999999,
-          8395.85900000005, 8033, 7736.95900000003, 7430.59699999995, 7258.47699999996,
-          6924.58200000005, 6691.29399999999, 6357.92500000005, 6202.05700000003, 5921.19700000004,
-          5628.28399999999, 5404.96799999999, 5226.71100000001, 4990.75600000005, 4799.77399999998,
-          4622.93099999998, 4472.478, 4171.78700000001, 3957.46299999999, 3868.95200000005,
-          3691.14300000004, 3474.63100000005, 3341.67200000002, 3109.14000000001, 3071.97400000005,
-          2796.40399999998, 2756.17799999996, 2611.46999999997, 2471.93000000005, 2382.26399999997,
-          2209.22400000005, 2142.28399999999, 2013.96100000001, 1911.18999999994, 1818.27099999995,
-          1668.47900000005, 1519.65800000005, 1469.67599999998, 1367.13800000004, 1248.52899999998,
-          1181.23600000003, 1022.71900000004, 1088.20700000005, 959.03600000008, 876.095999999903,
-          791.183999999892, 703.337000000058, 731.949999999953, 586.86400000006, 526.024999999907,
-          323.004999999888, 320.448000000091, 340.672999999952, 309.638999999966, 216.601999999955,
-          102.922999999952, 19.2399999999907, -0.114000000059605, -32.6240000000689,
-          -89.3179999999702, -153.497999999905, -64.2970000000205, -143.695999999996,
-          -259.497999999905, -253.017999999924, -213.948000000091, -397.590000000084,
-          -434.006000000052, -403.475000000093, -297.958000000101, -404.317000000039,
-          -528.898999999976, -506.621000000043, -513.205000000075, -479.351000000024,
-          -596.139999999898, -527.016999999993, -664.681000000099, -680.306000000099,
-          -704.050000000047, -850.486000000034, -757.43200000003, -713.308999999892,}};
-
-  private Format format;
-  private RegisterSet registerSet;
-  private final int m;
-  private final int p;
-
-  // Sparse versions of m and p
-  private int sm;
-  private int sp;
-
-  private final double alphaMM;
-
-  // How big the sparse set is allowed to get before we convert to 'normal'
-  private int sparseSetThreshold;
-  // How big the temp list is allowed to get before we batch merge it into the sparse set
-  private int sortThreshold;
-
-  private int[] tmpSet;
-  private int tmpIndex = 0;
-  private int[] sparseSet;
-
-  /**
-   * This constructor disables the sparse set. If the counter is likely to exceed the sparse set
-   * thresholds than using this constructor will help avoid the extra memory pressure created by
-   * maintaining the sparse set until that threshold is breached.
-   *
-   * @param p - the precision value for the normal set
-   */
-  public HyperLogLogPlus(int p) {
-    this(p, 0);
-  }
-
-  /**
-   * Basic constructor for creating a instance that supports sparse and normal representations. The
-   * values of <code>p</code> and <code>sp</code> define the precision of the Normal and Sparse set
-   * representations for the data structure. <code>p</code> must be a value between 4 and
-   * <code>sp</code> and <code>sp</code> must be less than 32.
-   *
-   * @param p - the precision value for the normal set
-   * @param sp - the precision value for the sparse set
-   */
-  public HyperLogLogPlus(int p, int sp) {
-    this(p, sp, null, null);
-  }
-
-  /**
-   * Constructor to support instances serialized with the legacy sparse encoding scheme.
-   *
-   * @param p - the precision value for the normal set
-   * @param sp - the precision value for the sparse set
-   * @param deltaByteSet - a list of varint byte arrays encoded using a delta encoding scheme
-   */
-  public HyperLogLogPlus(int p, int sp, List<byte[]> deltaByteSet) {
-    this(p, sp);
-    sparseSet = new int[deltaByteSet.size()];
-    int previousValue = 0;
-    for (int i = 0; i < deltaByteSet.size(); i++) {
-      int nextValue = Varint.readUnsignedVarInt(deltaByteSet.get(i));
-      sparseSet[i] = nextValue + previousValue;
-      previousValue = sparseSet[i];
-    }
-  }
-
-  // for constructing a sparse mode hllp
-  private HyperLogLogPlus(int p, int sp, int[] sparseSet) {
-    this(p, sp, sparseSet, null);
-  }
-
-  // for constructing a normal mode hllp
-  private HyperLogLogPlus(int p, int sp, RegisterSet registerSet) {
-    this(p, sp, null, registerSet);
-  }
-
-  private HyperLogLogPlus(int p, int sp, int[] sparseSet, RegisterSet registerSet) {
-    if (p < 4 || (p > sp && sp != 0)) {
-      throw new IllegalArgumentException("p must be between 4 and sp (inclusive)");
-    }
-    if (sp > 32) {
-      throw new IllegalArgumentException("sp values greater than 32 not supported");
-    }
-
-    this.p = p;
-    m = (int) Math.pow(2, p);
-    format = Format.NORMAL;
-    this.registerSet = registerSet;
-    if (registerSet == null) {
-      if (sp > 0) // Use sparse representation
-      {
-        format = Format.SPARSE;
-        this.sp = sp;
-        sm = (int) Math.pow(2, sp);
-        this.sparseSet = sparseSet;
-        sparseSetThreshold = (int) (m * 0.75);
-        sortThreshold = sparseSetThreshold / 4;
-      } else {
-        this.registerSet = new RegisterSet((int) Math.pow(2, p));
-      }
-    }
-
-    this.alphaMM = HyperLogLog.getAlphaMM(p, m);
-  }
-
-  @Override
-  public boolean offerHashed(long hashedLong) {
-    switch (format) {
-      case NORMAL:
-        // find first p bits of x
-        final long idx = hashedLong >>> (64 - p);
-        // Ignore the first p bits (the idx), and then find the number of leading zeros
-        // Push a 1 to where the bit string would have ended if we didnt just push the idx out of
-        // the way
-        // A one is always added to runLength for estimation calculation purposes
-        final int runLength =
-            Long.numberOfLeadingZeros((hashedLong << this.p) | (1 << (this.p - 1))) + 1;
-        return registerSet.updateIfGreater((int) idx, runLength);
-      case SPARSE:
-        // Call the sparse encoding scheme which attempts to stuff as much helpful data into 32 bits
-        // as possible
-        int k = encodeHash(hashedLong, p, sp);
-        if (tmpSet == null) {
-          tmpSet = new int[sortThreshold + 1];
-        }
-        // Put the encoded data into the temp set
-        tmpSet[tmpIndex++] = k;
-        if (sparseSet != null && sparseSet.length > sparseSetThreshold) {
-          mergeTempList();
-          convertToNormal();
-        } else if (tmpIndex > sortThreshold) {
-          mergeTempList();
-        }
-        return true;
-    }
-    return false;
-  }
-
-  @Override
-  public boolean offerHashed(int hashedInt) {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * Add data to estimator based on the mode it is in
-   *
-   * @param o stream element
-   * @return Will almost always return true for sparse mode because the additions are batched in
-   */
-  @Override
-  public boolean offe

<TRUNCATED>

[21/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
GEODE-2449: Moved Redis out of core with minimal Extension work added


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

Branch: refs/heads/feature/GEODE-2449
Commit: c6dbc6d4e4ea82d65074e30c4c15085a5e3d8688
Parents: 6f35a02
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Fri Feb 10 13:33:31 2017 -0800
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Fri Feb 10 13:33:32 2017 -0800

----------------------------------------------------------------------
 geode-core/build.gradle                         |    4 -
 .../distributed/ConfigurationProperties.java    |    2 -
 .../internal/DistributionConfigImpl.java        |    1 -
 .../geode/internal/cache/GemFireCacheImpl.java  |  335 +-
 .../org/apache/geode/internal/hll/Bits.java     |   45 -
 .../internal/hll/CardinalityMergeException.java |   24 -
 .../apache/geode/internal/hll/HyperLogLog.java  |  336 --
 .../geode/internal/hll/HyperLogLogPlus.java     | 1866 -----------
 .../org/apache/geode/internal/hll/IBuilder.java |   22 -
 .../apache/geode/internal/hll/ICardinality.java |   74 -
 .../apache/geode/internal/hll/MurmurHash.java   |  214 --
 .../apache/geode/internal/hll/RegisterSet.java  |  108 -
 .../domain/FixedPartitionAttributesInfo.java    |    1 -
 .../apache/geode/redis/GeodeRedisServer.java    |  729 -----
 .../apache/geode/redis/GeodeRedisService.java   |   27 +
 .../geode/redis/internal/ByteArrayWrapper.java  |  174 --
 .../redis/internal/ByteToCommandDecoder.java    |  188 --
 .../apache/geode/redis/internal/Command.java    |  145 -
 .../geode/redis/internal/DoubleWrapper.java     |   76 -
 .../redis/internal/ExecutionHandlerContext.java |  392 ---
 .../apache/geode/redis/internal/Executor.java   |   34 -
 .../apache/geode/redis/internal/Extendable.java |   31 -
 .../internal/RedisCommandParserException.java   |   42 -
 .../geode/redis/internal/RedisCommandType.java  | 2896 ------------------
 .../geode/redis/internal/RedisConstants.java    |  308 --
 .../geode/redis/internal/RedisDataType.java     |  116 -
 .../RedisDataTypeMismatchException.java         |   35 -
 .../redis/internal/RegionCreationException.java |   37 -
 .../geode/redis/internal/RegionProvider.java    |  567 ----
 .../internal/executor/AbstractExecutor.java     |  138 -
 .../internal/executor/AbstractScanExecutor.java |   47 -
 .../redis/internal/executor/AuthExecutor.java   |   54 -
 .../redis/internal/executor/DBSizeExecutor.java |   29 -
 .../redis/internal/executor/DelExecutor.java    |   53 -
 .../redis/internal/executor/EchoExecutor.java   |   38 -
 .../redis/internal/executor/ExistsExecutor.java |   47 -
 .../internal/executor/ExpirationExecutor.java   |   39 -
 .../internal/executor/ExpireAtExecutor.java     |   92 -
 .../redis/internal/executor/ExpireExecutor.java |   92 -
 .../internal/executor/FlushAllExecutor.java     |   47 -
 .../redis/internal/executor/KeysExecutor.java   |   69 -
 .../redis/internal/executor/ListQuery.java      |   64 -
 .../internal/executor/PExpireAtExecutor.java    |   30 -
 .../internal/executor/PExpireExecutor.java      |   30 -
 .../redis/internal/executor/PTTLExecutor.java   |   31 -
 .../internal/executor/PersistExecutor.java      |   51 -
 .../redis/internal/executor/PingExecutor.java   |   30 -
 .../redis/internal/executor/QuitExecutor.java   |   30 -
 .../redis/internal/executor/ScanExecutor.java   |  145 -
 .../internal/executor/ShutDownExecutor.java     |   25 -
 .../redis/internal/executor/SortedSetQuery.java |  283 --
 .../redis/internal/executor/TTLExecutor.java    |   75 -
 .../redis/internal/executor/TimeExecutor.java   |   49 -
 .../redis/internal/executor/TypeExecutor.java   |   47 -
 .../redis/internal/executor/UnkownExecutor.java |   30 -
 .../internal/executor/hash/HDelExecutor.java    |   65 -
 .../internal/executor/hash/HExistsExecutor.java |   64 -
 .../internal/executor/hash/HGetAllExecutor.java |   62 -
 .../internal/executor/hash/HGetExecutor.java    |   61 -
 .../internal/executor/hash/HIncrByExecutor.java |  111 -
 .../executor/hash/HIncrByFloatExecutor.java     |  104 -
 .../internal/executor/hash/HKeysExecutor.java   |   61 -
 .../internal/executor/hash/HLenExecutor.java    |   55 -
 .../internal/executor/hash/HMGetExecutor.java   |   71 -
 .../internal/executor/hash/HMSetExecutor.java   |   61 -
 .../internal/executor/hash/HScanExecutor.java   |  166 -
 .../internal/executor/hash/HSetExecutor.java    |   77 -
 .../internal/executor/hash/HSetNXExecutor.java  |   31 -
 .../internal/executor/hash/HValsExecutor.java   |   60 -
 .../internal/executor/hash/HashExecutor.java    |   40 -
 .../internal/executor/hll/HllExecutor.java      |   37 -
 .../internal/executor/hll/PFAddExecutor.java    |   65 -
 .../internal/executor/hll/PFCountExecutor.java  |   69 -
 .../internal/executor/hll/PFMergeExecutor.java  |   73 -
 .../redis/internal/executor/hll/Varint.java     |  238 --
 .../internal/executor/list/LIndexExecutor.java  |  118 -
 .../internal/executor/list/LInsertExecutor.java |   28 -
 .../internal/executor/list/LLenExecutor.java    |   56 -
 .../internal/executor/list/LPopExecutor.java    |   32 -
 .../internal/executor/list/LPushExecutor.java   |   32 -
 .../internal/executor/list/LPushXExecutor.java  |   32 -
 .../internal/executor/list/LRangeExecutor.java  |  113 -
 .../internal/executor/list/LRemExecutor.java    |  115 -
 .../internal/executor/list/LSetExecutor.java    |  108 -
 .../internal/executor/list/LTrimExecutor.java   |  123 -
 .../internal/executor/list/ListExecutor.java    |  141 -
 .../internal/executor/list/PopExecutor.java     |  134 -
 .../internal/executor/list/PushExecutor.java    |   54 -
 .../internal/executor/list/PushXExecutor.java   |   57 -
 .../internal/executor/list/RPopExecutor.java    |   32 -
 .../internal/executor/list/RPushExecutor.java   |   32 -
 .../internal/executor/list/RPushXExecutor.java  |   32 -
 .../internal/executor/set/SAddExecutor.java     |   60 -
 .../internal/executor/set/SCardExecutor.java    |   54 -
 .../internal/executor/set/SDiffExecutor.java    |   45 -
 .../executor/set/SDiffStoreExecutor.java        |   31 -
 .../internal/executor/set/SInterExecutor.java   |   48 -
 .../executor/set/SInterStoreExecutor.java       |   32 -
 .../executor/set/SIsMemberExecutor.java         |   62 -
 .../internal/executor/set/SMembersExecutor.java |   55 -
 .../internal/executor/set/SMoveExecutor.java    |   74 -
 .../internal/executor/set/SPopExecutor.java     |   60 -
 .../executor/set/SRandMemberExecutor.java       |  101 -
 .../internal/executor/set/SRemExecutor.java     |   62 -
 .../internal/executor/set/SScanExecutor.java    |  157 -
 .../internal/executor/set/SUnionExecutor.java   |   50 -
 .../executor/set/SUnionStoreExecutor.java       |   32 -
 .../internal/executor/set/SetExecutor.java      |   21 -
 .../internal/executor/set/SetOpExecutor.java    |  114 -
 .../executor/sortedset/SortedSetExecutor.java   |   43 -
 .../executor/sortedset/ZAddExecutor.java        |   90 -
 .../executor/sortedset/ZCardExecutor.java       |   53 -
 .../executor/sortedset/ZCountExecutor.java      |  146 -
 .../executor/sortedset/ZIncrByExecutor.java     |   76 -
 .../executor/sortedset/ZLexCountExecutor.java   |  148 -
 .../executor/sortedset/ZRangeByLexExecutor.java |  221 --
 .../sortedset/ZRangeByScoreExecutor.java        |  214 --
 .../executor/sortedset/ZRangeExecutor.java      |  124 -
 .../executor/sortedset/ZRankExecutor.java       |   97 -
 .../executor/sortedset/ZRemExecutor.java        |   62 -
 .../sortedset/ZRemRangeByLexExecutor.java       |  161 -
 .../sortedset/ZRemRangeByRankExecutor.java      |  121 -
 .../sortedset/ZRemRangeByScoreExecutor.java     |  145 -
 .../sortedset/ZRevRangeByScoreExecutor.java     |   31 -
 .../executor/sortedset/ZRevRangeExecutor.java   |   32 -
 .../executor/sortedset/ZRevRankExecutor.java    |   30 -
 .../executor/sortedset/ZScanExecutor.java       |  164 -
 .../executor/sortedset/ZScoreExecutor.java      |   58 -
 .../executor/string/AppendExecutor.java         |   68 -
 .../executor/string/BitCountExecutor.java       |   97 -
 .../internal/executor/string/BitOpExecutor.java |  154 -
 .../executor/string/BitPosExecutor.java         |  140 -
 .../executor/string/DecrByExecutor.java         |  113 -
 .../internal/executor/string/DecrExecutor.java  |   95 -
 .../executor/string/GetBitExecutor.java         |   80 -
 .../internal/executor/string/GetExecutor.java   |   51 -
 .../executor/string/GetRangeExecutor.java       |   96 -
 .../executor/string/GetSetExecutor.java         |   58 -
 .../executor/string/IncrByExecutor.java         |  108 -
 .../executor/string/IncrByFloatExecutor.java    |  128 -
 .../internal/executor/string/IncrExecutor.java  |   91 -
 .../internal/executor/string/MGetExecutor.java  |   67 -
 .../internal/executor/string/MSetExecutor.java  |   62 -
 .../executor/string/MSetNXExecutor.java         |   86 -
 .../executor/string/PSetEXExecutor.java         |   32 -
 .../executor/string/SetBitExecutor.java         |  108 -
 .../internal/executor/string/SetEXExecutor.java |   90 -
 .../internal/executor/string/SetExecutor.java   |  155 -
 .../internal/executor/string/SetNXExecutor.java |   58 -
 .../executor/string/SetRangeExecutor.java       |   96 -
 .../executor/string/StringExecutor.java         |   45 -
 .../executor/string/StrlenExecutor.java         |   56 -
 .../executor/transactions/DiscardExecutor.java  |   40 -
 .../executor/transactions/ExecExecutor.java     |   87 -
 .../executor/transactions/MultiExecutor.java    |   45 -
 .../transactions/TransactionExecutor.java       |   21 -
 .../executor/transactions/UnwatchExecutor.java  |   30 -
 .../executor/transactions/WatchExecutor.java    |   30 -
 .../org/apache/hadoop/fs/GlobPattern.java       |  165 -
 .../org/apache/geode/redis/AuthJUnitTest.java   |  160 -
 .../apache/geode/redis/ConcurrentStartTest.java |  100 -
 .../org/apache/geode/redis/HashesJUnitTest.java |  185 --
 .../org/apache/geode/redis/ListsJUnitTest.java  |  251 --
 .../apache/geode/redis/RedisDistDUnitTest.java  |  265 --
 .../org/apache/geode/redis/RedisServerTest.java |   84 -
 .../org/apache/geode/redis/SetsJUnitTest.java   |  257 --
 .../apache/geode/redis/SortedSetsJUnitTest.java |  420 ---
 .../apache/geode/redis/StringsJunitTest.java    |  304 --
 geode-redis/build.gradle                        |   29 +
 .../geode/redis/GeodeRedisServiceImpl.java      |  597 ++++
 .../geode/redis/internal/ByteArrayWrapper.java  |  174 ++
 .../redis/internal/ByteToCommandDecoder.java    |  188 ++
 .../apache/geode/redis/internal/Command.java    |  145 +
 .../geode/redis/internal/DoubleWrapper.java     |   76 +
 .../redis/internal/ExecutionHandlerContext.java |  392 +++
 .../apache/geode/redis/internal/Executor.java   |   34 +
 .../apache/geode/redis/internal/Extendable.java |   31 +
 .../internal/RedisCommandParserException.java   |   42 +
 .../geode/redis/internal/RedisCommandType.java  | 2896 ++++++++++++++++++
 .../geode/redis/internal/RedisConstants.java    |  308 ++
 .../geode/redis/internal/RedisDataType.java     |  116 +
 .../RedisDataTypeMismatchException.java         |   35 +
 .../redis/internal/RegionCreationException.java |   37 +
 .../geode/redis/internal/RegionProvider.java    |  567 ++++
 .../internal/executor/AbstractExecutor.java     |  139 +
 .../internal/executor/AbstractScanExecutor.java |   47 +
 .../redis/internal/executor/AuthExecutor.java   |   54 +
 .../redis/internal/executor/DBSizeExecutor.java |   29 +
 .../redis/internal/executor/DelExecutor.java    |   53 +
 .../redis/internal/executor/EchoExecutor.java   |   38 +
 .../redis/internal/executor/ExistsExecutor.java |   47 +
 .../internal/executor/ExpirationExecutor.java   |   39 +
 .../internal/executor/ExpireAtExecutor.java     |   92 +
 .../redis/internal/executor/ExpireExecutor.java |   92 +
 .../internal/executor/FlushAllExecutor.java     |   47 +
 .../redis/internal/executor/KeysExecutor.java   |   69 +
 .../redis/internal/executor/ListQuery.java      |   64 +
 .../internal/executor/PExpireAtExecutor.java    |   30 +
 .../internal/executor/PExpireExecutor.java      |   30 +
 .../redis/internal/executor/PTTLExecutor.java   |   31 +
 .../internal/executor/PersistExecutor.java      |   51 +
 .../redis/internal/executor/PingExecutor.java   |   30 +
 .../redis/internal/executor/QuitExecutor.java   |   30 +
 .../redis/internal/executor/ScanExecutor.java   |  146 +
 .../internal/executor/ShutDownExecutor.java     |   25 +
 .../redis/internal/executor/SortedSetQuery.java |  283 ++
 .../redis/internal/executor/TTLExecutor.java    |   75 +
 .../redis/internal/executor/TimeExecutor.java   |   48 +
 .../redis/internal/executor/TypeExecutor.java   |   47 +
 .../redis/internal/executor/UnkownExecutor.java |   30 +
 .../internal/executor/hash/HDelExecutor.java    |   65 +
 .../internal/executor/hash/HExistsExecutor.java |   64 +
 .../internal/executor/hash/HGetAllExecutor.java |   62 +
 .../internal/executor/hash/HGetExecutor.java    |   61 +
 .../internal/executor/hash/HIncrByExecutor.java |  111 +
 .../executor/hash/HIncrByFloatExecutor.java     |  104 +
 .../internal/executor/hash/HKeysExecutor.java   |   61 +
 .../internal/executor/hash/HLenExecutor.java    |   55 +
 .../internal/executor/hash/HMGetExecutor.java   |   71 +
 .../internal/executor/hash/HMSetExecutor.java   |   61 +
 .../internal/executor/hash/HScanExecutor.java   |  166 +
 .../internal/executor/hash/HSetExecutor.java    |   77 +
 .../internal/executor/hash/HSetNXExecutor.java  |   31 +
 .../internal/executor/hash/HValsExecutor.java   |   60 +
 .../internal/executor/hash/HashExecutor.java    |   40 +
 .../internal/executor/hll/HllExecutor.java      |   37 +
 .../internal/executor/hll/PFAddExecutor.java    |   65 +
 .../internal/executor/hll/PFCountExecutor.java  |   69 +
 .../internal/executor/hll/PFMergeExecutor.java  |   73 +
 .../redis/internal/executor/hll/Varint.java     |  238 ++
 .../internal/executor/list/LIndexExecutor.java  |  118 +
 .../internal/executor/list/LInsertExecutor.java |   28 +
 .../internal/executor/list/LLenExecutor.java    |   56 +
 .../internal/executor/list/LPopExecutor.java    |   32 +
 .../internal/executor/list/LPushExecutor.java   |   32 +
 .../internal/executor/list/LPushXExecutor.java  |   32 +
 .../internal/executor/list/LRangeExecutor.java  |  113 +
 .../internal/executor/list/LRemExecutor.java    |  115 +
 .../internal/executor/list/LSetExecutor.java    |  108 +
 .../internal/executor/list/LTrimExecutor.java   |  123 +
 .../internal/executor/list/ListExecutor.java    |  141 +
 .../internal/executor/list/PopExecutor.java     |  133 +
 .../internal/executor/list/PushExecutor.java    |   54 +
 .../internal/executor/list/PushXExecutor.java   |   57 +
 .../internal/executor/list/RPopExecutor.java    |   32 +
 .../internal/executor/list/RPushExecutor.java   |   32 +
 .../internal/executor/list/RPushXExecutor.java  |   32 +
 .../internal/executor/set/SAddExecutor.java     |   60 +
 .../internal/executor/set/SCardExecutor.java    |   54 +
 .../internal/executor/set/SDiffExecutor.java    |   45 +
 .../executor/set/SDiffStoreExecutor.java        |   31 +
 .../internal/executor/set/SInterExecutor.java   |   48 +
 .../executor/set/SInterStoreExecutor.java       |   32 +
 .../executor/set/SIsMemberExecutor.java         |   62 +
 .../internal/executor/set/SMembersExecutor.java |   55 +
 .../internal/executor/set/SMoveExecutor.java    |   74 +
 .../internal/executor/set/SPopExecutor.java     |   60 +
 .../executor/set/SRandMemberExecutor.java       |  101 +
 .../internal/executor/set/SRemExecutor.java     |   62 +
 .../internal/executor/set/SScanExecutor.java    |  157 +
 .../internal/executor/set/SUnionExecutor.java   |   50 +
 .../executor/set/SUnionStoreExecutor.java       |   32 +
 .../internal/executor/set/SetExecutor.java      |   21 +
 .../internal/executor/set/SetOpExecutor.java    |  114 +
 .../executor/sortedset/SortedSetExecutor.java   |   43 +
 .../executor/sortedset/ZAddExecutor.java        |   90 +
 .../executor/sortedset/ZCardExecutor.java       |   53 +
 .../executor/sortedset/ZCountExecutor.java      |  146 +
 .../executor/sortedset/ZIncrByExecutor.java     |   76 +
 .../executor/sortedset/ZLexCountExecutor.java   |  148 +
 .../executor/sortedset/ZRangeByLexExecutor.java |  220 ++
 .../sortedset/ZRangeByScoreExecutor.java        |  214 ++
 .../executor/sortedset/ZRangeExecutor.java      |  124 +
 .../executor/sortedset/ZRankExecutor.java       |   97 +
 .../executor/sortedset/ZRemExecutor.java        |   62 +
 .../sortedset/ZRemRangeByLexExecutor.java       |  161 +
 .../sortedset/ZRemRangeByRankExecutor.java      |  121 +
 .../sortedset/ZRemRangeByScoreExecutor.java     |  145 +
 .../sortedset/ZRevRangeByScoreExecutor.java     |   31 +
 .../executor/sortedset/ZRevRangeExecutor.java   |   32 +
 .../executor/sortedset/ZRevRankExecutor.java    |   30 +
 .../executor/sortedset/ZScanExecutor.java       |  164 +
 .../executor/sortedset/ZScoreExecutor.java      |   58 +
 .../executor/string/AppendExecutor.java         |   68 +
 .../executor/string/BitCountExecutor.java       |   97 +
 .../internal/executor/string/BitOpExecutor.java |  154 +
 .../executor/string/BitPosExecutor.java         |  140 +
 .../executor/string/DecrByExecutor.java         |  113 +
 .../internal/executor/string/DecrExecutor.java  |   95 +
 .../executor/string/GetBitExecutor.java         |   80 +
 .../internal/executor/string/GetExecutor.java   |   51 +
 .../executor/string/GetRangeExecutor.java       |   96 +
 .../executor/string/GetSetExecutor.java         |   58 +
 .../executor/string/IncrByExecutor.java         |  108 +
 .../executor/string/IncrByFloatExecutor.java    |  128 +
 .../internal/executor/string/IncrExecutor.java  |   91 +
 .../internal/executor/string/MGetExecutor.java  |   67 +
 .../internal/executor/string/MSetExecutor.java  |   62 +
 .../executor/string/MSetNXExecutor.java         |   86 +
 .../executor/string/PSetEXExecutor.java         |   32 +
 .../executor/string/SetBitExecutor.java         |  108 +
 .../internal/executor/string/SetEXExecutor.java |   90 +
 .../internal/executor/string/SetExecutor.java   |  155 +
 .../internal/executor/string/SetNXExecutor.java |   58 +
 .../executor/string/SetRangeExecutor.java       |   96 +
 .../executor/string/StringExecutor.java         |   45 +
 .../executor/string/StrlenExecutor.java         |   56 +
 .../executor/transactions/DiscardExecutor.java  |   40 +
 .../executor/transactions/ExecExecutor.java     |   86 +
 .../executor/transactions/MultiExecutor.java    |   45 +
 .../transactions/TransactionExecutor.java       |   21 +
 .../executor/transactions/UnwatchExecutor.java  |   30 +
 .../executor/transactions/WatchExecutor.java    |   30 +
 .../apache/geode/redis/internal/hll/Bits.java   |   45 +
 .../internal/hll/CardinalityMergeException.java |   22 +
 .../geode/redis/internal/hll/HyperLogLog.java   |  336 ++
 .../redis/internal/hll/HyperLogLogPlus.java     | 1866 +++++++++++
 .../geode/redis/internal/hll/IBuilder.java      |   22 +
 .../geode/redis/internal/hll/ICardinality.java  |   74 +
 .../geode/redis/internal/hll/MurmurHash.java    |  214 ++
 .../geode/redis/internal/hll/RegisterSet.java   |  108 +
 .../org/apache/hadoop/fs/GlobPattern.java       |  165 +
 ...org.apache.geode.internal.cache.CacheService |    1 +
 .../org/apache/geode/redis/AuthJUnitTest.java   |  120 +
 .../apache/geode/redis/ConcurrentStartTest.java |   85 +
 .../org/apache/geode/redis/HashesJUnitTest.java |  147 +
 .../org/apache/geode/redis/ListsJUnitTest.java  |  212 ++
 .../apache/geode/redis/RedisDistDUnitTest.java  |  266 ++
 .../org/apache/geode/redis/RedisServerTest.java |   54 +
 .../org/apache/geode/redis/RedisTestBase.java   |  103 +
 .../org/apache/geode/redis/SetsJUnitTest.java   |  194 ++
 .../apache/geode/redis/SortedSetsJUnitTest.java |  417 +++
 .../apache/geode/redis/StringsJunitTest.java    |  287 ++
 gradle/dependency-versions.properties           |    4 +-
 settings.gradle                                 |    2 +
 335 files changed, 20528 insertions(+), 20773 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 8eba6d4..fd7cdeb 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -47,9 +47,6 @@ dependencies {
     exclude module: 'xml-apis'
     ext.optional = true
   }
-  compile ('io.netty:netty-all:' + project.'netty-all.version') {
-    ext.optional = true
-  }
   compile 'it.unimi.dsi:fastutil:' + project.'fastutil.version'
   compile ('javax.mail:javax.mail-api:' + project.'javax.mail-api.version') {
     ext.optional = true;
@@ -126,7 +123,6 @@ dependencies {
   testRuntime 'commons-configuration:commons-configuration:' + project.'commons-configuration.version'
   testRuntime 'commons-io:commons-io:' + project.'commons-io.version'
   testCompile 'net.spy:spymemcached:' + project.'spymemcached.version'
-  testCompile 'redis.clients:jedis:' + project.'jedis.version'
 
   testCompile 'org.powermock:powermock-core:' + project.'powermock.version'
   testCompile 'org.powermock:powermock-module-junit4:' + project.'powermock.version'

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java b/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
index 63f6505..e11ace2 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ConfigurationProperties.java
@@ -15,8 +15,6 @@
 
 package org.apache.geode.distributed;
 
-import org.apache.geode.redis.GeodeRedisServer;
-
 /**
  * This interface defines all the configuration properties that can be used. <U>Since</U>: Geode 1.0
  */

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
index fa6d13f..9b97c7e 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
@@ -35,7 +35,6 @@ import java.util.Set;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.geode.redis.GeodeRedisServer;
 
 import org.apache.geode.GemFireConfigException;
 import org.apache.geode.GemFireIOException;

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 6e374ec..fd48be1 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -88,6 +88,7 @@ import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.DistributedSystemDisconnectedException;
 import org.apache.geode.distributed.Locator;
 import org.apache.geode.distributed.internal.CacheTime;
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionAdvisee;
 import org.apache.geode.distributed.internal.DistributionAdvisor;
@@ -102,7 +103,6 @@ import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.ResourceEvent;
 import org.apache.geode.distributed.internal.ResourceEventsListener;
 import org.apache.geode.distributed.internal.ServerLocation;
-import org.apache.geode.distributed.internal.ClusterConfigurationService;
 import org.apache.geode.distributed.internal.locks.DLockService;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.i18n.LogWriterI18n;
@@ -172,7 +172,7 @@ import org.apache.geode.pdx.internal.AutoSerializableManager;
 import org.apache.geode.pdx.internal.PdxInstanceFactoryImpl;
 import org.apache.geode.pdx.internal.PdxInstanceImpl;
 import org.apache.geode.pdx.internal.TypeRegistry;
-import org.apache.geode.redis.GeodeRedisServer;
+import org.apache.geode.redis.GeodeRedisService;
 import org.apache.logging.log4j.Logger;
 
 import java.io.BufferedReader;
@@ -230,9 +230,9 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.naming.Context;
 
 // @todo somebody Come up with more reasonable values for {@link #DEFAULT_LOCK_TIMEOUT}, etc.
+
 /**
  * GemFire's implementation of a distributed {@link org.apache.geode.cache.Cache}.
- *
  */
 @SuppressWarnings("deprecation")
 public class GemFireCacheImpl
@@ -241,7 +241,9 @@ public class GemFireCacheImpl
 
   // moved *SERIAL_NUMBER stuff to DistributionAdvisor
 
-  /** The default number of seconds to wait for a distributed lock */
+  /**
+   * The default number of seconds to wait for a distributed lock
+   */
   public static final int DEFAULT_LOCK_TIMEOUT = Integer
       .getInteger(DistributionConfig.GEMFIRE_PREFIX + "Cache.defaultLockTimeout", 60).intValue();
 
@@ -251,10 +253,14 @@ public class GemFireCacheImpl
   public static final int DEFAULT_LOCK_LEASE = Integer
       .getInteger(DistributionConfig.GEMFIRE_PREFIX + "Cache.defaultLockLease", 120).intValue();
 
-  /** The default "copy on read" attribute value */
+  /**
+   * The default "copy on read" attribute value
+   */
   public static final boolean DEFAULT_COPY_ON_READ = false;
 
-  /** the last instance of GemFireCache created */
+  /**
+   * the last instance of GemFireCache created
+   */
   private static volatile GemFireCacheImpl instance = null;
   /**
    * Just like instance but is valid for a bit longer so that pdx can still find the cache during a
@@ -284,7 +290,6 @@ public class GemFireCacheImpl
    * If true then when a delta is applied the size of the entry value will be recalculated. If false
    * (the default) then the size of the entry value is unchanged by a delta application. Not a final
    * so that tests can change this value.
-   *
    * @since GemFire hitachi 6.1.2.9
    */
   public static boolean DELTAS_RECALCULATE_SIZE =
@@ -329,7 +334,9 @@ public class GemFireCacheImpl
 
   // time in ms
   private static final int FIVE_HOURS = 5 * 60 * 60 * 1000;
-  /** To test MAX_QUERY_EXECUTION_TIME option. */
+  /**
+   * To test MAX_QUERY_EXECUTION_TIME option.
+   */
   public int TEST_MAX_QUERY_EXECUTION_TIME = -1;
   public boolean TEST_MAX_QUERY_EXECUTION_TIME_OVERRIDE_EXCEPTION = false;
 
@@ -360,21 +367,31 @@ public class GemFireCacheImpl
   protected volatile boolean closingGatewaySendersByShutdownAll = false;
   protected volatile boolean closingGatewayReceiversByShutdownAll = false;
 
-  /** Amount of time (in seconds) to wait for a distributed lock */
+  /**
+   * Amount of time (in seconds) to wait for a distributed lock
+   */
   private int lockTimeout = DEFAULT_LOCK_TIMEOUT;
 
-  /** Amount of time a lease of a distributed lock lasts */
+  /**
+   * Amount of time a lease of a distributed lock lasts
+   */
   private int lockLease = DEFAULT_LOCK_LEASE;
 
-  /** Amount of time to wait for a <code>netSearch</code> to complete */
+  /**
+   * Amount of time to wait for a <code>netSearch</code> to complete
+   */
   private int searchTimeout = DEFAULT_SEARCH_TIMEOUT;
 
   private final CachePerfStats cachePerfStats;
 
-  /** Date on which this instances was created */
+  /**
+   * Date on which this instances was created
+   */
   private final Date creationDate;
 
-  /** thread pool for event dispatching */
+  /**
+   * thread pool for event dispatching
+   */
   private final ThreadPoolExecutor eventThreadPool;
 
   /**
@@ -386,7 +403,6 @@ public class GemFireCacheImpl
 
   /**
    * Controls updates to the list of all gateway senders
-   *
    * @see #allGatewaySenders
    */
   public final Object allGatewaySendersLock = new Object();
@@ -413,7 +429,6 @@ public class GemFireCacheImpl
 
   /**
    * Controls updates to the list of all gateway receivers
-   *
    * @see #allGatewayReceivers
    */
   public final Object allGatewayReceiversLock = new Object();
@@ -424,7 +439,9 @@ public class GemFireCacheImpl
    */
   private volatile Set<GatewayReceiver> allGatewayReceivers = Collections.emptySet();
 
-  /** PartitionedRegion instances (for required-events notification */
+  /**
+   * PartitionedRegion instances (for required-events notification
+   */
   // This is a HashSet because I know that clear() on it does not
   // allocate any objects.
   private final HashSet<PartitionedRegion> partitionedRegions = new HashSet<PartitionedRegion>();
@@ -443,25 +460,32 @@ public class GemFireCacheImpl
 
   /**
    * conflict resolver for WAN, if any
-   * 
    * @guarded.By {@link #allGatewayHubsLock}
    */
   private GatewayConflictResolver gatewayConflictResolver;
 
-  /** Is this is "server" cache? */
+  /**
+   * Is this is "server" cache?
+   */
   private boolean isServer = false;
 
-  /** transaction manager for this cache */
+  /**
+   * transaction manager for this cache
+   */
   private final TXManagerImpl txMgr;
 
   private RestAgent restAgent;
 
   private boolean isRESTServiceRunning = false;
 
-  /** Copy on Read feature for all read operations e.g. get */
+  /**
+   * Copy on Read feature for all read operations e.g. get
+   */
   private volatile boolean copyOnRead = DEFAULT_COPY_ON_READ;
 
-  /** The named region attributes registered with this cache. */
+  /**
+   * The named region attributes registered with this cache.
+   */
   private final Map namedRegionAttributes = Collections.synchronizedMap(new HashMap());
 
   /**
@@ -476,7 +500,9 @@ public class GemFireCacheImpl
    */
   protected volatile Throwable disconnectCause = null;
 
-  /** context where this cache was created -- for debugging, really... */
+  /**
+   * context where this cache was created -- for debugging, really...
+   */
   public Exception creationStack = null;
 
   /**
@@ -490,7 +516,6 @@ public class GemFireCacheImpl
    * DistributedLockService for PartitionedRegions. Remains null until the first PartitionedRegion
    * is created. Destroyed by GemFireCache when closing the cache. Protected by synchronization on
    * this GemFireCache.
-   *
    * @guarded.By prLockServiceLock
    */
   private DistributedLockService prLockService;
@@ -503,7 +528,6 @@ public class GemFireCacheImpl
   /**
    * DistributedLockService for GatewaySenders. Remains null until the first GatewaySender is
    * created. Destroyed by GemFireCache when closing the cache.
-   * 
    * @guarded.By gatewayLockServiceLock
    */
   private volatile DistributedLockService gatewayLockService;
@@ -529,7 +553,6 @@ public class GemFireCacheImpl
 
   /**
    * Enabled when CacheExistsException issues arise in debugging
-   *
    * @see #creationStack
    */
   private static final boolean DEBUG_CREATION_STACK = false;
@@ -562,7 +585,9 @@ public class GemFireCacheImpl
   private final Map<Declarable, Properties> declarablePropertiesMap =
       new ConcurrentHashMap<Declarable, Properties>();
 
-  /** {@link PropertyResolver} to resolve ${} type property strings */
+  /**
+   * {@link PropertyResolver} to resolve ${} type property strings
+   */
   protected static PropertyResolver resolver;
 
   protected static boolean xmlParameterizationEnabled =
@@ -578,14 +603,13 @@ public class GemFireCacheImpl
    */
   private GemFireMemcachedServer memcachedServer;
 
-  /**
-   * Redis server is started when {@link DistributionConfig#getRedisPort()} is set
-   */
-  private GeodeRedisServer redisServer;
+  // /**
+  // * Redis server is started when {@link DistributionConfig#getRedisPort()} is set
+  // */
+  // private CacheService redisServer;
 
   /**
    * {@link ExtensionPoint} support.
-   * 
    * @since GemFire 8.1
    */
   private SimpleExtensionPoint<Cache> extensionPoint = new SimpleExtensionPoint<Cache>(this, this);
@@ -621,16 +645,13 @@ public class GemFireCacheImpl
    * kernel data, shared memory, and memory-mapped files. All mapped pages are guaranteed to be
    * resident in RAM when the call returns successfully; the pages are guaranteed to stay in RAM
    * until later unlocked.
-   * 
    * @param flags MCL_CURRENT 1 - Lock all pages which are currently mapped into the address space
-   *        of the process.
-   * 
-   *        MCL_FUTURE 2 - Lock all pages which will become mapped into the address space of the
-   *        process in the future. These could be for instance new pages required by a growing heap
-   *        and stack as well as new memory mapped files or shared memory regions.
-   * 
+   * of the process.
+   *
+   * MCL_FUTURE 2 - Lock all pages which will become mapped into the address space of the process in
+   * the future. These could be for instance new pages required by a growing heap and stack as well
+   * as new memory mapped files or shared memory regions.
    * @return 0 if success, non-zero if error and errno set
-   * 
    */
   private static native int mlockall(int flags);
 
@@ -693,10 +714,14 @@ public class GemFireCacheImpl
 
   // ////////////////////// Constructors /////////////////////////
 
-  /** Map of Futures used to track Regions that are being reinitialized */
+  /**
+   * Map of Futures used to track Regions that are being reinitialized
+   */
   private final ConcurrentMap reinitializingRegions = new ConcurrentHashMap();
 
-  /** Returns the last created instance of GemFireCache */
+  /**
+   * Returns the last created instance of GemFireCache
+   */
   public static GemFireCacheImpl getInstance() {
     return instance;
   }
@@ -712,7 +737,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns an existing instance. If a cache does not exist throws a cache closed exception.
-   * 
    * @return the existing cache
    * @throws CacheClosedException if an existing cache can not be found.
    */
@@ -731,7 +755,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns an existing instance. If a cache does not exist throws an exception.
-   *
    * @param reason the reason an existing cache is being requested.
    * @return the existing cache
    * @throws CacheClosedException if an existing cache can not be found.
@@ -765,7 +788,7 @@ public class GemFireCacheImpl
   // }
 
   public static GemFireCacheImpl createClient(DistributedSystem system, PoolFactory pf,
-      CacheConfig cacheConfig) {
+                                              CacheConfig cacheConfig) {
     return basicCreate(system, true, cacheConfig, pf, true, ASYNC_EVENT_LISTENERS, null);
   }
 
@@ -774,20 +797,22 @@ public class GemFireCacheImpl
   }
 
   public static GemFireCacheImpl createWithAsyncEventListeners(DistributedSystem system,
-      CacheConfig cacheConfig, TypeRegistry typeRegistry) {
+                                                               CacheConfig cacheConfig,
+                                                               TypeRegistry typeRegistry) {
     return basicCreate(system, true, cacheConfig, null, false, true, typeRegistry);
   }
 
   public static Cache create(DistributedSystem system, boolean existingOk,
-      CacheConfig cacheConfig) {
+                             CacheConfig cacheConfig) {
     return basicCreate(system, existingOk, cacheConfig, null, false, ASYNC_EVENT_LISTENERS, null);
   }
 
 
-
   private static GemFireCacheImpl basicCreate(DistributedSystem system, boolean existingOk,
-      CacheConfig cacheConfig, PoolFactory pf, boolean isClient, boolean asyncEventListeners,
-      TypeRegistry typeRegistry) throws CacheExistsException, TimeoutException,
+                                              CacheConfig cacheConfig, PoolFactory pf,
+                                              boolean isClient, boolean asyncEventListeners,
+                                              TypeRegistry typeRegistry)
+      throws CacheExistsException, TimeoutException,
       CacheWriterException, GatewayException, RegionExistsException {
     try {
       synchronized (GemFireCacheImpl.class) {
@@ -830,11 +855,11 @@ public class GemFireCacheImpl
   /**
    * Creates a new instance of GemFireCache and populates it according to the
    * <code>cache.xml</code>, if appropriate.
-   * 
    * @param typeRegistry: currently only unit tests set this parameter to a non-null value
    */
   private GemFireCacheImpl(boolean isClient, PoolFactory pf, DistributedSystem system,
-      CacheConfig cacheConfig, boolean asyncEventListeners, TypeRegistry typeRegistry) {
+                           CacheConfig cacheConfig, boolean asyncEventListeners,
+                           TypeRegistry typeRegistry) {
     this.isClient = isClient;
     this.clientpf = pf;
     this.cacheConfig = cacheConfig; // do early for bug 43213
@@ -982,7 +1007,6 @@ public class GemFireCacheImpl
 
   /**
    * Used by Hydra tests to get handle of Rest Agent
-   * 
    * @return RestAgent
    */
   public RestAgent getRestAgent() {
@@ -996,13 +1020,15 @@ public class GemFireCacheImpl
   public ConfigurationResponse requestSharedConfiguration() {
     final DistributionConfig config = this.system.getConfig();
 
-    if (!(dm instanceof DistributionManager))
+    if (!(dm instanceof DistributionManager)) {
       return null;
+    }
 
     // do nothing if this vm is/has locator or this is a client
     if (((DistributionManager) dm).getDMType() == DistributionManager.LOCATOR_DM_TYPE || isClient
-        || Locator.getLocator() != null)
+        || Locator.getLocator() != null) {
       return null;
+    }
 
     // can't simply return null if server is not using shared configuration, since we need to find
     // out
@@ -1021,7 +1047,6 @@ public class GemFireCacheImpl
       return null;
     }
 
-
     ConfigurationResponse response = null;
     List<String> locatorConnectionStrings = getSharedConfigLocatorConnectionStringList();
 
@@ -1056,7 +1081,7 @@ public class GemFireCacheImpl
       if (isMisConfigured(clusterSecProperties, serverSecProperties,
           ConfigurationProperties.SECURITY_MANAGER)
           || isMisConfigured(clusterSecProperties, serverSecProperties,
-              ConfigurationProperties.SECURITY_POST_PROCESSOR)) {
+          ConfigurationProperties.SECURITY_POST_PROCESSOR)) {
         throw new GemFireConfigException(
             LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION.toLocalizedString());
       }
@@ -1089,17 +1114,19 @@ public class GemFireCacheImpl
 
   // When called, clusterProps and serverProps and key could not be null
   public static boolean isMisConfigured(Properties clusterProps, Properties serverProps,
-      String key) {
+                                        String key) {
     String clusterPropValue = clusterProps.getProperty(key);
     String serverPropValue = serverProps.getProperty(key);
 
     // if this server prop is not specified, this is always OK.
-    if (StringUtils.isBlank(serverPropValue))
+    if (StringUtils.isBlank(serverPropValue)) {
       return false;
+    }
 
     // server props is not blank, but cluster props is blank, NOT OK.
-    if (StringUtils.isBlank(clusterPropValue))
+    if (StringUtils.isBlank(clusterPropValue)) {
       return true;
+    }
 
     // at this point check for eqality
     return !clusterPropValue.equals(serverPropValue);
@@ -1130,7 +1157,6 @@ public class GemFireCacheImpl
   }
 
 
-
   /**
    * Used by unit tests to force cache creation to use a test generated cache.xml
    */
@@ -1147,7 +1173,6 @@ public class GemFireCacheImpl
   /**
    * Method to check for GemFire client. In addition to checking for ClientCacheFactory, this method
    * checks for any defined pools.
-   *
    * @return true if the cache has pools declared
    */
   public boolean hasPool() {
@@ -1156,7 +1181,7 @@ public class GemFireCacheImpl
 
   private Collection<Pool> getAllPools() {
     Collection<Pool> pools = PoolManagerImpl.getPMI().getMap().values();
-    for (Iterator<Pool> itr = pools.iterator(); itr.hasNext();) {
+    for (Iterator<Pool> itr = pools.iterator(); itr.hasNext(); ) {
       PoolImpl pool = (PoolImpl) itr.next();
       if (pool.isUsedByGateway()) {
         itr.remove();
@@ -1189,7 +1214,7 @@ public class GemFireCacheImpl
     GemFireCacheImpl.pdxInstance = this;
 
     for (Iterator<CacheLifecycleListener> iter = cacheLifecycleListeners.iterator(); iter
-        .hasNext();) {
+        .hasNext(); ) {
       CacheLifecycleListener listener = (CacheLifecycleListener) iter.next();
       listener.cacheCreated(this);
     }
@@ -1215,7 +1240,6 @@ public class GemFireCacheImpl
       securityService.setPostProcessor(cacheConfig.getPostProcessor());
     }
 
-
     SystemMemberCacheEventProcessor.send(this, Operation.CACHE_CREATE);
     this.resourceAdvisor.initializationGate();
 
@@ -1317,11 +1341,11 @@ public class GemFireCacheImpl
       if (bindAddress.equals(DistributionConfig.DEFAULT_MEMCACHED_BIND_ADDRESS)) {
         logger.info(LocalizedMessage.create(
             LocalizedStrings.GemFireCacheImpl_STARTING_GEMFIRE_MEMCACHED_SERVER_ON_PORT_0_FOR_1_PROTOCOL,
-            new Object[] {port, protocol}));
+            new Object[]{port, protocol}));
       } else {
         logger.info(LocalizedMessage.create(
             LocalizedStrings.GemFireCacheImpl_STARTING_GEMFIRE_MEMCACHED_SERVER_ON_BIND_ADDRESS_0_PORT_1_FOR_2_PROTOCOL,
-            new Object[] {bindAddress, port, protocol}));
+            new Object[]{bindAddress, port, protocol}));
       }
       this.memcachedServer =
           new GemFireMemcachedServer(bindAddress, port, Protocol.valueOf(protocol.toUpperCase()));
@@ -1330,21 +1354,11 @@ public class GemFireCacheImpl
   }
 
   private void startRedisServer() {
+    //TODO this needs to be fixed up. Maybe we don't want to leave the starting of redis to the setting of the port.
     int port = system.getConfig().getRedisPort();
     if (port != 0) {
-      String bindAddress = system.getConfig().getRedisBindAddress();
-      assert bindAddress != null;
-      if (bindAddress.equals(DistributionConfig.DEFAULT_REDIS_BIND_ADDRESS)) {
-        getLoggerI18n().info(
-            LocalizedStrings.GemFireCacheImpl_STARTING_GEMFIRE_REDIS_SERVER_ON_PORT_0,
-            new Object[] {port});
-      } else {
-        getLoggerI18n().info(
-            LocalizedStrings.GemFireCacheImpl_STARTING_GEMFIRE_REDIS_SERVER_ON_BIND_ADDRESS_0_PORT_1,
-            new Object[] {bindAddress, port});
-      }
-      this.redisServer = new GeodeRedisServer(bindAddress, port);
-      this.redisServer.start();
+      GeodeRedisService geodeRedisService = getService(GeodeRedisService.class);
+      geodeRedisService.start();
     }
   }
 
@@ -1403,18 +1417,16 @@ public class GemFireCacheImpl
    * file specified by the given <code>DistributedSystem</code>. Note that this operation cannot be
    * performed in the constructor because creating regions in the cache, etc. uses the cache itself
    * (which isn't initialized until the constructor returns).
-   *
    * @throws CacheXmlException If something goes wrong while parsing the declarative caching XML
-   *         file.
+   * file.
    * @throws TimeoutException If a {@link org.apache.geode.cache.Region#put(Object, Object)}times
-   *         out while initializing the cache.
+   * out while initializing the cache.
    * @throws CacheWriterException If a <code>CacheWriterException</code> is thrown while
-   *         initializing the cache.
+   * initializing the cache.
    * @throws RegionExistsException If the declarative caching XML file desribes a region that
-   *         already exists (including the root region).
+   * already exists (including the root region).
    * @throws GatewayException If a <code>GatewayException</code> is thrown while initializing the
-   *         cache.
-   * 
+   * cache.
    * @see #loadCacheXml
    */
   private void initializeDeclarativeCache()
@@ -1452,12 +1464,12 @@ public class GemFireCacheImpl
     } catch (IOException ex) {
       throw new CacheXmlException(
           LocalizedStrings.GemFireCache_WHILE_OPENING_CACHE_XML_0_THE_FOLLOWING_ERROR_OCCURRED_1
-              .toLocalizedString(new Object[] {url.toString(), ex}));
+              .toLocalizedString(new Object[]{url.toString(), ex}));
 
     } catch (CacheXmlException ex) {
       CacheXmlException newEx =
           new CacheXmlException(LocalizedStrings.GemFireCache_WHILE_READING_CACHE_XML_0_1
-              .toLocalizedString(new Object[] {url, ex.getMessage()}));
+              .toLocalizedString(new Object[]{url, ex.getMessage()}));
       newEx.setStackTrace(ex.getStackTrace());
       newEx.initCause(ex.getCause());
       throw newEx;
@@ -1482,11 +1494,11 @@ public class GemFireCacheImpl
       }
       logger.info(
           LocalizedMessage.create(LocalizedStrings.GemFireCache_INITIALIZING_CACHE_USING__0__1,
-              new Object[] {url.toString(), sb.toString()}));
+              new Object[]{url.toString(), sb.toString()}));
     } else {
       logger.info(
           LocalizedMessage.create(LocalizedStrings.GemFireCache_INITIALIZING_CACHE_USING__0__1,
-              new Object[] {"generated description from old cache", cacheXmlDescription}));
+              new Object[]{"generated description from old cache", cacheXmlDescription}));
     }
   }
 
@@ -1518,7 +1530,6 @@ public class GemFireCacheImpl
 
   /**
    * create diskstore factory with default attributes
-   *
    * @since GemFire prPersistSprint2
    */
   public DiskStoreFactory createDiskStoreFactory() {
@@ -1527,7 +1538,6 @@ public class GemFireCacheImpl
 
   /**
    * create diskstore factory with predefined attributes
-   *
    * @since GemFire prPersistSprint2
    */
   public DiskStoreFactory createDiskStoreFactory(DiskStoreAttributes attrs) {
@@ -1605,12 +1615,16 @@ public class GemFireCacheImpl
     return stopper;
   }
 
-  /** return true if the cache was closed due to being shunned by other members */
+  /**
+   * return true if the cache was closed due to being shunned by other members
+   */
   public boolean forcedDisconnect() {
     return this.forcedDisconnect || this.system.forcedDisconnect();
   }
 
-  /** return a CacheClosedException with the given reason */
+  /**
+   * return a CacheClosedException with the given reason
+   */
   public CacheClosedException getCacheClosedException(String reason, Throwable cause) {
     CacheClosedException result;
     if (cause != null) {
@@ -1623,21 +1637,21 @@ public class GemFireCacheImpl
     return result;
   }
 
-  /** if the cache was forcibly closed this exception will reflect the cause */
+  /**
+   * if the cache was forcibly closed this exception will reflect the cause
+   */
   public Throwable getDisconnectCause() {
     return this.disconnectCause;
   }
 
   /**
    * Set to true during a cache close if user requested durable subscriptions to be kept.
-   *
    * @since GemFire 5.7
    */
   private boolean keepAlive;
 
   /**
    * Returns true if durable subscriptions (registrations and queries) should be preserved.
-   *
    * @since GemFire 5.7
    */
   public boolean keepDurableSubscriptionsAlive() {
@@ -1651,12 +1665,12 @@ public class GemFireCacheImpl
 
   /**
    * Ensure that all the necessary classes for closing the cache are loaded
-   *
    * @see SystemFailure#loadEmergencyClasses()
    */
   static public void loadEmergencyClasses() {
-    if (emergencyClassesLoaded)
+    if (emergencyClassesLoaded) {
       return;
+    }
     emergencyClassesLoaded = true;
     InternalDistributedSystem.loadEmergencyClasses();
     AcceptorImpl.loadEmergencyClasses();
@@ -1666,7 +1680,6 @@ public class GemFireCacheImpl
   /**
    * Close the distributed system, cache servers, and gateways. Clears the rootRegions and
    * partitionedRegions map. Marks the cache as closed.
-   *
    * @see SystemFailure#emergencyClose()
    */
   static public void emergencyClose() {
@@ -1762,7 +1775,7 @@ public class GemFireCacheImpl
       }
     }
     if (!this.isShutDownAll.compareAndSet(false, true)) {
-      // it's already doing shutdown by another thread
+      // it's already doing stop by another thread
       try {
         this.shutDownAllFinished.await();
       } catch (InterruptedException e) {
@@ -1803,8 +1816,7 @@ public class GemFireCacheImpl
           try {
             es.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
           } catch (InterruptedException e) {
-            logger
-                .debug("Shutdown all interrupted while waiting for PRs to be shutdown gracefully.");
+            logger.debug("Shutdown all interrupted while waiting for PRs to be stop gracefully.");
           }
 
         } else {
@@ -1999,7 +2011,6 @@ public class GemFireCacheImpl
   /**
    * Gets or lazily creates the PartitionedRegion distributed lock service. This call will
    * synchronize on this GemFireCache.
-   *
    * @return the PartitionedRegion distributed lock service
    */
   protected DistributedLockService getPartitionedRegionLockService() {
@@ -2025,7 +2036,6 @@ public class GemFireCacheImpl
 
   /**
    * Gets or lazily creates the GatewaySender distributed lock service.
-   * 
    * @return the GatewaySender distributed lock service
    */
   public DistributedLockService getGatewaySenderLockService() {
@@ -2115,7 +2125,6 @@ public class GemFireCacheImpl
 
   /**
    * close the cache
-   *
    * @param reason the reason the cache is being closed
    * @param systemFailureCause whether this member was ejected from the distributed system
    * @param keepalive whoever added this should javadoc it
@@ -2125,7 +2134,7 @@ public class GemFireCacheImpl
   }
 
   public void close(String reason, Throwable systemFailureCause, boolean keepalive,
-      boolean keepDS) {
+                    boolean keepDS) {
     securityService.close();
 
     if (isClosed()) {
@@ -2267,7 +2276,7 @@ public class GemFireCacheImpl
 
             LocalRegion prRoot = null;
 
-            for (Iterator itr = rootRegionValues.iterator(); itr.hasNext();) {
+            for (Iterator itr = rootRegionValues.iterator(); itr.hasNext(); ) {
               LocalRegion lr = (LocalRegion) itr.next();
               if (isDebugEnabled) {
                 logger.debug("{}: processing region {}", this, lr.getFullPath());
@@ -2287,7 +2296,7 @@ public class GemFireCacheImpl
                   if (isDebugEnabled || !forcedDisconnect) {
                     logger.warn(LocalizedMessage.create(
                         LocalizedStrings.GemFireCache_0_ERROR_CLOSING_REGION_1,
-                        new Object[] {this, lr.getFullPath()}), e);
+                        new Object[]{this, lr.getFullPath()}), e);
                   }
                 }
               }
@@ -2467,7 +2476,7 @@ public class GemFireCacheImpl
       // do this late to prevent 43412
       TypeRegistry.setPdxSerializer(null);
 
-      for (Iterator iter = cacheLifecycleListeners.iterator(); iter.hasNext();) {
+      for (Iterator iter = cacheLifecycleListeners.iterator(); iter.hasNext(); ) {
         CacheLifecycleListener listener = (CacheLifecycleListener) iter.next();
         listener.cacheClosed(this);
       }
@@ -2519,21 +2528,20 @@ public class GemFireCacheImpl
     if (this.memcachedServer != null) {
       logger.info(LocalizedMessage.create(
           LocalizedStrings.GemFireCacheImpl_MEMCACHED_SERVER_ON_PORT_0_IS_SHUTTING_DOWN,
-          new Object[] {this.system.getConfig().getMemcachedPort()}));
+          new Object[]{this.system.getConfig().getMemcachedPort()}));
       this.memcachedServer.shutdown();
     }
   }
 
   private void stopRedisServer() {
-    if (redisServer != null)
-      this.redisServer.shutdown();
+    getService(GeodeRedisService.class).stop();
   }
 
   private void stopRestAgentServer() {
     if (this.restAgent != null) {
       logger.info(LocalizedMessage.create(
           LocalizedStrings.GemFireCacheImpl_REST_SERVER_ON_PORT_0_IS_SHUTTING_DOWN,
-          new Object[] {this.system.getConfig().getHttpServicePort()}));
+          new Object[]{this.system.getConfig().getHttpServicePort()}));
       this.restAgent.stop();
     }
   }
@@ -2554,7 +2562,7 @@ public class GemFireCacheImpl
   }
 
   /**
-   * Used to guard access to compactorPool and set to true when cache is shutdown.
+   * Used to guard access to compactorPool and set to true when cache is stop.
    */
   private final AtomicBoolean diskStoreTaskSync = new AtomicBoolean(false);
   /**
@@ -2594,8 +2602,9 @@ public class GemFireCacheImpl
     this.diskStores.remove(dsi.getName());
     this.regionOwnedDiskStores.remove(dsi.getName());
     /** Added for M&M **/
-    if (!dsi.getOwnedByRegion())
+    if (!dsi.getOwnedByRegion()) {
       system.handleResourceEvent(ResourceEvent.DISKSTORE_REMOVE, dsi);
+    }
   }
 
   public void addRegionOwnedDiskStore(DiskStoreImpl dsi) {
@@ -2659,7 +2668,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns the DiskStore by name
-   *
    * @since GemFire prPersistSprint2
    */
   public DiskStore findDiskStore(String name) {
@@ -2671,7 +2679,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns the DiskStore list
-   *
    * @since GemFire prPersistSprint2
    */
   public Collection<DiskStoreImpl> listDiskStores() {
@@ -2700,7 +2707,7 @@ public class GemFireCacheImpl
           return true;
         } catch (RejectedExecutionException ex) {
           if (logger.isDebugEnabled()) {
-            logger.debug("Ignored compact schedule during shutdown", ex);
+            logger.debug("Ignored compact schedule during stop", ex);
           }
         }
       }
@@ -2870,7 +2877,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns the member id of my distributed system
-   *
    * @since GemFire 5.0
    */
   public InternalDistributedMember getMyId() {
@@ -2963,7 +2969,6 @@ public class GemFireCacheImpl
 
   /**
    * get the threadid/sequenceid sweeper task for this cache
-   *
    * @return the sweeper task
    */
   protected EventTracker.ExpiryTask getEventTrackerTask() {
@@ -2980,7 +2985,6 @@ public class GemFireCacheImpl
 
   /**
    * Get the list of all instances of properties for Declarables with the given class name.
-   * 
    * @param className Class name of the declarable
    * @return List of all instances of properties found for the given declarable
    */
@@ -2998,7 +3002,6 @@ public class GemFireCacheImpl
 
   /**
    * Get the properties for the given declarable.
-   * 
    * @param declarable The declarable
    * @return Properties found for the given declarable
    */
@@ -3008,7 +3011,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns the date and time that this cache was created.
-   *
    * @since GemFire 3.5
    */
   public Date getCreationDate() {
@@ -3017,7 +3019,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns the number of seconds that have elapsed since the Cache was created.
-   *
    * @since GemFire 3.5
    */
   public int getUpTime() {
@@ -3028,7 +3029,6 @@ public class GemFireCacheImpl
    * All entry and region operations should be using this time rather than
    * System.currentTimeMillis(). Specially all version stamps/tags must be populated with this
    * timestamp.
-   * 
    * @return distributed cache time.
    */
   @Override
@@ -3127,7 +3127,6 @@ public class GemFireCacheImpl
 
   /**
    * Used to see if a existing cache's pool is compatible with us.
-   *
    * @return the default pool that is right for us
    */
   public Pool determineDefaultPool(PoolFactory pf) {
@@ -3211,7 +3210,7 @@ public class GemFireCacheImpl
   }
 
   public <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> p_attrs,
-      InternalRegionArguments internalRegionArgs)
+                                            InternalRegionArguments internalRegionArgs)
       throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException {
     if (getMyId().getVmKind() == DistributionManager.LOCATOR_DM_TYPE) {
       if (!internalRegionArgs.isUsedForMetaRegion()
@@ -3240,7 +3239,7 @@ public class GemFireCacheImpl
     final String regionPath = LocalRegion.calcFullPath(name, null);
 
     try {
-      for (;;) {
+      for (; ; ) {
         getCancelCriterion().checkCancelInProgress(null);
 
         Future future = null;
@@ -3297,8 +3296,9 @@ public class GemFireCacheImpl
         } catch (CancellationException e) {
           // future was cancelled
         } finally {
-          if (interrupted)
+          if (interrupted) {
             Thread.currentThread().interrupt();
+          }
         }
       } // for
 
@@ -3349,8 +3349,6 @@ public class GemFireCacheImpl
         } // success
       }
 
-
-
       rgn.postCreateRegion();
     } catch (RegionExistsException ex) {
       // outside of sync make sure region is initialized to fix bug 37563
@@ -3371,7 +3369,8 @@ public class GemFireCacheImpl
   }
 
   public RegionAttributes invokeRegionBefore(LocalRegion parent, String name,
-      RegionAttributes attrs, InternalRegionArguments internalRegionArgs) {
+                                             RegionAttributes attrs,
+                                             InternalRegionArguments internalRegionArgs) {
     for (RegionListener listener : regionListeners) {
       attrs = listener.beforeCreate(parent, name, attrs, internalRegionArgs);
     }
@@ -3390,7 +3389,6 @@ public class GemFireCacheImpl
 
   /**
    * returns a set of all current regions in the cache, including buckets
-   *
    * @since GemFire 6.0
    */
   public Set<LocalRegion> getAllRegions() {
@@ -3483,8 +3481,9 @@ public class GemFireCacheImpl
         LocalRegion root;
         synchronized (this.rootRegions) {
           root = (LocalRegion) this.rootRegions.get(pathParts[0]);
-          if (root == null)
+          if (root == null) {
             return null;
+          }
         }
         if (logger.isDebugEnabled()) {
           logger.debug("GemFireCache.getRegion, calling getSubregion on root({}): {}", pathParts[0],
@@ -3587,7 +3586,9 @@ public class GemFireCacheImpl
     }
   }
 
-  /** Return true if this region is initializing */
+  /**
+   * Return true if this region is initializing
+   */
   boolean isGlobalRegionInitializing(String fullPath) {
     stopper.checkCancelInProgress(null);
     int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT); // go through
@@ -3600,7 +3601,9 @@ public class GemFireCacheImpl
     }
   }
 
-  /** Return true if this region is initializing */
+  /**
+   * Return true if this region is initializing
+   */
   boolean isGlobalRegionInitializing(LocalRegion region) {
     boolean result = region != null && region.scope.isGlobal() && !region.isInitialized();
     if (result) {
@@ -3623,19 +3626,19 @@ public class GemFireCacheImpl
     stopper.checkCancelInProgress(null);
     Set regions = new HashSet();
     synchronized (this.rootRegions) {
-      for (Iterator itr = this.rootRegions.values().iterator(); itr.hasNext();) {
+      for (Iterator itr = this.rootRegions.values().iterator(); itr.hasNext(); ) {
         LocalRegion r = (LocalRegion) itr.next();
         // If this is an internal meta-region, don't return it to end user
         if (r.isSecret() || r.isUsedForMetaRegion() || r instanceof HARegion
             || !includePRAdminRegions
-                && (r.isUsedForPartitionedRegionAdmin() || r.isUsedForPartitionedRegionBucket())) {
+            && (r.isUsedForPartitionedRegionAdmin() || r.isUsedForPartitionedRegionBucket())) {
           continue; // Skip administrative PartitionedRegions
         }
         regions.add(r);
       }
     }
     if (waitForInit) {
-      for (Iterator r = regions.iterator(); r.hasNext();) {
+      for (Iterator r = regions.iterator(); r.hasNext(); ) {
         LocalRegion lr = (LocalRegion) r.next();
         // lr.waitOnInitialization();
         if (!lr.checkForInitialization()) {
@@ -3648,13 +3651,13 @@ public class GemFireCacheImpl
 
   /**
    * Called by ccn when a client goes away
-   *
    * @since GemFire 5.7
    */
   public void cleanupForClient(CacheClientNotifier ccn, ClientProxyMembershipID client) {
     try {
-      if (isClosed())
+      if (isClosed()) {
         return;
+      }
       Iterator it = rootRegions(false, false).iterator();
       while (it.hasNext()) {
         LocalRegion lr = (LocalRegion) it.next();
@@ -3757,7 +3760,6 @@ public class GemFireCacheImpl
   /**
    * Register the specified region name as reinitializing, creating and adding a Future for it to
    * the map.
-   *
    * @throws IllegalStateException if there is already a region by that name registered.
    */
   void regionReinitializing(String fullPath) {
@@ -3771,7 +3773,6 @@ public class GemFireCacheImpl
 
   /**
    * Set the reinitialized region and unregister it as reinitializing.
-   *
    * @throws IllegalStateException if there is no region by that name registered as reinitializing.
    */
   void regionReinitialized(Region region) {
@@ -3788,11 +3789,11 @@ public class GemFireCacheImpl
 
   /**
    * Clear a reinitializing region, e.g. reinitialization failed.
-   *
    * @throws IllegalStateException if cannot find reinitializing region registered by that name.
    */
   void unregisterReinitializingRegion(String fullPath) {
-    /* Object previous = */this.reinitializingRegions.remove(fullPath);
+    /* Object previous = */
+    this.reinitializingRegions.remove(fullPath);
     // if (previous == null) {
     // throw new IllegalStateException("Could not find a reinitializing region
     // named " +
@@ -3804,7 +3805,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns true if get should give a copy; false if a reference.
-   *
    * @since GemFire 4.0
    */
   final boolean isCopyOnRead() {
@@ -3813,7 +3813,6 @@ public class GemFireCacheImpl
 
   /**
    * Implementation of {@link org.apache.geode.cache.Cache#setCopyOnRead}
-   *
    * @since GemFire 4.0
    */
   public void setCopyOnRead(boolean copyOnRead) {
@@ -3822,7 +3821,6 @@ public class GemFireCacheImpl
 
   /**
    * Implementation of {@link org.apache.geode.cache.Cache#getCopyOnRead}
-   *
    * @since GemFire 4.0
    */
   final public boolean getCopyOnRead() {
@@ -3831,7 +3829,6 @@ public class GemFireCacheImpl
 
   /**
    * Remove the specified root region
-   *
    * @param rootRgn the region to be removed
    * @return true if root region was removed, false if not found
    */
@@ -3843,14 +3840,15 @@ public class GemFireCacheImpl
         LocalRegion previous = (LocalRegion) this.rootRegions.remove(rgnName);
         Assert.assertTrue(previous == rootRgn);
         return true;
-      } else
+      } else {
         return false;
+      }
     }
   }
 
   /**
    * @return array of two Strings, the root name and the relative path from root If there is no
-   *         relative path from root, then String[1] will be an empty string
+   * relative path from root, then String[1] will be an empty string
    */
   static String[] parsePath(String p_path) {
     String path = p_path;
@@ -3882,7 +3880,6 @@ public class GemFireCacheImpl
 
   /**
    * Removes a <code>CacheLifecycleListener</code>
-   *
    * @return Whether or not the listener was removed
    */
   public static boolean removeCacheLifecycleListener(CacheLifecycleListener l) {
@@ -3907,9 +3904,7 @@ public class GemFireCacheImpl
   /**
    * Creates the single instance of the Transation Manager for this cache. Returns the existing one
    * upon request.
-   *
    * @return the CacheTransactionManager instance.
-   *
    * @since GemFire 4.0
    */
   public CacheTransactionManager getCacheTransactionManager() {
@@ -3917,8 +3912,8 @@ public class GemFireCacheImpl
   }
 
   /**
-   * @see CacheClientProxy
    * @guarded.By {@link #ccpTimerMutex}
+   * @see CacheClientProxy
    */
   private SystemTimer ccpTimer;
 
@@ -3929,7 +3924,6 @@ public class GemFireCacheImpl
 
   /**
    * Get cache-wide CacheClientProxy SystemTimer
-   *
    * @return the timer, lazily created
    */
   public SystemTimer getCCPTimer() {
@@ -3952,7 +3946,6 @@ public class GemFireCacheImpl
 
   /**
    * Get cache-wide ExpirationScheduler
-   *
    * @return the scheduler, lazily created
    */
   public ExpirationScheduler getExpirationScheduler() {
@@ -3966,7 +3959,6 @@ public class GemFireCacheImpl
   /**
    * Returns the <code>Executor</code> (thread pool) that is used to execute cache event listeners.
    * Returns <code>null</code> if no pool exists.
-   *
    * @since GemFire 3.5
    */
   Executor getEventThreadPool() {
@@ -4083,7 +4075,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns List of GatewaySender (excluding the senders for internal use)
-   * 
    * @return List List of GatewaySender objects
    */
   public Set<GatewaySender> getGatewaySenders() {
@@ -4098,7 +4089,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns List of all GatewaySenders (including the senders for internal use)
-   * 
    * @return List List of GatewaySender objects
    */
   public Set<GatewaySender> getAllGatewaySenders() {
@@ -4190,7 +4180,7 @@ public class GemFireCacheImpl
    */
   public void requiresPREvents() {
     synchronized (this.partitionedRegions) {
-      for (Iterator it = this.partitionedRegions.iterator(); it.hasNext();) {
+      for (Iterator it = this.partitionedRegions.iterator(); it.hasNext(); ) {
         ((PartitionedRegion) it.next()).cacheRequiresNotification();
       }
     }
@@ -4291,7 +4281,7 @@ public class GemFireCacheImpl
   }
 
   private void addColocatedChildRecursively(LinkedHashMap<String, PartitionedRegion> prMap,
-      PartitionedRegion pr) {
+                                            PartitionedRegion pr) {
     for (PartitionedRegion colocatedRegion : ColocationHelper.getColocatedChildRegions(pr)) {
       addColocatedChildRecursively(prMap, colocatedRegion);
     }
@@ -4302,7 +4292,6 @@ public class GemFireCacheImpl
    * check to see if any cache components require notification from a partitioned region.
    * Notification adds to the messaging a PR must do on each put/destroy/invalidate operation and
    * should be kept to a minimum
-   *
    * @param r the partitioned region
    * @return true if the region should deliver all of its events to this cache
    */
@@ -4338,7 +4327,6 @@ public class GemFireCacheImpl
 
   /**
    * remove a partitioned region from the set of tracked instances.
-   *
    * @see #addPartitionedRegion(PartitionedRegion)
    */
   public void removePartitionedRegion(PartitionedRegion r) {
@@ -4506,7 +4494,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns this cache's ReliableMessageQueueFactory.
-   *
    * @since GemFire 5.0
    */
   public ReliableMessageQueueFactory getReliableMessageQueueFactory() {
@@ -4558,7 +4545,7 @@ public class GemFireCacheImpl
   private final ArrayList<SimpleWaiter> riWaiters = new ArrayList<SimpleWaiter>();
 
   private TypeRegistry pdxRegistry; // never changes but is currently only
-                                    // initialized in constructor by unit tests
+  // initialized in constructor by unit tests
 
   /**
    * update stats for completion of a registerInterest operation
@@ -4635,13 +4622,11 @@ public class GemFireCacheImpl
 
   /**
    * Wait for given sender queue to flush for given timeout.
-   * 
    * @param id ID of GatewaySender or AsyncEventQueue
    * @param isAsyncListener true if this is for an AsyncEventQueue and false if for a GatewaySender
    * @param maxWaitTime maximum time to wait in seconds; zero or -ve means infinite wait
-   * 
    * @return zero if maxWaitTime was not breached, -1 if queue could not be found or is closed, and
-   *         elapsed time if timeout was breached
+   * elapsed time if timeout was breached
    */
   public int waitForSenderQueueFlush(String id, boolean isAsyncListener, int maxWaitTime) {
     getCancelCriterion().checkCancelInProgress(null);
@@ -4696,7 +4681,6 @@ public class GemFireCacheImpl
 
   /**
    * Returns the QueryMonitor instance based on system property MAX_QUERY_EXECUTION_TIME.
-   * 
    * @since GemFire 6.0
    */
   public QueryMonitor getQueryMonitor() {
@@ -4729,7 +4713,6 @@ public class GemFireCacheImpl
             maxTime = FIVE_HOURS;
           }
 
-
           this.queryMonitor = new QueryMonitor(maxTime);
           final LoggingThreadGroup group =
               LoggingThreadGroup.createThreadGroup("QueryMonitor Thread Group", logger);
@@ -4748,13 +4731,13 @@ public class GemFireCacheImpl
   /**
    * Simple class to allow waiters for register interest. Has at most one thread that ever calls
    * wait.
-   *
    * @since GemFire 5.7
    */
   private class SimpleWaiter {
     private boolean notified = false;
 
-    SimpleWaiter() {}
+    SimpleWaiter() {
+    }
 
     public void doWait() {
       synchronized (this) {
@@ -5230,7 +5213,6 @@ public class GemFireCacheImpl
   /**
    * Returns true if any of the GemFire services prefers PdxInstance. And application has not
    * requested getObject() on the PdxInstance.
-   *
    */
   public boolean getPdxReadSerializedByAnyGemFireServices() {
     if ((getPdxReadSerialized() || DefaultQuery.getPdxReadSerialized())
@@ -5327,7 +5309,6 @@ public class GemFireCacheImpl
   /**
    * Add to the map of declarable properties. Any properties that exactly match existing properties
    * for a class in the list will be discarded (no duplicate Properties allowed).
-   * 
    * @param mapOfNewDeclarableProps Map of the declarable properties to add
    */
   public void addDeclarableProperties(final Map<Declarable, Properties> mapOfNewDeclarableProps) {
@@ -5341,7 +5322,7 @@ public class GemFireCacheImpl
           if (clazz.getName().equals(oldEntry.getKey().getClass().getName()) && (newEntry.getValue()
               .equals(oldEntry.getValue())
               || ((newEntry.getKey() instanceof Identifiable) && (((Identifiable) oldEntry.getKey())
-                  .getId().equals(((Identifiable) newEntry.getKey()).getId()))))) {
+              .getId().equals(((Identifiable) newEntry.getKey()).getId()))))) {
             matchingDeclarable = oldEntry.getKey();
             break;
           }

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/Bits.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/Bits.java b/geode-core/src/main/java/org/apache/geode/internal/hll/Bits.java
deleted file mode 100755
index 595fb57..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/Bits.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.IOException;
-
-public class Bits {
-
-  public static int[] getBits(byte[] mBytes) throws IOException {
-    int bitSize = mBytes.length / 4;
-    int[] bits = new int[bitSize];
-    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(mBytes));
-    for (int i = 0; i < bitSize; i++) {
-      bits[i] = dis.readInt();
-    }
-    return bits;
-  }
-
-  /**
-   * This method might be better described as "byte array to int array" or "data input to int array"
-   */
-  public static int[] getBits(DataInput dataIn, int byteLength) throws IOException {
-    int bitSize = byteLength / 4;
-    int[] bits = new int[bitSize];
-    for (int i = 0; i < bitSize; i++) {
-      bits[i] = dataIn.readInt();
-    }
-    return bits;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/CardinalityMergeException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/CardinalityMergeException.java b/geode-core/src/main/java/org/apache/geode/internal/hll/CardinalityMergeException.java
deleted file mode 100755
index 59ab095..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/CardinalityMergeException.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2011 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-
-
-@SuppressWarnings("serial")
-public abstract class CardinalityMergeException extends Exception {
-
-  public CardinalityMergeException(String message) {
-    super(message);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLog.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLog.java b/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLog.java
deleted file mode 100755
index 4bdf81c..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/hll/HyperLogLog.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (C) 2012 Clearspring Technologies, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.hll;
-
-import org.apache.geode.redis.internal.executor.hll.HllExecutor;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Serializable;
-
-/**
- * Java implementation of HyperLogLog (HLL) algorithm from this paper:
- * <p/>
- * http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf
- * <p/>
- * HLL is an improved version of LogLog that is capable of estimating the cardinality of a set with
- * accuracy = 1.04/sqrt(m) where m = 2^b. So we can control accuracy vs space usage by increasing or
- * decreasing b.
- * <p/>
- * The main benefit of using HLL over LL is that it only requires 64% of the space that LL does to
- * get the same accuracy.
- * <p/>
- * This implementation implements a single counter. If a large (millions) number of counters are
- * required you may want to refer to:
- * <p/>
- * http://dsiutils.dsi.unimi.it/
- * <p/>
- * It has a more complex implementation of HLL that supports multiple counters in a single object,
- * drastically reducing the java overhead from creating a large number of objects.
- * <p/>
- * This implementation leveraged a javascript implementation that Yammer has been working on:
- * <p/>
- * https://github.com/yammer/probablyjs
- * <p>
- * Note that this implementation does not include the long range correction function defined in the
- * original paper. Empirical evidence shows that the correction function causes more harm than good.
- * </p>
- * <p/>
- * <p>
- * Users have different motivations to use different types of hashing functions. Rather than try to
- * keep up with all available hash functions and to remove the concern of causing future binary
- * incompatibilities this class allows clients to offer the value in hashed int or long form. This
- * way clients are free to change their hash function on their own time line. We recommend using
- * Google's Guava Murmur3_128 implementation as it provides good performance and speed when high
- * precision is required. In our tests the 32bit MurmurHash function included in this project is
- * faster and produces better results than the 32 bit murmur3 implementation google provides.
- * </p>
- */
-public class HyperLogLog implements ICardinality, Serializable {
-
-  private static final long serialVersionUID = -4661220245111112301L;
-  private final RegisterSet registerSet;
-  private final int log2m;
-  private final double alphaMM;
-
-
-  /**
-   * Create a new HyperLogLog instance using the specified standard deviation.
-   *
-   * @param rsd - the relative standard deviation for the counter. smaller values create counters
-   *        that require more space.
-   */
-  public HyperLogLog(double rsd) {
-    this(log2m(rsd));
-  }
-
-  private static int log2m(double rsd) {
-    return (int) (Math.log((1.106 / rsd) * (1.106 / rsd)) / Math.log(2));
-  }
-
-  /**
-   * Create a new HyperLogLog instance. The log2m parameter defines the accuracy of the counter. The
-   * larger the log2m the better the accuracy.
-   * <p/>
-   * accuracy = 1.04/sqrt(2^log2m)
-   *
-   * @param log2m - the number of bits to use as the basis for the HLL instance
-   */
-  public HyperLogLog(int log2m) {
-    this(log2m, new RegisterSet(1 << log2m));
-  }
-
-  /**
-   * Creates a new HyperLogLog instance using the given registers. Used for unmarshalling a
-   * serialized instance and for merging multiple counters together.
-   *
-   * @param registerSet - the initial values for the register set
-   */
-  @Deprecated
-  public HyperLogLog(int log2m, RegisterSet registerSet) {
-    if (log2m < 0 || log2m > 30) {
-      throw new IllegalArgumentException(
-          "log2m argument is " + log2m + " and is outside the range [0, 30]");
-    }
-    this.registerSet = registerSet;
-    this.log2m = log2m;
-    int m = 1 << this.log2m;
-
-    alphaMM = getAlphaMM(log2m, m);
-  }
-
-  @Override
-  public boolean offerHashed(long hashedValue) {
-    // j becomes the binary address determined by the first b log2m of x
-    // j will be between 0 and 2^log2m
-    final int j = (int) (hashedValue >>> (Long.SIZE - log2m));
-    final int r =
-        Long.numberOfLeadingZeros((hashedValue << this.log2m) | (1 << (this.log2m - 1)) + 1) + 1;
-    return registerSet.updateIfGreater(j, r);
-  }
-
-  @Override
-  public boolean offerHashed(int hashedValue) {
-    // j becomes the binary address determined by the first b log2m of x
-    // j will be between 0 and 2^log2m
-    final int j = hashedValue >>> (Integer.SIZE - log2m);
-    final int r =
-        Integer.numberOfLeadingZeros((hashedValue << this.log2m) | (1 << (this.log2m - 1)) + 1) + 1;
-    return registerSet.updateIfGreater(j, r);
-  }
-
-  @Override
-  public boolean offer(Object o) {
-    final int x = MurmurHash.hash(o);
-    return offerHashed(x);
-  }
-
-
-  @Override
-  public long cardinality() {
-    double registerSum = 0;
-    int count = registerSet.count;
-    double zeros = 0.0;
-    for (int j = 0; j < registerSet.count; j++) {
-      int val = registerSet.get(j);
-      registerSum += 1.0 / (1 << val);
-      if (val == 0) {
-        zeros++;
-      }
-    }
-
-    double estimate = alphaMM * (1 / registerSum);
-
-    if (estimate <= (5.0 / 2.0) * count) {
-      // Small Range Estimate
-      return Math.round(linearCounting(count, zeros));
-    } else {
-      return Math.round(estimate);
-    }
-  }
-
-  @Override
-  public int sizeof() {
-    return registerSet.size * 4;
-  }
-
-  @Override
-  public byte[] getBytes() throws IOException {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    DataOutput dos = new DataOutputStream(baos);
-    writeBytes(dos);
-
-    return baos.toByteArray();
-  }
-
-  private void writeBytes(DataOutput serializedByteStream) throws IOException {
-    serializedByteStream.writeInt(log2m);
-    serializedByteStream.writeInt(registerSet.size * 4);
-    for (int x : registerSet.readOnlyBits()) {
-      serializedByteStream.writeInt(x);
-    }
-  }
-
-  /**
-   * Add all the elements of the other set to this set.
-   * <p/>
-   * This operation does not imply a loss of precision.
-   *
-   * @param other A compatible Hyperloglog instance (same log2m)
-   * @throws CardinalityMergeException if other is not compatible
-   */
-  public void addAll(HyperLogLog other) throws CardinalityMergeException {
-    if (this.sizeof() != other.sizeof()) {
-      throw new HyperLogLogMergeException("Cannot merge estimators of different sizes");
-    }
-
-    registerSet.merge(other.registerSet);
-  }
-
-  @Override
-  public ICardinality merge(ICardinality... estimators) throws CardinalityMergeException {
-    HyperLogLog merged = new HyperLogLog(HllExecutor.DEFAULT_HLL_STD_DEV);// new HyperLogLog(log2m,
-                                                                          // new
-                                                                          // RegisterSet(this.registerSet.count));
-    merged.addAll(this);
-
-    if (estimators == null) {
-      return merged;
-    }
-
-    for (ICardinality estimator : estimators) {
-      if (!(estimator instanceof HyperLogLog)) {
-        throw new HyperLogLogMergeException("Cannot merge estimators of different class");
-      }
-      HyperLogLog hll = (HyperLogLog) estimator;
-      merged.addAll(hll);
-    }
-
-    return merged;
-  }
-
-  private Object writeReplace() {
-    return new SerializationHolder(this);
-  }
-
-  /**
-   * This class exists to support Externalizable semantics for HyperLogLog objects without having to
-   * expose a public constructor, public write/read methods, or pretend final fields aren't final.
-   *
-   * In short, Externalizable allows you to skip some of the more verbose meta-data default
-   * Serializable gets you, but still includes the class name. In that sense, there is some cost to
-   * this holder object because it has a longer class name. I imagine people who care about
-   * optimizing for that have their own work-around for long class names in general, or just use a
-   * custom serialization framework. Therefore we make no attempt to optimize that here (eg. by
-   * raising this from an inner class and giving it an unhelpful name).
-   */
-  private static class SerializationHolder implements Externalizable {
-
-    HyperLogLog hyperLogLogHolder;
-
-    public SerializationHolder(HyperLogLog hyperLogLogHolder) {
-      this.hyperLogLogHolder = hyperLogLogHolder;
-    }
-
-    /**
-     * required for Externalizable
-     */
-    @SuppressWarnings("unused")
-    public SerializationHolder() {
-
-    }
-
-    @Override
-    public void writeExternal(ObjectOutput out) throws IOException {
-      hyperLogLogHolder.writeBytes(out);
-    }
-
-    @Override
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-      hyperLogLogHolder = Builder.build(in);
-    }
-
-    private Object readResolve() {
-      return hyperLogLogHolder;
-    }
-  }
-
-  public static class Builder implements IBuilder<ICardinality>, Serializable {
-
-    private static final long serialVersionUID = -979314356097156719L;
-    private double rsd;
-
-    public Builder(double rsd) {
-      this.rsd = rsd;
-    }
-
-    @Override
-    public HyperLogLog build() {
-      return new HyperLogLog(rsd);
-    }
-
-    @Override
-    public int sizeof() {
-      int log2m = log2m(rsd);
-      int k = 1 << log2m;
-      return RegisterSet.getBits(k) * 4;
-    }
-
-    public static HyperLogLog build(byte[] bytes) throws IOException {
-      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-      return build(new DataInputStream(bais));
-    }
-
-    public static HyperLogLog build(DataInput serializedByteStream) throws IOException {
-      int log2m = serializedByteStream.readInt();
-      int byteArraySize = serializedByteStream.readInt();
-      return new HyperLogLog(log2m,
-          new RegisterSet(1 << log2m, Bits.getBits(serializedByteStream, byteArraySize)));
-    }
-  }
-
-  @SuppressWarnings("serial")
-  protected static class HyperLogLogMergeException extends CardinalityMergeException {
-
-    public HyperLogLogMergeException(String message) {
-      super(message);
-    }
-  }
-
-  protected static double getAlphaMM(final int p, final int m) {
-    // See the paper.
-    switch (p) {
-      case 4:
-        return 0.673 * m * m;
-      case 5:
-        return 0.697 * m * m;
-      case 6:
-        return 0.709 * m * m;
-      default:
-        return (0.7213 / (1 + 1.079 / m)) * m * m;
-    }
-  }
-
-  protected static double linearCounting(int m, double V) {
-    return m * Math.log(m / V);
-  }
-}


[14/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
deleted file mode 100755
index 493cc12..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class SMoveExecutor extends SetExecutor {
-
-  private final int MOVED = 1;
-
-  private final int NOT_MOVED = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SMOVE));
-      return;
-    }
-
-    ByteArrayWrapper source = command.getKey();
-    ByteArrayWrapper destination = new ByteArrayWrapper(commandElems.get(2));
-    ByteArrayWrapper mem = new ByteArrayWrapper(commandElems.get(3));
-
-    checkDataType(source, RedisDataType.REDIS_SET, context);
-    checkDataType(destination, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> sourceRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(source);
-
-    if (sourceRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_MOVED));
-      return;
-    }
-
-    Object oldVal = sourceRegion.get(mem);
-    sourceRegion.remove(mem);
-
-    if (oldVal == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_MOVED));
-      return;
-    }
-
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> destinationRegion =
-        (Region<ByteArrayWrapper, Boolean>) getOrCreateRegion(context, destination,
-            RedisDataType.REDIS_SET);
-    destinationRegion.put(mem, true);
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), MOVED));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
deleted file mode 100755
index e383538..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-import java.util.Random;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SPopExecutor extends SetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SPOP));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-    if (keyRegion == null || keyRegion.isEmpty()) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Random rand = new Random();
-
-    ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[keyRegion.size()]);
-
-    ByteArrayWrapper pop = entries[rand.nextInt(entries.length)];
-
-    keyRegion.remove(pop);
-    if (keyRegion.isEmpty()) {
-      context.getRegionProvider().removeKey(key);
-    }
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), pop.toBytes()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
deleted file mode 100755
index 4594022..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SRandMemberExecutor extends SetExecutor {
-
-  private final static String ERROR_NOT_NUMERIC = "The count provided must be numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SRANDMEMBER));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    int count = 1;
-
-    if (commandElems.size() > 2) {
-      try {
-        count = Coder.bytesToInt(commandElems.get(2));
-      } catch (NumberFormatException e) {
-        command
-            .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-        return;
-      }
-    }
-
-    if (keyRegion == null || count == 0) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int members = keyRegion.size();
-
-    if (members <= count && count != 1) {
-      command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(),
-          new HashSet<ByteArrayWrapper>(keyRegion.keySet())));
-      return;
-    }
-
-    Random rand = new Random();
-
-    ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[members]);
-
-    if (count == 1) {
-      ByteArrayWrapper randEntry = entries[rand.nextInt(entries.length)];
-      command.setResponse(
-          Coder.getBulkStringResponse(context.getByteBufAllocator(), randEntry.toBytes()));
-    } else if (count > 0) {
-      Set<ByteArrayWrapper> randEntries = new HashSet<ByteArrayWrapper>();
-      do {
-        ByteArrayWrapper s = entries[rand.nextInt(entries.length)];
-        randEntries.add(s);
-      } while (randEntries.size() < count);
-      command.setResponse(
-          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), randEntries));
-    } else {
-      count = -count;
-      List<ByteArrayWrapper> randEntries = new ArrayList<ByteArrayWrapper>();
-      for (int i = 0; i < count; i++) {
-        ByteArrayWrapper s = entries[rand.nextInt(entries.length)];
-        randEntries.add(s);
-      }
-      command.setResponse(
-          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), randEntries));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
deleted file mode 100755
index 18d46ee..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SRemExecutor extends SetExecutor {
-
-  private final int NONE_REMOVED = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SREM));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NONE_REMOVED));
-      return;
-    }
-
-    int numRemoved = 0;
-
-    for (int i = 2; i < commandElems.size(); i++) {
-      Object oldVal;
-      oldVal = keyRegion.remove(new ByteArrayWrapper(commandElems.get(i)));
-      if (oldVal != null)
-        numRemoved++;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
deleted file mode 100755
index b1a3835..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
-
-public class SScanExecutor extends AbstractScanExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SSCAN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-    if (keyRegion == null) {
-      command.setResponse(
-          Coder.getScanResponse(context.getByteBufAllocator(), new ArrayList<String>()));
-      return;
-    }
-    byte[] cAr = commandElems.get(2);
-    String cursorString = Coder.bytesToString(cAr);
-    int cursor = 0;
-    Pattern matchPattern = null;
-    String globMatchPattern = null;
-    int count = DEFUALT_COUNT;
-    try {
-      cursor = Integer.parseInt(cursorString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-    if (cursor < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-
-    if (commandElems.size() > 4) {
-      try {
-        byte[] bytes = commandElems.get(3);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("MATCH")) {
-          bytes = commandElems.get(4);
-          globMatchPattern = Coder.bytesToString(bytes);
-        } else if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(4);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (commandElems.size() > 6) {
-      try {
-        byte[] bytes = commandElems.get(5);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(6);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (count < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-      return;
-    }
-
-    try {
-      matchPattern = convertGlobToRegex(globMatchPattern);
-    } catch (PatternSyntaxException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
-      return;
-    }
-
-    @SuppressWarnings("unchecked")
-    List<ByteArrayWrapper> returnList =
-        (List<ByteArrayWrapper>) getIteration(new ArrayList(keyRegion.keySet()), matchPattern,
-            count, cursor);
-
-    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
-    List<Object> returnList = new ArrayList<Object>();
-    int size = list.size();
-    int beforeCursor = 0;
-    int numElements = 0;
-    int i = -1;
-    for (ByteArrayWrapper value : (Collection<ByteArrayWrapper>) list) {
-      String key = Coder.bytesToString(value.toBytes());
-      i++;
-      if (beforeCursor < cursor) {
-        beforeCursor++;
-        continue;
-      } else if (numElements < count) {
-        if (matchPattern != null) {
-          if (matchPattern.matcher(key).matches()) {
-            returnList.add(value);
-            numElements++;
-          }
-        } else {
-          returnList.add(value);
-          numElements++;
-        }
-      } else
-        break;
-    }
-
-    if (i == size - 1)
-      returnList.add(0, String.valueOf(0));
-    else
-      returnList.add(0, String.valueOf(i));
-    return returnList;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
deleted file mode 100755
index 02e879b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SUnionExecutor extends SetOpExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return false;
-  }
-
-  @Override
-  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
-      List<Set<ByteArrayWrapper>> setList) {
-    Set<ByteArrayWrapper> addSet = firstSet;
-    for (Set<ByteArrayWrapper> set : setList) {
-      if (addSet == null) {
-        addSet = new HashSet<ByteArrayWrapper>(set);
-        continue;
-      }
-      addSet.addAll(set);
-    }
-    return addSet;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SUNION;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
deleted file mode 100755
index 96b07e0..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class SUnionStoreExecutor extends SUnionExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SUNIONSTORE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
deleted file mode 100755
index 0227e88..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class SetExecutor extends AbstractExecutor {
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
deleted file mode 100755
index 7ca72a5..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.set;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
-public abstract class SetOpExecutor extends SetExecutor implements Extendable {
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-    int setsStartIndex = isStorage() ? 2 : 1;
-    if (commandElems.size() < setsStartIndex + 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-    RegionProvider rC = context.getRegionProvider();
-    ByteArrayWrapper destination = null;
-    if (isStorage())
-      destination = command.getKey();
-
-    ByteArrayWrapper firstSetKey = new ByteArrayWrapper(commandElems.get(setsStartIndex++));
-    if (!isStorage())
-      checkDataType(firstSetKey, RedisDataType.REDIS_SET, context);
-    Region<ByteArrayWrapper, Boolean> region =
-        (Region<ByteArrayWrapper, Boolean>) rC.getRegion(firstSetKey);
-    Set<ByteArrayWrapper> firstSet = null;
-    if (region != null) {
-      firstSet = new HashSet<ByteArrayWrapper>(region.keySet());
-    }
-    ArrayList<Set<ByteArrayWrapper>> setList = new ArrayList<Set<ByteArrayWrapper>>();
-    for (int i = setsStartIndex; i < commandElems.size(); i++) {
-      ByteArrayWrapper key = new ByteArrayWrapper(commandElems.get(i));
-      checkDataType(key, RedisDataType.REDIS_SET, context);
-      region = (Region<ByteArrayWrapper, Boolean>) rC.getRegion(key);
-      if (region != null)
-        setList.add(region.keySet());
-      else if (this instanceof SInterExecutor)
-        setList.add(null);
-    }
-    if (setList.isEmpty()) {
-      if (isStorage()) {
-        command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-        context.getRegionProvider().removeKey(destination);
-      } else {
-        if (firstSet == null)
-          command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-        else
-          command.setResponse(
-              Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), firstSet));
-      }
-      return;
-    }
-
-    Set<ByteArrayWrapper> resultSet = setOp(firstSet, setList);
-    if (isStorage()) {
-      Region<ByteArrayWrapper, Boolean> newRegion = null; // (Region<ByteArrayWrapper, Boolean>)
-                                                          // rC.getRegion(destination);
-      rC.removeKey(destination);
-      if (resultSet != null) {
-        Map<ByteArrayWrapper, Boolean> map = new HashMap<ByteArrayWrapper, Boolean>();
-        for (ByteArrayWrapper entry : resultSet)
-          map.put(entry, Boolean.TRUE);
-        if (!map.isEmpty()) {
-          newRegion = (Region<ByteArrayWrapper, Boolean>) rC.getOrCreateRegion(destination,
-              RedisDataType.REDIS_SET, context);
-          newRegion.putAll(map);
-        }
-        command
-            .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), resultSet.size()));
-      } else {
-        command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      }
-    } else {
-      if (resultSet == null || resultSet.isEmpty())
-        command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      else
-        command.setResponse(
-            Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), resultSet));
-    }
-  }
-
-  protected abstract boolean isStorage();
-
-  protected abstract Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
-      List<Set<ByteArrayWrapper>> setList);
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
deleted file mode 100755
index 5330c80..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class SortedSetExecutor extends AbstractExecutor {
-
-  @Override
-  protected Region<ByteArrayWrapper, DoubleWrapper> getOrCreateRegion(
-      ExecutionHandlerContext context, ByteArrayWrapper key, RedisDataType type) {
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, DoubleWrapper> r = (Region<ByteArrayWrapper, DoubleWrapper>) context
-        .getRegionProvider().getOrCreateRegion(key, type, context);
-    return r;
-  }
-
-  protected Region<ByteArrayWrapper, DoubleWrapper> getRegion(ExecutionHandlerContext context,
-      ByteArrayWrapper key) {
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, DoubleWrapper> r =
-        (Region<ByteArrayWrapper, DoubleWrapper>) context.getRegionProvider().getRegion(key);
-    return r;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
deleted file mode 100755
index a5bbebc..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZAddExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERICAL = "The inteded score is not a float";
-
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4 || commandElems.size() % 2 == 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZADD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    int numberOfAdds = 0;
-
-    if (commandElems.size() > 4) {
-      Map<ByteArrayWrapper, DoubleWrapper> map = new HashMap<ByteArrayWrapper, DoubleWrapper>();
-      for (int i = 2; i < commandElems.size(); i++) {
-        byte[] scoreArray = commandElems.get(i++);
-        byte[] memberArray = commandElems.get(i);
-
-        Double score;
-        try {
-          score = Coder.bytesToDouble(scoreArray);
-        } catch (NumberFormatException e) {
-          command.setResponse(
-              Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERICAL));
-          return;
-        }
-
-        map.put(new ByteArrayWrapper(memberArray), new DoubleWrapper(score));
-        numberOfAdds++;
-      }
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-          getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-      keyRegion.putAll(map);
-    } else {
-      byte[] scoreArray = commandElems.get(2);
-      byte[] memberArray = commandElems.get(3);
-      Double score;
-      try {
-        score = Coder.bytesToDouble(scoreArray);
-      } catch (NumberFormatException e) {
-        command.setResponse(
-            Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERICAL));
-        return;
-      }
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-          getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-      Object oldVal = keyRegion.put(new ByteArrayWrapper(memberArray), new DoubleWrapper(score));
-
-      if (oldVal == null)
-        numberOfAdds = 1;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numberOfAdds));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
deleted file mode 100755
index 2294e4e..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class ZCardExecutor extends SortedSetExecutor {
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCARD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-
-    if (keyRegion == null)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-    else
-      command
-          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size()));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
deleted file mode 100755
index 72eae68..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZCountExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCOUNT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    boolean startInclusive = true;
-    boolean stopInclusive = true;
-    double start;
-    double stop;
-
-    byte[] startArray = commandElems.get(2);
-    byte[] stopArray = commandElems.get(3);
-    String startString = Coder.bytesToString(startArray);
-    String stopString = Coder.bytesToString(stopArray);
-
-    if (startArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      startInclusive = false;
-    }
-    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      stopInclusive = false;
-    }
-
-    try {
-      start = Coder.stringToDouble(startString);
-      stop = Coder.stringToDouble(stopString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-
-    int count;
-    try {
-      count = getCount(key, keyRegion, context, start, stop, startInclusive, stopInclusive);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), count));
-  }
-
-  private int getCount(ByteArrayWrapper key, Region<ByteArrayWrapper, DoubleWrapper> keyRegion,
-      ExecutionHandlerContext context, double start, double stop, boolean startInclusive,
-      boolean stopInclusive) throws FunctionDomainException, TypeMismatchException,
-      NameResolutionException, QueryInvocationTargetException {
-    if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY)
-      return keyRegion.size();
-    else if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY)
-      return 0;
-
-    Query query;
-    Object[] params;
-    if (start == Double.NEGATIVE_INFINITY) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZCOUNTNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZCOUNTNINF, context);
-      }
-      params = new Object[] {stop};
-    } else if (stop == Double.POSITIVE_INFINITY) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZCOUNTPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZCOUNTPINF, context);
-      }
-      params = new Object[] {start};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZCOUNTSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZCOUNTSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZCOUNTSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZCOUNT, context);
-        }
-      }
-      params = new Object[] {start, stop};
-    }
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Integer) results.asList().get(0);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
deleted file mode 100755
index 6c35720..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZIncrByExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-  private final String ERROR_NAN = "This increment is illegal because it would result in a NaN";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() != 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZINCRBY));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-
-    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(3));
-
-    double incr;
-
-    try {
-      byte[] incrArray = commandElems.get(2);
-      incr = Coder.bytesToDouble(incrArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    DoubleWrapper score = keyRegion.get(member);
-
-    if (score == null) {
-      keyRegion.put(member, new DoubleWrapper(incr));
-      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), incr));
-      return;
-    }
-    double result = score.score + incr;
-    if (Double.isNaN(result)) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NAN));
-      return;
-    }
-    score.score = result;
-    keyRegion.put(member, score);
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), score.score));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
deleted file mode 100755
index 42791e2..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZLexCountExecutor extends SortedSetExecutor {
-
-  private final String ERROR_ILLEGAL_SYNTAX =
-      "The min and max strings must either start with a (, [ or be - or +";
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZLEXCOUNT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    boolean minInclusive = false;
-    boolean maxInclusive = false;
-
-    byte[] minArray = commandElems.get(2);
-    byte[] maxArray = commandElems.get(3);
-    String startString = Coder.bytesToString(minArray);
-    String stopString = Coder.bytesToString(maxArray);
-
-    if (minArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      minInclusive = false;
-    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
-      startString = startString.substring(1);
-      minInclusive = true;
-    } else if (minArray[0] != Coder.HYPHEN_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = false;
-    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = true;
-    } else if (maxArray[0] != Coder.PLUS_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-
-    int count;
-    try {
-      count = getCount(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
-          Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive);
-    } catch (Exception e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), e.toString()));
-      return;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), count));
-  }
-
-  private int getCount(ByteArrayWrapper key, Region<ByteArrayWrapper, DoubleWrapper> keyRegion,
-      ExecutionHandlerContext context, ByteArrayWrapper start, ByteArrayWrapper stop,
-      boolean startInclusive, boolean stopInclusive) throws Exception {
-    if (start.equals("-") && stop.equals("+"))
-      return keyRegion.size();
-    else if (start.equals("+") || stop.equals("-"))
-      return 0;
-
-    Query query;
-    Object[] params;
-    if (start.equals("-")) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTNINF, context);
-      }
-      params = new Object[] {stop};
-    } else if (stop.equals("+")) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTPINF, context);
-      }
-      params = new Object[] {start};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNT, context);
-        }
-      }
-      params = new Object[] {start, stop};
-    }
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Integer) results.asList().get(0);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
deleted file mode 100755
index 4466521..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import io.netty.buffer.ByteBuf;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRangeByLexExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  private final String ERROR_ILLEGAL_SYNTAX =
-      "The min and max strings must either start with a (, [ or be - or +";
-
-  private final String ERROR_LIMIT = "The offset and count cannot be negative";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZRANGEBYLEX));
-      return;
-    }
-
-    boolean existsLimit = false;
-
-    if (commandElems.size() >= 7) {
-      byte[] fifthElem = commandElems.get(4);
-      existsLimit = Coder.bytesToString(fifthElem).equalsIgnoreCase("LIMIT");
-    }
-
-    int offset = 0;
-    int limit = 0;
-
-    if (existsLimit) {
-      try {
-        byte[] offsetArray = commandElems.get(5);
-        byte[] limitArray = commandElems.get(6);
-        offset = Coder.bytesToInt(offsetArray);
-        limit = Coder.bytesToInt(limitArray);
-      } catch (NumberFormatException e) {
-        command
-            .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-        return;
-      }
-    }
-
-    if (offset < 0 || limit < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_LIMIT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    boolean minInclusive = false;
-    boolean maxInclusive = false;
-
-    byte[] minArray = commandElems.get(2);
-    byte[] maxArray = commandElems.get(3);
-    String startString = Coder.bytesToString(minArray);
-    String stopString = Coder.bytesToString(maxArray);
-    if (minArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      minInclusive = false;
-    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
-      startString = startString.substring(1);
-      minInclusive = true;
-    } else if (minArray[0] != Coder.HYPHEN_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = false;
-    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = true;
-    } else if (maxArray[0] != Coder.PLUS_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-    Collection<ByteArrayWrapper> list = null;
-    if (!(existsLimit && limit == 0)) {
-      try {
-        list = getRange(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
-            Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive, offset, limit);
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    }
-    if (list == null)
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-    else
-      command.setResponse(getCustomBulkStringArrayResponse(list, context));
-  }
-
-  private List<ByteArrayWrapper> getRange(ByteArrayWrapper key,
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
-      ByteArrayWrapper start, ByteArrayWrapper stop, boolean startInclusive, boolean stopInclusive,
-      int offset, int limit) throws FunctionDomainException, TypeMismatchException,
-      NameResolutionException, QueryInvocationTargetException {
-    if (start.equals("-") && stop.equals("+")) {
-      List<ByteArrayWrapper> l = new ArrayList<ByteArrayWrapper>(keyRegion.keySet());
-      int size = l.size();
-      Collections.sort(l);
-      if (limit == 0)
-        limit += size;
-      l = l.subList(Math.min(size, offset), Math.min(offset + limit, size));
-      return l;
-    } else if (start.equals("+") || stop.equals("-"))
-      return null;
-
-    Query query;
-    Object[] params;
-    if (start.equals("-")) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINF, context);
-      }
-      params = new Object[] {stop, INFINITY_LIMIT};
-    } else if (stop.equals("+")) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINF, context);
-      }
-      params = new Object[] {start, INFINITY_LIMIT};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEX, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    }
-    if (limit > 0)
-      params[params.length - 1] = (limit + offset);
-    SelectResults<ByteArrayWrapper> results =
-        (SelectResults<ByteArrayWrapper>) query.execute(params);
-    List<ByteArrayWrapper> list = results.asList();
-    int size = list.size();
-    return list.subList(Math.min(size, offset), size);
-
-  }
-
-  private final ByteBuf getCustomBulkStringArrayResponse(Collection<ByteArrayWrapper> items,
-      ExecutionHandlerContext context) {
-    Iterator<ByteArrayWrapper> it = items.iterator();
-    ByteBuf response = context.getByteBufAllocator().buffer();
-    response.writeByte(Coder.ARRAY_ID);
-    response.writeBytes(Coder.intToBytes(items.size()));
-    response.writeBytes(Coder.CRLFar);
-
-    while (it.hasNext()) {
-      ByteArrayWrapper next = it.next();
-      byte[] byteAr = next.toBytes();
-      response.writeByte(Coder.BULK_STRING_ID);
-      response.writeBytes(Coder.intToBytes(byteAr.length));
-      response.writeBytes(Coder.CRLFar);
-      response.writeBytes(byteAr);
-      response.writeBytes(Coder.CRLFar);
-    }
-
-    return response;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
deleted file mode 100755
index 454d281..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRangeByScoreExecutor extends SortedSetExecutor implements Extendable {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-
-  private final String ERROR_LIMIT = "The offset and count cannot be negative";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    boolean withScores = false;
-    byte[] elem4Array = null;
-    int offset = 0;
-    int limit = -1;
-    if (commandElems.size() >= 5) {
-      elem4Array = commandElems.get(4);
-      String elem4 = Coder.bytesToString(elem4Array);
-      int limitIndex = 4;
-      if (elem4.equalsIgnoreCase("WITHSCORES")) {
-        withScores = true;
-        limitIndex++;
-      }
-
-      if (commandElems.size() >= limitIndex + 2) {
-        String limitString = Coder.bytesToString(commandElems.get(limitIndex));
-        if (limitString.equalsIgnoreCase("LIMIT")) {
-          try {
-            byte[] offsetArray = commandElems.get(limitIndex + 1);
-            byte[] limitArray = commandElems.get(limitIndex + 2);
-            offset = Coder.bytesToInt(offsetArray);
-            limit = Coder.bytesToInt(limitArray);
-          } catch (NumberFormatException e) {
-            command.setResponse(
-                Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-            return;
-          }
-        }
-
-        if (offset < 0 || limit < 0) {
-          command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_LIMIT));
-          return;
-        }
-
-        if (limitIndex == 4 && commandElems.size() >= 8) {
-          byte[] lastElemArray = commandElems.get(7);
-          String lastString = Coder.bytesToString(lastElemArray);
-          if (lastString.equalsIgnoreCase("WITHSCORES")) {
-            withScores = true;
-          }
-        }
-      }
-
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int startIndex = isReverse() ? 3 : 2;
-    int stopIndex = isReverse() ? 2 : 3;
-    boolean startInclusive = true;
-    boolean stopInclusive = true;
-    double start;
-    double stop;
-
-    byte[] startArray = commandElems.get(startIndex);
-    byte[] stopArray = commandElems.get(stopIndex);
-    String startString = Coder.bytesToString(startArray);
-    String stopString = Coder.bytesToString(stopArray);
-
-    if (startArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      startInclusive = false;
-    }
-    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      stopInclusive = false;
-    }
-
-    try {
-      start = Coder.stringToDouble(startString);
-      stop = Coder.stringToDouble(stopString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    Collection<?> list;
-    try {
-      list = getKeys(key, keyRegion, context, start, stop, startInclusive, stopInclusive, offset,
-          limit);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    if (list == null)
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-    else
-      command.setResponse(Coder.zRangeResponse(context.getByteBufAllocator(), list, withScores));
-  }
-
-  private Collection<?> getKeys(ByteArrayWrapper key,
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
-      double start, double stop, boolean startInclusive, boolean stopInclusive, int offset,
-      int limit) throws FunctionDomainException, TypeMismatchException, NameResolutionException,
-      QueryInvocationTargetException {
-    if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY || start > stop
-        || (start == stop && (!startInclusive || !stopInclusive)))
-      return null;
-    if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY)
-      return new HashSet(keyRegion.entrySet());
-
-    Query query;
-    Object[] params;
-    if (isReverse()) {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZREVRBSSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZREVRBSSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZREVRBSSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZREVRBS, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRBSSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRBSSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRBSSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRBS, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    }
-    if (limit > 0)
-      params[params.length - 1] = (limit + offset);
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-    if (offset < results.size())
-      return (Collection<Struct>) results.asList().subList(offset, results.size());
-    else
-      return null;
-  }
-
-  protected boolean isReverse() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZRANGEBYSCORE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
deleted file mode 100755
index 0058da0..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRangeExecutor extends SortedSetExecutor implements Extendable {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    boolean withScores = false;
-
-    if (commandElems.size() >= 5) {
-      byte[] fifthElem = commandElems.get(4);
-      withScores = Coder.bytesToString(fifthElem).equalsIgnoreCase("WITHSCORES");
-
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-
-    int start;
-    int stop;
-    int sSetSize = keyRegion.size();
-
-    try {
-      byte[] startArray = commandElems.get(2);
-      byte[] stopArray = commandElems.get(3);
-      start = Coder.bytesToInt(startArray);
-      stop = Coder.bytesToInt(stopArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    start = getBoundedStartIndex(start, sSetSize);
-    stop = getBoundedEndIndex(stop, sSetSize);
-
-    if (start > stop || start == sSetSize) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-    if (stop == sSetSize)
-      stop--;
-    List<?> list;
-    try {
-      list = getRange(context, key, start, stop);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    command.setResponse(Coder.zRangeResponse(context.getByteBufAllocator(), list, withScores));
-  }
-
-  private List<?> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
-      int stop) throws Exception {
-    Query query;
-
-    if (isReverse())
-      query = getQuery(key, SortedSetQuery.ZRANGE, context);
-    else
-      query = getQuery(key, SortedSetQuery.ZREVRANGE, context);
-
-    Object[] params = {stop + 1};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    List<?> list = results.asList();
-
-    return list.subList(start, stop + 1);
-
-  }
-
-  protected boolean isReverse() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZRANGE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
deleted file mode 100755
index 5fadcaf..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRankExecutor extends SortedSetExecutor implements Extendable {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
-
-    DoubleWrapper value = keyRegion.get(member);
-
-    if (value == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int rank;
-    try {
-      rank = getRange(context, key, member, value);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), rank));
-  }
-
-  private int getRange(ExecutionHandlerContext context, ByteArrayWrapper key,
-      ByteArrayWrapper member, DoubleWrapper valueWrapper) throws Exception {
-    Query query;
-    if (isReverse())
-      query = getQuery(key, SortedSetQuery.ZREVRANK, context);
-    else
-      query = getQuery(key, SortedSetQuery.ZRANK, context);
-
-    Object[] params = {valueWrapper.score, valueWrapper.score, member};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Integer) results.asList().get(0);
-
-  }
-
-  protected boolean isReverse() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZRANK;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
deleted file mode 100755
index 5cbc7e4..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZRemExecutor extends SortedSetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREM));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    int numDeletedMembers = 0;
-
-    for (int i = 2; i < commandElems.size(); i++) {
-      byte[] memberArray = commandElems.get(i);
-      ByteArrayWrapper member = new ByteArrayWrapper(memberArray);
-      Object oldVal = keyRegion.remove(member);
-      if (oldVal != null)
-        numDeletedMembers++;
-    }
-    if (keyRegion.isEmpty())
-      context.getRegionProvider().removeKey(key);
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeletedMembers));
-  }
-}


[09/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added

Posted by ud...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisConstants.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisConstants.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisConstants.java
new file mode 100644
index 0000000..84dd44b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisConstants.java
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+
+public class RedisConstants {
+
+  public static final int NUM_DEFAULT_KEYS = 3;
+
+  /*
+   * Responses
+   */
+  public static final String QUIT_RESPONSE = "OK";
+  public static final String COMMAND_QUEUED = "QUEUED";
+
+
+  /*
+   * Error responses
+   */
+  static final String PARSING_EXCEPTION_MESSAGE =
+      "The command recieved by GeodeRedisServiceImpl was improperly formatted";
+  static final String SERVER_ERROR_MESSAGE = "The server had an internal error please try again";
+  static final String SERVER_ERROR_UNKNOWN_RESPONSE = "Unkown response";
+  static final String SERVER_ERROR_SHUTDOWN = "The server is shutting down";
+  static final String ERROR_UNSUPPORTED_OPERATION_IN_TRANSACTION =
+      "This command is not supported within a transaction";
+  static final String ERROR_TRANSACTION_EXCEPTION =
+      "This transcation cannot be initiated, make sure the command is executed against a replicate region or your data is collocated. If you are using persistent regions, make sure transactions are enabled";
+  public static final String ERROR_NOT_NUMERIC = "Illegal non numeric argument";
+  public static final String ERROR_UNKOWN_COMMAND = "Unable to process uknown command";
+  public static final String ERROR_COMMIT_CONFLICT =
+      "There has been a conflict with another transaction";
+  public static final String ERROR_REGION_CREATION =
+      "This key could not be created. Gemfire does not allow certain characters to used in keys";
+  public static final String ERROR_UNWATCH =
+      "Keys cannot be watched or unwatched because GemFire watches all keys by default for transactions";
+  public static final String ERROR_WATCH =
+      "Keys cannot be watched or unwatched because GemFire watches all keys by default for transactions";
+  public static final String ERROR_ILLEGAL_GLOB = "Incorrect syntax for given glob regex";
+  public static final String ERROR_OUT_OF_RANGE = "The number provided is out of range";
+  public static final String ERROR_NESTED_MULTI = "The MULTI command cannot be nested";
+  public static final String ERROR_NAN_INF_INCR = "increment would produce NaN or Infinity";
+  public static final String ERROR_NO_PASS =
+      "Attempting to authenticate when no password has been set";
+  public static final String ERROR_INVALID_PWD =
+      "Attemping to authenticate with an invalid password";
+  public static final String ERROR_NOT_AUTH = "Must authenticate before sending any requests";
+
+  public static class ArityDef {
+
+    /*
+     * General
+     */
+    public static final int DBSIZE_ARITY = 0;
+    public static final String AUTH =
+        "The wrong number of arguments or syntax was provided, the format for the AUTH command is \"AUTH password\"";
+    public static final String DBSIZE = null;
+    public static final String DEL =
+        "The wrong number of arguments or syntax was provided, the format for the DEL command is \"DEL key [key ...]\"";
+    public static final String ECHO =
+        "The wrong number of arguments or syntax was provided, the format for the ECHO command is \"ECHO message\"";
+    public static final String EXISTS =
+        "The wrong number of arguments or syntax was provided, the format for the EXISTS command is \"EXISTS key\"";
+    public static final String EXPIREAT =
+        "The wrong number of arguments or syntax was provided, the format for the EXPIREAT command is \"EXPIREAT key timestamp\"";
+    public static final String EXPIRE =
+        "The wrong number of arguments or syntax was provided, the format for the EXPIRE command is \"EXPIRE key seconds\"";
+    public static final String FLUSHALL = null;
+    public static final String KEYS =
+        "The wrong number of arguments or syntax was provided, the format for the KEYS command is \"KEYS pattern\"";
+    public static final String PERSIST =
+        "The wrong number of arguments or syntax was provided, the format for the PERSIST command is \"PERSIST key\"";
+    public static final String PEXPIREAT =
+        "The wrong number of arguments or syntax was provided, the format for the PEXPIREAT command is \"PEXPIREAT key milliseconds-timestamp\"";
+    public static final String PEXPIRE =
+        "The wrong number of arguments or syntax was provided, the format for the PEXPIRE command is \"PEXPIRE key milliseconds\"";
+    public static final String PING = null;
+    public static final String PTTL =
+        "The wrong number of arguments or syntax was provided, the format for the PTTL command is \"PTTL key\"";
+    public static final String QUIT = null;
+    public static final String SCAN =
+        "The wrong number of arguments or syntax was provided, the format for the SCAN command is \"SCAN cursor [MATCH pattern] [COUNT count]\"";
+    public static final String SHUTDOWN = null;
+    public static final String TIME = null;
+    public static final String TTL =
+        "The wrong number of arguments or syntax was provided, the format for the TTL command is \"TTL key\"";
+    public static final String TYPE =
+        "The wrong number of arguments or syntax was provided, the format for the TYPE command is \"TYPE key\"";
+    public static final String UNKNOWN = null;
+
+    /*
+     * Hash
+     */
+    public static final String HDEL =
+        "The wrong number of arguments or syntax was provided, the format for the HDEL command is \"HDEL key field [field ...]\"";
+    public static final String HEXISTS =
+        "The wrong number of arguments or syntax was provided, the format for the HEXISTS command is \"HEXISTS key field\"";
+    public static final String HGETALL =
+        "The wrong number of arguments or syntax was provided, the format for the HGETALL command is \"HGETALL key\"";
+    public static final String HGET =
+        "The wrong number of arguments or syntax was provided, the format for the HGET command is \"HGET key field\"";
+    public static final String HINCRBY =
+        "The wrong number of arguments or syntax was provided, the format for the HINCRBY command is \"HINCRBY key field increment\"";
+    public static final String HINCRBYFLOAT =
+        "The wrong number of arguments or syntax was provided, the format for the HINCRBYFLOAT command is \"HINCRBYFLOAT key field increment\"";
+    public static final String HKEYS =
+        "The wrong number of arguments or syntax was provided, the format for the HKEYS command is \"HKEYS key\"";
+    public static final String HLEN =
+        "The wrong number of arguments or syntax was provided, the format for the HLEN command is \"HLEN key\"";
+    public static final String HMGET =
+        "The wrong number of arguments or syntax was provided, the format for the HMGET command is \"HMGET key field [field ...]\"";
+    public static final String HMSET =
+        "The wrong number of arguments or syntax was provided, the format for the HMSET command is \"HMSET key field value [field value ...]\", or not every field is associated with a value";
+    public static final String HSCAN =
+        "The wrong number of arguments or syntax was provided, the format for the SSCAN command is \"SSCAN key cursor [MATCH pattern] [COUNT count]\"";
+    public static final String HSET =
+        "The wrong number of arguments or syntax was provided, the format for the HSET command is \"HSET key field value\"";
+    public static final String HSETNX =
+        "The wrong number of arguments or syntax was provided, the format for the HSETNX command is \"HSETNX key field value\"";
+    public static final String HVALS =
+        "The wrong number of arguments or syntax was provided, the format for the HVALS command is \"HVALS key\"";
+
+    /*
+     * Hll
+     */
+    public static final String PFADD =
+        "The wrong number of arguments or syntax was provided, the format for the PFADD command is \"PFADD key element [element ...]\"";
+    public static final String PFCOUNT =
+        "The wrong number of arguments or syntax was provided, the format for the PFCOUNT command is \"PFCOUNT key [key ...]\"";
+    public static final String PFMERGE =
+        "The wrong number of arguments or syntax was provided, the format for the PFMERGE command is \"PFMERGE destkey sourcekey [sourcekey ...]\"";
+
+    /*
+     * List
+     */
+    public static final String LINDEX =
+        "The wrong number of arguments or syntax was provided, the format for the LINDEX command is \"LINDEX key index";
+    public static final String LINSERT = null;
+    public static final String LLEN =
+        "The wrong number of arguments or syntax was provided, the format for the LLEN command is \"LLEN key";
+    public static final String LPOP =
+        "The wrong number of arguments or syntax was provided, the format for the LPOP command is \"LPOP key";
+    public static final String LPUSH =
+        "The wrong number of arguments or syntax was provided, the format for the LPUSH command is \"LPUSH key value [value ...]";
+    public static final String LPUSHX =
+        "The wrong number of arguments or syntax was provided, the format for the LPUSHX command is \"LPUSHX key value";
+    public static final String LRANGE =
+        "The wrong number of arguments or syntax was provided, the format for the LRANGE command is \"LRANGE key start stop\"";
+    public static final String LREM =
+        "The wrong number of arguments or syntax was provided, the format for the LREM command is \"LREM key count value\"";
+    public static final String LSET =
+        "The wrong number of arguments or syntax was provided, the format for the LSET command is \"LSET key index value\"";
+    public static final String LTRIM =
+        "The wrong number of arguments or syntax was provided, the format for the LTRIM command is \"LTRIM key start stop\"";
+    public static final String RPOP =
+        "The wrong number of arguments or syntax was provided, the format for the RPOP command is \"RPOP key";
+    public static final String RPUSH =
+        "The wrong number of arguments or syntax was provided, the format for the RPUSH command is \"RPUSH key value [value ...]";
+    public static final String RPUSHX =
+        "The wrong number of arguments or syntax was provided, the format for the RPUSHX command is \"RPUSHX key value";
+
+    /*
+     * Set
+     */
+    public static final String SADD =
+        "The wrong number of arguments or syntax was provided, the format for the SADD command is \"SADD key member [member ...]\"";
+    public static final String SCARD =
+        "The wrong number of arguments or syntax was provided, the format for the SCARD command is \"SCARD key\"";
+    public static final String SDIFF =
+        "The wrong number of arguments or syntax was provided, the format for the SDIFF command is \"SDIFF key [key ...]\"";
+    public static final String SDIFFSTORE =
+        "The wrong number of arguments or syntax was provided, the format for the SDIFF command is \"SDIFFSTORE destination key [key ...]\"";
+    public static final String SINTER =
+        "The wrong number of arguments or syntax was provided, the format for the SINTER command is \"SINTER key [key ...]\"";
+    public static final String SINTERSTORE =
+        "The wrong number of arguments or syntax was provided, the format for the SINTERSTORE command is \"SINTERSTORE destination key [key ...]\"";
+    public static final String SISMEMBER =
+        "The wrong number of arguments or syntax was provided, the format for the SISMEMBER command is \"SISMEMBER key member\"";
+    public static final String SMEMBERS =
+        "The wrong number of arguments or syntax was provided, the format for the SMEMBERS command is \"SMEMBERS key\"";
+    public static final String SMOVE =
+        "The wrong number of arguments or syntax was provided, the format for the SMOVE command is \"SMOVE source destination member\"";
+    public static final String SPOP =
+        "The wrong number of arguments or syntax was provided, the format for the SPOP command is \"SPOP key\"";
+    public static final String SRANDMEMBER =
+        "The wrong number of arguments or syntax was provided, the format for the SRANDMEMBER command is \"SRANDMEMBER key [count]\"";
+    public static final String SREM =
+        "The wrong number of arguments or syntax was provided, the format for the SREM command is \"SREM key member [member ...]\"";
+    public static final String SSCAN =
+        "The wrong number of arguments or syntax was provided, the format for the SSCAN command is \"SSCAN key cursor [MATCH pattern] [COUNT count]\"";
+    public static final String SUNION =
+        "The wrong number of arguments or syntax was provided, the format for the SUNION command is \"SUNION key [key ...]\"";
+    public static final String SUNIONSTORE =
+        "The wrong number of arguments or syntax was provided, the format for the SUNIONSTORE command is \"SUNIONSTORE destination key [key ...]\"";
+
+    /*
+     * Sorted set
+     */
+    public static final String ZADD =
+        "The wrong number of arguments or syntax was provided, the format for the ZADD command is \"ZADD key score member [score member ...]\", or not every score matches to a member";
+    public static final String ZCARD =
+        "The wrong number of arguments or syntax was provided, the format for the ZCARD command is \"ZCARD key\"";
+    public static final String ZCOUNT =
+        "The wrong number of arguments or syntax was provided, the format for the ZCOUNT command is \"ZCOUNT key min max\"";
+    public static final String ZINCRBY =
+        "The wrong number of arguments or syntax was provided, the format for the ZINCRBY command is \"ZINCRBY key increment member\"";
+    public static final String ZLEXCOUNT =
+        "The wrong number of arguments or syntax was provided, the format for the ZLEXCOUNT command is \"ZLEXCOUNT key min max\"";
+    public static final String ZRANGEBYLEX =
+        "The wrong number of arguments or syntax was provided, the format for the ZRANGEBYLEX command is \"ZRANGEBYLEX key min max [LIMIT offset count]\"";
+    public static final String ZRANGEBYSCORE =
+        "The wrong number of arguments or syntax was provided, the format for the ZRANGEBYSCORE command is \"ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]\"";
+    public static final String ZRANGE =
+        "The wrong number of arguments or syntax was provided, the format for the ZRANGE command is \"ZRANGE key start stop [WITHSCORES]\"";
+    public static final String ZRANK =
+        "The wrong number of arguments or syntax was provided, the format for the ZRANK command is \"ZRANK key member\"";
+    public static final String ZREM =
+        "The wrong number of arguments or syntax was provided, the format for the ZREM command is \"ZREM key member [member ...]\"";
+    public static final String ZREMRANGEBYLEX =
+        "The wrong number of arguments or syntax was provided, the format for the ZREMRANGEBYLEX command is \"ZREMRANGEBYLEX key min max\"";
+    public static final String ZREMRANGEBYRANK =
+        "The wrong number of arguments or syntax was provided, the format for the ZREMRANGEBYRANK command is \"ZREMRANGEBYRANK key start stop\"";
+    public static final String ZREMRANGEBYSCORE =
+        "The wrong number of arguments or syntax was provided, the format for the ZREMRANGEBYSCORE command is \"ZREMRANGEBYSCORE key min max\"";
+    public static final String ZREVRANGEBYSCORE =
+        "The wrong number of arguments or syntax was provided, the format for the ZREVRANGEBYSCORE command is \"ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]\"";
+    public static final String ZREVRANGE =
+        "The wrong number of arguments or syntax was provided, the format for the ZREVRANGE command is \"ZREVRANGE key start stop [WITHSCORES]\"";
+    public static final String ZREVRANK =
+        "The wrong number of arguments or syntax was provided, the format for the ZREVRANK command is \"ZREVRANK key member\"";
+    public static final String ZSCAN =
+        "The wrong number of arguments or syntax was provided, the format for the SSCAN command is \"SSCAN key cursor [MATCH pattern] [COUNT count]\"";
+    public static final String ZSCORE =
+        "The wrong number of arguments or syntax was provided, the format for the ZSCORE command is \"ZSCORE key member\"";
+
+    /*
+     * String
+     */
+    public static final String APPEND =
+        "The wrong number of arguments or syntax was provided, the format for the APPEND command is \"APPEND key value\"";
+    public static final String BITCOUNT =
+        "The wrong number of arguments or syntax was provided, the format for the BITCOUNT command is \"BITCOUNT key [start end]\"";
+    public static final String BITOP =
+        "The wrong number of arguments or syntax was provided, the format for the BITOP command is \"BITOP operation destkey key [key ...]\"";
+    public static final String BITPOS =
+        "The wrong number of arguments or syntax was provided, the format for the BITOPS command is \"BITPOS key bit [start] [end]\"";
+    public static final String DECRBY =
+        "The wrong number of arguments or syntax was provided, the format for the DECRBY command is \"DECRRBY key decrement\"";
+    public static final String DECR =
+        "The wrong number of arguments or syntax was provided, the format for the DECR command is \"DECR key\"";
+    public static final String GETBIT =
+        "The wrong number of arguments or syntax was provided, the format for the GETBIT command is \"GETBIT key offset\"";
+    public static final String GETEXECUTOR =
+        "The wrong number of arguments or syntax was provided, the format for the GET command is \"GET key\"";
+    public static final String GETRANGE =
+        "The wrong number of arguments or syntax was provided, the format for the GETRANGE command is \"GETRANGE key start end\"";
+    public static final String GETSET =
+        "The wrong number of arguments or syntax was provided, the format for the GETSET command is \"GETSET key value\"";
+    public static final String INCRBY =
+        "The wrong number of arguments or syntax was provided, the format for the INCRBY command is \"INCRBY key increment\"";
+    public static final String INCRBYFLOAT =
+        "The wrong number of arguments or syntax was provided, the format for the INCRBY command is \"INCRBY key increment\"";
+    public static final String INCR =
+        "The wrong number of arguments or syntax was provided, the format for the INCR command is \"INCR key\"";
+    public static final String MGET =
+        "The wrong number of arguments or syntax was provided, the format for the MGET command is \"MGET key [key ...]\"";
+    public static final String MSET =
+        "The wrong number of arguments or syntax was provided, the format for the MSET command is \"MSET key value [key value ...]\", or not every key matches a value";
+    public static final String MSETNX =
+        "The wrong number of arguments or syntax was provided, the format for the MSETNX command is \"MSETNX key value [key value ...]\", or not every key matches a value";
+    public static final String PSETEX =
+        "The wrong number of arguments or syntax was provided, the format for the PSETEX command is \"PSETEX key milliseconds value\"";
+    public static final String SETBIT =
+        "The wrong number of arguments or syntax was provided, the format for the SETBIT command is \"SETBIT key offset value\"";
+    public static final String SET =
+        "The wrong number of arguments or syntax was provided, the format for the SET command is \"SET key value [EX seconds] [PX milliseconds] [NX|XX]\"";
+    public static final String SETEX =
+        "The wrong number of arguments or syntax was provided, the format for the SETEX command is \"SETEX key seconds value\"";
+    public static final String SETNX =
+        "The wrong number of arguments or syntax was provided, the format for the SETNX command is \"SETNX key value\"";
+    public static final String SETRANGE =
+        "The wrong number of arguments or syntax was provided, the format for the SETRANGE command is \"SETRANGE key offset value\"";
+    public static final String STRLEN =
+        "The wrong number of arguments or syntax was provided, the format for the STRELEN command is \"STRLEN key\"";
+
+    /*
+     * Transaction
+     */
+    public static final String DISCARD = null;
+    public static final String EXEC = null;
+    public static final String MULTI = null;
+    public static final String UNWATCH = null;
+    public static final String WATCH = null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataType.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataType.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataType.java
new file mode 100644
index 0000000..9410642
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataType.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.redis.GeodeRedisServiceImpl;
+
+/**
+ * The RedisDataType enum contains the choices to which every {@link Region} on the server must be.
+ * There is only one instance of {@link #REDIS_STRING} and {@link #REDIS_PROTECTED} defined by
+ * {@link GeodeRedisServiceImpl#STRING_REGION} and
+ * {@link GeodeRedisServiceImpl#REDIS_META_DATA_REGION} respectively.
+ * <p>
+ * The data types are:
+ * <li>{@link RedisDataType#REDIS_STRING}</li>
+ * <li>{@link RedisDataType#REDIS_HASH}</li>
+ * <li>{@link RedisDataType#REDIS_LIST}</li>
+ * <li>{@link RedisDataType#REDIS_SET}</li>
+ * <li>{@link RedisDataType#REDIS_SORTEDSET}</li>
+ * <li>{@link RedisDataType#REDIS_PROTECTED}</li>
+ *
+ */
+public enum RedisDataType {
+  /**
+   * Strings Regions
+   */
+  REDIS_STRING {
+    @Override
+    public String toString() {
+      return "string";
+    }
+  },
+
+  /**
+   * Hashes Regions
+   */
+  REDIS_HASH {
+    @Override
+    public String toString() {
+      return "hash";
+    }
+  },
+
+  /**
+   * Lists Regions
+   */
+  REDIS_LIST {
+    @Override
+    public String toString() {
+      return "list";
+    }
+  },
+
+  /**
+   * Sets Regions
+   */
+  REDIS_SET {
+    @Override
+    public String toString() {
+      return "set";
+    }
+  },
+
+  /**
+   * SortedSets Regions
+   */
+  REDIS_SORTEDSET {
+    @Override
+    public String toString() {
+      return "zset";
+    }
+  },
+
+  /**
+   * HyperLogLog Regions
+   */
+  REDIS_HLL {
+    @Override
+    public String toString() {
+      return "hyperloglog";
+    }
+  },
+
+  /**
+   * Regions protected from overwrite or deletion
+   */
+  REDIS_PROTECTED {
+    @Override
+    public String toString() {
+      return "protected";
+    }
+  },
+
+  /**
+   * None
+   */
+  NONE {
+    @Override
+    public String toString() {
+      return "none";
+    }
+  };
+
+};

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java
new file mode 100644
index 0000000..727412b
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisDataTypeMismatchException.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+/**
+ * This exception is for the case that a client attempts to operate on a data structure of one
+ * {@link RedisDataType} with a command that is of another type
+ * 
+ *
+ */
+public class RedisDataTypeMismatchException extends RuntimeException {
+
+  private static final long serialVersionUID = -2451663685348513870L;
+
+  public RedisDataTypeMismatchException() {
+    super();
+  }
+
+  public RedisDataTypeMismatchException(String message) {
+    super(message);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java
new file mode 100644
index 0000000..afc009e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionCreationException.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+/**
+ * This exception is used when an error happens while creating a
+ * {@link org.apache.geode.cache.Region} globally
+ * 
+ *
+ */
+public class RegionCreationException extends RuntimeException {
+
+  public RegionCreationException() {}
+
+  public RegionCreationException(String err) {
+    super(err);
+  }
+
+  public RegionCreationException(String err, Throwable cause) {
+    super(err, cause);
+  }
+
+  private static final long serialVersionUID = 8416820139078312997L;
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
new file mode 100644
index 0000000..deacee0
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
@@ -0,0 +1,567 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.TransactionId;
+import org.apache.geode.cache.query.IndexExistsException;
+import org.apache.geode.cache.query.IndexInvalidException;
+import org.apache.geode.cache.query.IndexNameConflictException;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.QueryInvalidException;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.RegionNotFoundException;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.cli.Result.Status;
+import org.apache.geode.management.internal.cli.commands.CreateAlterDestroyRegionCommands;
+import org.apache.geode.redis.GeodeRedisServiceImpl;
+import org.apache.geode.redis.internal.executor.ExpirationExecutor;
+import org.apache.geode.redis.internal.executor.ListQuery;
+import org.apache.geode.redis.internal.executor.SortedSetQuery;
+import org.apache.geode.redis.internal.hll.HyperLogLogPlus;
+
+import java.io.Closeable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * This class stands between {@link Executor} and {@link Cache#getRegion(String)}. This is needed
+ * because some keys for Redis represented as a {@link Region} in {@link GeodeRedisServiceImpl} come
+ * with additional state. Therefore getting, creating, or destroying a {@link Region} needs to be
+ * synchronized, which is done away with and abstracted by this class.
+ * 
+ *
+ */
+public class RegionProvider implements Closeable {
+
+  private final ConcurrentHashMap<ByteArrayWrapper, Region<?, ?>> regions;
+
+  /**
+   * This is the Redis meta data {@link Region} that holds the {@link RedisDataType} information for
+   * all Regions created. The mapping is a {@link String} key which is the name of the
+   * {@link Region} created to hold the data to the RedisDataType it contains.
+   */
+  private final Region<String, RedisDataType> redisMetaRegion;
+
+  /**
+   * This is the {@link RedisDataType#REDIS_STRING} {@link Region}. This is the Region that stores
+   * all string contents
+   */
+  private final Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion;
+
+  /**
+   * This is the {@link RedisDataType#REDIS_HLL} {@link Region}. This is the Region that stores all
+   * HyperLogLog contents
+   */
+  private final Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion;
+
+  private final Cache cache;
+  private final QueryService queryService;
+  private final ConcurrentMap<ByteArrayWrapper, Map<Enum<?>, Query>> preparedQueries =
+      new ConcurrentHashMap<ByteArrayWrapper, Map<Enum<?>, Query>>();
+  private final ConcurrentMap<ByteArrayWrapper, ScheduledFuture<?>> expirationsMap;
+  private final ScheduledExecutorService expirationExecutor;
+  private final RegionShortcut defaultRegionType;
+  private static final CreateAlterDestroyRegionCommands cliCmds =
+      new CreateAlterDestroyRegionCommands();
+  private final ConcurrentHashMap<String, Lock> locks;
+
+  public RegionProvider(Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion,
+      Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion,
+      Region<String, RedisDataType> redisMetaRegion,
+      ConcurrentMap<ByteArrayWrapper, ScheduledFuture<?>> expirationsMap,
+      ScheduledExecutorService expirationExecutor, RegionShortcut defaultShortcut) {
+    if (stringsRegion == null || hLLRegion == null || redisMetaRegion == null)
+      throw new NullPointerException();
+    this.regions = new ConcurrentHashMap<ByteArrayWrapper, Region<?, ?>>();
+    this.stringsRegion = stringsRegion;
+    this.hLLRegion = hLLRegion;
+    this.redisMetaRegion = redisMetaRegion;
+    this.cache = GemFireCacheImpl.getInstance();
+    this.queryService = cache.getQueryService();
+    this.expirationsMap = expirationsMap;
+    this.expirationExecutor = expirationExecutor;
+    this.defaultRegionType = defaultShortcut;
+    this.locks = new ConcurrentHashMap<String, Lock>();
+  }
+
+  public boolean existsKey(ByteArrayWrapper key) {
+    return this.redisMetaRegion.containsKey(key.toString());
+  }
+
+  public Set<String> metaKeySet() {
+    return this.redisMetaRegion.keySet();
+  }
+
+  public Set<Entry<String, RedisDataType>> metaEntrySet() {
+    return this.redisMetaRegion.entrySet();
+  }
+
+  public int getMetaSize() {
+    return this.redisMetaRegion.size() - RedisConstants.NUM_DEFAULT_KEYS;
+  }
+
+  private boolean metaRemoveEntry(ByteArrayWrapper key) {
+    return this.redisMetaRegion.remove(key.toString()) != null;
+  }
+
+  public RedisDataType metaPutIfAbsent(ByteArrayWrapper key, RedisDataType value) {
+    return this.redisMetaRegion.putIfAbsent(key.toString(), value);
+  }
+
+  public RedisDataType metaPut(ByteArrayWrapper key, RedisDataType value) {
+    return this.redisMetaRegion.put(key.toString(), value);
+  }
+
+  public RedisDataType metaGet(ByteArrayWrapper key) {
+    return this.redisMetaRegion.get(key.toString());
+  }
+
+  public Region<?, ?> getRegion(ByteArrayWrapper key) {
+    return this.regions.get(key);
+  }
+
+  public void removeRegionReferenceLocally(ByteArrayWrapper key, RedisDataType type) {
+    Lock lock = this.locks.get(key.toString());
+    boolean locked = false;
+    try {
+      locked = lock.tryLock();
+      // If we cannot get the lock we ignore this remote event, this key has local event
+      // that started independently, ignore this event to prevent deadlock
+      if (locked) {
+        cancelKeyExpiration(key);
+        removeRegionState(key, type);
+      }
+    } finally {
+      if (locked) {
+        lock.unlock();
+      }
+    }
+  }
+
+  public boolean removeKey(ByteArrayWrapper key) {
+    RedisDataType type = getRedisDataType(key);
+    return removeKey(key, type);
+  }
+
+  public boolean removeKey(ByteArrayWrapper key, RedisDataType type) {
+    return removeKey(key, type, true);
+  }
+
+  public boolean removeKey(ByteArrayWrapper key, RedisDataType type, boolean cancelExpiration) {
+    if (type == null || type == RedisDataType.REDIS_PROTECTED)
+      return false;
+    Lock lock = this.locks.get(key.toString());
+    try {
+      if (lock != null) {// Strings/hlls will not have locks
+        lock.lock();
+      }
+      metaRemoveEntry(key);
+      try {
+        if (type == RedisDataType.REDIS_STRING) {
+          return this.stringsRegion.remove(key) != null;
+        } else if (type == RedisDataType.REDIS_HLL) {
+          return this.hLLRegion.remove(key) != null;
+        } else {
+          return destroyRegion(key, type);
+        }
+      } catch (Exception exc) {
+        return false;
+      } finally {
+        if (cancelExpiration)
+          cancelKeyExpiration(key);
+        else
+          removeKeyExpiration(key);
+        if (lock != null)
+          this.locks.remove(key.toString());
+      }
+    } finally {
+      if (lock != null) {
+        lock.unlock();
+      }
+    }
+  }
+
+  public Region<?, ?> getOrCreateRegion(ByteArrayWrapper key, RedisDataType type,
+      ExecutionHandlerContext context) {
+    return getOrCreateRegion0(key, type, context, true);
+  }
+
+  public void createRemoteRegionReferenceLocally(ByteArrayWrapper key, RedisDataType type) {
+    if (type == null || type == RedisDataType.REDIS_STRING || type == RedisDataType.REDIS_HLL)
+      return;
+    Region<?, ?> r = this.regions.get(key);
+    if (r != null)
+      return;
+    if (!this.regions.contains(key)) {
+      String stringKey = key.toString();
+      Lock lock = this.locks.get(stringKey);
+      if (lock == null) {
+        this.locks.putIfAbsent(stringKey, new ReentrantLock());
+        lock = this.locks.get(stringKey);
+      }
+      boolean locked = false;
+      try {
+        locked = lock.tryLock();
+        // If we cannot get the lock then this remote event may have been initialized
+        // independently on this machine, so if we wait on the lock it is more than
+        // likely we will deadlock just to do the same task. This event can be ignored
+        if (locked) {
+          r = cache.getRegion(key.toString());
+          // If r is null, this implies that we are after a create/destroy
+          // simply ignore. Calls to getRegion or getOrCreate will work correctly
+          if (r == null)
+            return;
+
+          if (type == RedisDataType.REDIS_LIST) {
+            doInitializeList(key, r);
+          } else if (type == RedisDataType.REDIS_SORTEDSET) {
+            try {
+              doInitializeSortedSet(key, r);
+            } catch (RegionNotFoundException | IndexInvalidException e) {
+              // ignore
+            }
+          }
+          this.regions.put(key, r);
+        }
+      } finally {
+        if (locked) {
+          lock.unlock();
+        }
+      }
+    }
+  }
+
+  private Region<?, ?> getOrCreateRegion0(ByteArrayWrapper key, RedisDataType type,
+      ExecutionHandlerContext context, boolean addToMeta) {
+    checkDataType(key, type);
+    Region<?, ?> r = this.regions.get(key);
+    if (r != null && r.isDestroyed()) {
+      removeKey(key, type);
+      r = null;
+    }
+    if (r == null) {
+      String stringKey = key.toString();
+      Lock lock = this.locks.get(stringKey);
+      if (lock == null) {
+        this.locks.putIfAbsent(stringKey, new ReentrantLock());
+        lock = this.locks.get(stringKey);
+      }
+
+      try {
+        lock.lock();
+        r = regions.get(key);
+        if (r == null) {
+          boolean hasTransaction = context != null && context.hasTransaction(); // Can create
+                                                                                // without context
+          CacheTransactionManager txm = null;
+          TransactionId transactionId = null;
+          try {
+            if (hasTransaction) {
+              txm = cache.getCacheTransactionManager();
+              transactionId = txm.suspend();
+            }
+            Exception concurrentCreateDestroyException = null;
+            do {
+              concurrentCreateDestroyException = null;
+              r = createRegionGlobally(stringKey);
+              try {
+                if (type == RedisDataType.REDIS_LIST) {
+                  doInitializeList(key, r);
+                } else if (type == RedisDataType.REDIS_SORTEDSET) {
+                  try {
+                    doInitializeSortedSet(key, r);
+                  } catch (RegionNotFoundException | IndexInvalidException e) {
+                    concurrentCreateDestroyException = e;
+                  }
+                }
+              } catch (QueryInvalidException e) {
+                if (e.getCause() instanceof RegionNotFoundException) {
+                  concurrentCreateDestroyException = e;
+                }
+              }
+            } while (concurrentCreateDestroyException != null);
+            this.regions.put(key, r);
+            if (addToMeta) {
+              RedisDataType existingType = metaPutIfAbsent(key, type);
+              if (existingType != null && existingType != type)
+                throw new RedisDataTypeMismatchException(
+                    "The key name \"" + key + "\" is already used by a " + existingType.toString());
+            }
+          } finally {
+            if (hasTransaction)
+              txm.resume(transactionId);
+          }
+        }
+      } finally {
+        lock.unlock();
+      }
+    }
+    return r;
+  }
+
+  /**
+   * SYNCHRONIZE EXTERNALLY OF this.locks.get(key.toString())!!!!!
+   * 
+   * @param key Key of region to destroy
+   * @param type Type of region to destroyu
+   * @return Flag if destroyed
+   */
+  private boolean destroyRegion(ByteArrayWrapper key, RedisDataType type) {
+    Region<?, ?> r = this.regions.get(key);
+    if (r != null) {
+      try {
+        r.destroyRegion();
+      } catch (Exception e) {
+        return false;
+      } finally {
+        removeRegionState(key, type);
+      }
+    }
+    return true;
+  }
+
+  /**
+   * Do not call this method if you are not synchronized on the lock associated with this key
+   * 
+   * @param key Key of region to remove
+   * @param type Type of key to remove all state
+   */
+  private void removeRegionState(ByteArrayWrapper key, RedisDataType type) {
+    this.preparedQueries.remove(key);
+    this.regions.remove(key);
+  }
+
+  private void doInitializeSortedSet(ByteArrayWrapper key, Region<?, ?> r)
+      throws RegionNotFoundException, IndexInvalidException {
+    String fullpath = r.getFullPath();
+    try {
+      queryService.createIndex("scoreIndex", "entry.value.score",
+          r.getFullPath() + ".entrySet entry");
+      queryService.createIndex("scoreIndex2", "value.score", r.getFullPath() + ".values value");
+    } catch (IndexNameConflictException | IndexExistsException | UnsupportedOperationException e) {
+      // ignore, these indexes already exist or unsupported but make sure prepared queries are made
+    }
+    HashMap<Enum<?>, Query> queryList = new HashMap<Enum<?>, Query>();
+    for (SortedSetQuery lq : SortedSetQuery.values()) {
+      String queryString = lq.getQueryString(fullpath);
+      Query query = this.queryService.newQuery(queryString);
+      queryList.put(lq, query);
+    }
+    this.preparedQueries.put(key, queryList);
+  }
+
+  private void doInitializeList(ByteArrayWrapper key, Region r) {
+    r.put("head", Integer.valueOf(0));
+    r.put("tail", Integer.valueOf(0));
+    String fullpath = r.getFullPath();
+    HashMap<Enum<?>, Query> queryList = new HashMap<Enum<?>, Query>();
+    for (ListQuery lq : ListQuery.values()) {
+      String queryString = lq.getQueryString(fullpath);
+      Query query = this.queryService.newQuery(queryString);
+      queryList.put(lq, query);
+    }
+    this.preparedQueries.put(key, queryList);
+  }
+
+  /**
+   * This method creates a Region globally with the given name. If there is an error in the
+   * creation, a runtime exception will be thrown.
+   * 
+   * @param key Name of Region to create
+   * @return Region Region created globally
+   */
+  private Region<?, ?> createRegionGlobally(String key) {
+    Region<?, ?> r = null;
+    r = cache.getRegion(key);
+    if (r != null)
+      return r;
+    do {
+      Result result = cliCmds.createRegion(key, defaultRegionType, null, null, true, null, null,
+          null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+          null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+          null, null);
+      r = cache.getRegion(key);
+      if (result.getStatus() == Status.ERROR && r == null) {
+        String err = "";
+        while (result.hasNextLine())
+          err += result.nextLine();
+        throw new RegionCreationException(err);
+      }
+    } while (r == null); // The region can be null in the case that it is concurrently destroyed by
+    // a remote even triggered internally by Geode
+    return r;
+  }
+
+  public Query getQuery(ByteArrayWrapper key, Enum<?> query) {
+    return this.preparedQueries.get(key).get(query);
+    /*
+     * if (query instanceof ListQuery) { return
+     * this.queryService.newQuery(((ListQuery)query).getQueryString(this.regions.get(key).
+     * getFullPath())); } else { return
+     * this.queryService.newQuery(((SortedSetQuery)query).getQueryString(this.regions.get(key).
+     * getFullPath())); }
+     */
+  }
+
+  /**
+   * Checks if the given key is associated with the passed data type. If there is a mismatch, a
+   * {@link RuntimeException} is thrown
+   * 
+   * @param key Key to check
+   * @param type Type to check to
+   */
+  protected void checkDataType(ByteArrayWrapper key, RedisDataType type) {
+    RedisDataType currentType = redisMetaRegion.get(key.toString());
+    if (currentType == null)
+      return;
+    if (currentType == RedisDataType.REDIS_PROTECTED)
+      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
+    if (currentType != type)
+      throw new RedisDataTypeMismatchException(
+          "The key name \"" + key + "\" is already used by a " + currentType.toString());
+  }
+
+  public boolean regionExists(ByteArrayWrapper key) {
+    return this.regions.containsKey(key);
+  }
+
+  public Region<ByteArrayWrapper, ByteArrayWrapper> getStringsRegion() {
+    return this.stringsRegion;
+  }
+
+  public Region<ByteArrayWrapper, HyperLogLogPlus> gethLLRegion() {
+    return this.hLLRegion;
+  }
+
+  private RedisDataType getRedisDataType(String key) {
+    return this.redisMetaRegion.get(key);
+  }
+
+  public RedisDataType getRedisDataType(ByteArrayWrapper key) {
+    return getRedisDataType(key.toString());
+  }
+
+  /**
+   * Sets the expiration for a key. The setting and modifying of a key expiration can only be set by
+   * a delay, which means that both expiring after a time and at a time can be done but the delay to
+   * expire at a time must be calculated before these calls. It is also important to note that the
+   * delay is always handled in milliseconds
+   * 
+   * @param key The key to set the expiration for
+   * @param delay The delay in milliseconds of the expiration
+   * @return True is expiration set, false otherwise
+   */
+  public final boolean setExpiration(ByteArrayWrapper key, long delay) {
+    RedisDataType type = getRedisDataType(key);
+    if (type == null)
+      return false;
+    ScheduledFuture<?> future = this.expirationExecutor
+        .schedule(new ExpirationExecutor(key, type, this), delay, TimeUnit.MILLISECONDS);
+    this.expirationsMap.put(key, future);
+    return true;
+  }
+
+  /**
+   * Modifies an expiration on a key
+   * 
+   * @param key String key to modify expiration on
+   * @param delay Delay in milliseconds to reset the expiration to
+   * @return True if reset, false if not
+   */
+  public final boolean modifyExpiration(ByteArrayWrapper key, long delay) {
+    /*
+     * Attempt to cancel future task
+     */
+    boolean canceled = cancelKeyExpiration(key);
+
+    if (!canceled)
+      return false;
+
+    RedisDataType type = getRedisDataType(key);
+    if (type == null)
+      return false;
+
+    ScheduledFuture<?> future = this.expirationExecutor
+        .schedule(new ExpirationExecutor(key, type, this), delay, TimeUnit.MILLISECONDS);
+    this.expirationsMap.put(key, future);
+    return true;
+  }
+
+  /**
+   * Removes an expiration from a key
+   * 
+   * @param key Key
+   * @return True is expiration cancelled on the key, false otherwise
+   */
+  public final boolean cancelKeyExpiration(ByteArrayWrapper key) {
+    ScheduledFuture<?> future = expirationsMap.remove(key);
+    if (future == null)
+      return false;
+    return future.cancel(false);
+  }
+
+  private boolean removeKeyExpiration(ByteArrayWrapper key) {
+    return expirationsMap.remove(key) != null;
+  }
+
+  /**
+   * Check method if key has expiration
+   * 
+   * @param key Key
+   * @return True if key has expiration, false otherwise
+   */
+  public boolean hasExpiration(ByteArrayWrapper key) {
+    return this.expirationsMap.containsKey(key);
+  }
+
+  /**
+   * Get remaining expiration time
+   * 
+   * @param key Key
+   * @return Remaining time in milliseconds or 0 if no delay or key doesn't exist
+   */
+  public final long getExpirationDelayMillis(ByteArrayWrapper key) {
+    ScheduledFuture<?> future = this.expirationsMap.get(key);
+    return future != null ? future.getDelay(TimeUnit.MILLISECONDS) : 0L;
+  }
+
+  @Override
+  public void close() {
+    this.preparedQueries.clear();
+  }
+
+  public String dumpRegionsCache() {
+    StringBuilder builder = new StringBuilder();
+    for (Entry<ByteArrayWrapper, Region<?, ?>> e : this.regions.entrySet()) {
+      builder.append(e.getKey() + " --> {" + e.getValue() + "}\n");
+    }
+    return builder.toString();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java
new file mode 100644
index 0000000..590ab06
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractExecutor.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.redis.GeodeRedisServiceImpl;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Executor;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RedisDataTypeMismatchException;
+import org.apache.geode.redis.internal.RegionProvider;
+
+/**
+ * The AbstractExecutor is the base of all {@link Executor} types for the
+ * {@link GeodeRedisServiceImpl}.
+ * 
+ *
+ */
+public abstract class AbstractExecutor implements Executor {
+
+  /**
+   * Number of Regions used by GeodeRedisServiceImpl internally
+   */
+  public static final int NUM_DEFAULT_REGIONS = 3;
+
+  /**
+   * Max length of a list
+   */
+  protected static final Integer INFINITY_LIMIT = Integer.MAX_VALUE;
+
+  /**
+   * Constant of number of milliseconds in a second
+   */
+  protected static final int millisInSecond = 1000;
+
+  /**
+   * Getter method for a {@link Region} in the case that a Region should be created if one with the
+   * given name does not exist. Before getting or creating a Region, a check is first done to make
+   * sure the desired key doesn't already exist with a different {@link RedisDataType}. If there is
+   * a data type mismatch this method will throw a {@link RuntimeException}.
+   * 
+   * ********************** IMPORTANT NOTE ********************************************** This
+   * method will not fail in returning a Region unless an internal error occurs, so if a Region is
+   * destroyed right after it is created, it will attempt to retry until a reference to that Region
+   * is obtained
+   * *************************************************************************************
+   * 
+   * @param context Client client
+   * @param key String key of desired key
+   * @param type Type of data type desired
+   * @return Region with name key
+   */
+  protected Region<?, ?> getOrCreateRegion(ExecutionHandlerContext context, ByteArrayWrapper key,
+      RedisDataType type) {
+    return context.getRegionProvider().getOrCreateRegion(key, type, context);
+  }
+
+  /**
+   * Checks if the given key is associated with the passed data type. If there is a mismatch, a
+   * {@link RuntimeException} is thrown
+   * 
+   * @param key Key to check
+   * @param type Type to check to
+   * @param context context
+   */
+  protected void checkDataType(ByteArrayWrapper key, RedisDataType type,
+      ExecutionHandlerContext context) {
+    RedisDataType currentType = context.getRegionProvider().getRedisDataType(key);
+    if (currentType == null)
+      return;
+    if (currentType == RedisDataType.REDIS_PROTECTED)
+      throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
+    if (currentType != type)
+      throw new RedisDataTypeMismatchException(
+          "The key name \"" + key + "\" is already used by a " + currentType.toString());
+  }
+
+  protected Query getQuery(ByteArrayWrapper key, Enum<?> type, ExecutionHandlerContext context) {
+    return context.getRegionProvider().getQuery(key, type);
+  }
+
+  protected boolean removeEntry(ByteArrayWrapper key, RedisDataType type,
+      ExecutionHandlerContext context) {
+    if (type == null || type == RedisDataType.REDIS_PROTECTED)
+      return false;
+    RegionProvider rC = context.getRegionProvider();
+    return rC.removeKey(key, type);
+  }
+
+  protected int getBoundedStartIndex(int index, int size) {
+    if (size < 0)
+      throw new IllegalArgumentException("Size < 0, really?");
+    if (index >= 0)
+      return Math.min(index, size);
+    else
+      return Math.max(index + size, 0);
+  }
+
+  protected int getBoundedEndIndex(int index, int size) {
+    if (size < 0)
+      throw new IllegalArgumentException("Size < 0, really?");
+    if (index >= 0)
+      return Math.min(index, size);
+    else
+      return Math.max(index + size, -1);
+  }
+
+  protected long getBoundedStartIndex(long index, long size) {
+    if (size < 0L)
+      throw new IllegalArgumentException("Size < 0, really?");
+    if (index >= 0L)
+      return Math.min(index, size);
+    else
+      return Math.max(index + size, 0);
+  }
+
+  protected long getBoundedEndIndex(long index, long size) {
+    if (size < 0L)
+      throw new IllegalArgumentException("Size < 0, really?");
+    if (index >= 0L)
+      return Math.min(index, size);
+    else
+      return Math.max(index + size, -1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
new file mode 100644
index 0000000..02894aa
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.org.apache.hadoop.fs.GlobPattern;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.Pattern;
+
+
+public abstract class AbstractScanExecutor extends AbstractExecutor {
+
+  protected final String ERROR_CURSOR = "Invalid cursor";
+
+  protected final String ERROR_COUNT = "Count must be numeric and positive";
+
+  protected final String ERROR_INVALID_CURSOR =
+      "Cursor is invalid, dataset may have been altered if this is cursor from a previous scan";
+
+  protected final int DEFUALT_COUNT = 10;
+
+  protected abstract List<?> getIteration(Collection<?> list, Pattern matchPatter, int count,
+      int cursor);
+
+  /**
+   * @param pattern A glob pattern.
+   * @return A regex pattern to recognize the given glob pattern.
+   */
+  protected final Pattern convertGlobToRegex(String pattern) {
+    if (pattern == null)
+      return null;
+    return GlobPattern.compile(pattern);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java
new file mode 100644
index 0000000..2a63fa8
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/AuthExecutor.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Executor;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class AuthExecutor implements Executor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.AUTH));
+      return;
+    }
+    byte[] pwd = context.getAuthPwd();
+    if (pwd == null) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_NO_PASS));
+      return;
+    }
+    boolean correct = Arrays.equals(commandElems.get(1), pwd);
+
+    if (correct) {
+      context.setAuthenticationVerified();
+      command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
+    } else {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_INVALID_PWD));
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java
new file mode 100644
index 0000000..0a121cc
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DBSizeExecutor.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+
+public class DBSizeExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    int size = context.getRegionProvider().getMetaSize();
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), size));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
new file mode 100644
index 0000000..f827fa8
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.cache.UnsupportedOperationInTransactionException;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.List;
+
+public class DelExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    if (context.hasTransaction())
+      throw new UnsupportedOperationInTransactionException();
+
+    List<byte[]> commandElems = command.getProcessedCommand();
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.DEL));
+      return;
+    }
+
+    int numRemoved = 0;
+
+    for (int i = 1; i < commandElems.size(); i++) {
+      byte[] byteKey = commandElems.get(i);
+      ByteArrayWrapper key = new ByteArrayWrapper(byteKey);
+      RedisDataType type = context.getRegionProvider().getRedisDataType(key);
+      if (removeEntry(key, type, context))
+        numRemoved++;
+    }
+
+    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java
new file mode 100644
index 0000000..acbeb2a
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/EchoExecutor.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class EchoExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ECHO));
+      return;
+    }
+
+    byte[] echoMessage = commandElems.get(1);
+    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), echoMessage));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java
new file mode 100644
index 0000000..ca7991e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExistsExecutor.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+
+import java.util.List;
+
+public class ExistsExecutor extends AbstractExecutor {
+  private final int EXISTS = 1;
+
+  private final int NOT_EXISTS = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.EXISTS));
+      return;
+    }
+
+    ByteArrayWrapper key = command.getKey();
+    boolean exists = context.getRegionProvider().existsKey(key);
+
+    if (exists)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), EXISTS));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java
new file mode 100644
index 0000000..86503f1
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpirationExecutor.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RegionProvider;
+
+
+public class ExpirationExecutor implements Runnable {
+  private final ByteArrayWrapper key;
+  private final RedisDataType type;
+  private final RegionProvider rC;
+
+  public ExpirationExecutor(ByteArrayWrapper k, RedisDataType type, RegionProvider rC) {
+    this.key = k;
+    this.type = type;
+    this.rC = rC;
+  }
+
+  @Override
+  public void run() {
+    rC.removeKey(key, type, false);
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java
new file mode 100644
index 0000000..dabec5e
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireAtExecutor.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RegionProvider;
+
+import java.util.List;
+
+public class ExpireAtExecutor extends AbstractExecutor implements Extendable {
+
+  private final String ERROR_TIMESTAMP_NOT_USABLE = "The timestamp specified must be numeric";
+
+  private final int TIMESTAMP_INDEX = 2;
+
+  private final int SET = 1;
+
+  private final int NOT_SET = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+    RegionProvider rC = context.getRegionProvider();
+    ByteArrayWrapper wKey = command.getKey();
+
+    byte[] timestampByteArray = commandElems.get(TIMESTAMP_INDEX);
+    long timestamp;
+    try {
+      timestamp = Coder.bytesToLong(timestampByteArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_TIMESTAMP_NOT_USABLE));
+      return;
+    }
+
+    if (!timeUnitMillis())
+      timestamp = timestamp * millisInSecond;
+
+    long currentTimeMillis = System.currentTimeMillis();
+
+    if (timestamp <= currentTimeMillis) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
+      return;
+    }
+
+    long delayMillis = timestamp - currentTimeMillis;
+
+    boolean expirationSet = false;
+
+    if (rC.hasExpiration(wKey))
+      expirationSet = rC.modifyExpiration(wKey, delayMillis);
+    else
+      expirationSet = rC.setExpiration(wKey, delayMillis);
+
+    if (expirationSet)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
+  }
+
+  protected boolean timeUnitMillis() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.EXPIREAT;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java
new file mode 100644
index 0000000..80866f9
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/ExpireExecutor.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.Extendable;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.RegionProvider;
+
+import java.util.List;
+
+public class ExpireExecutor extends AbstractExecutor implements Extendable {
+
+  private final String ERROR_SECONDS_NOT_USABLE = "The number of seconds specified must be numeric";
+
+  private final int SECONDS_INDEX = 2;
+
+  private final int SET = 1;
+
+  private final int NOT_SET = 0;
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+
+    if (commandElems.size() < 3) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
+      return;
+    }
+    ByteArrayWrapper wKey = command.getKey();
+    RegionProvider rC = context.getRegionProvider();
+    byte[] delayByteArray = commandElems.get(SECONDS_INDEX);
+    long delay;
+    try {
+      delay = Coder.bytesToLong(delayByteArray);
+    } catch (NumberFormatException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_USABLE));
+      return;
+    }
+
+    if (delay <= 0) {
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
+      return;
+    }
+
+    // If time unit given is not in millis convert to millis
+    if (!timeUnitMillis())
+      delay = delay * millisInSecond;
+
+    boolean expirationSet = false;
+
+    if (rC.hasExpiration(wKey))
+      expirationSet = rC.modifyExpiration(wKey, delay);
+    else
+      expirationSet = rC.setExpiration(wKey, delay);
+
+
+    if (expirationSet)
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
+    else
+      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
+  }
+
+  /*
+   * Overridden by PExpire
+   */
+  protected boolean timeUnitMillis() {
+    return false;
+  }
+
+  @Override
+  public String getArgsError() {
+    return ArityDef.EXPIRE;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java
new file mode 100644
index 0000000..90148ae
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/FlushAllExecutor.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.cache.EntryDestroyedException;
+import org.apache.geode.cache.UnsupportedOperationInTransactionException;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+
+import java.util.Map.Entry;
+
+public class FlushAllExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    if (context.hasTransaction())
+      throw new UnsupportedOperationInTransactionException();
+
+    for (Entry<String, RedisDataType> e : context.getRegionProvider().metaEntrySet()) {
+      try {
+        String skey = e.getKey();
+        RedisDataType type = e.getValue();
+        removeEntry(Coder.stringToByteWrapper(skey), type, context);
+      } catch (EntryDestroyedException e1) {
+        continue;
+      }
+
+    }
+
+    command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java
----------------------------------------------------------------------
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java
new file mode 100644
index 0000000..79ff5e2
--- /dev/null
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/KeysExecutor.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import org.apache.geode.redis.GeodeRedisServiceImpl;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.Command;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisConstants;
+import org.apache.geode.redis.internal.RedisConstants.ArityDef;
+import org.apache.geode.redis.internal.org.apache.hadoop.fs.GlobPattern;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class KeysExecutor extends AbstractExecutor {
+
+  @Override
+  public void executeCommand(Command command, ExecutionHandlerContext context) {
+    List<byte[]> commandElems = command.getProcessedCommand();
+    if (commandElems.size() < 2) {
+      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.KEYS));
+      return;
+    }
+
+    String glob = Coder.bytesToString(commandElems.get(1));
+    Set<String> allKeys = context.getRegionProvider().metaKeySet();
+    List<String> matchingKeys = new ArrayList<String>();
+
+    Pattern pattern;
+    try {
+      pattern = GlobPattern.compile(glob);
+    } catch (PatternSyntaxException e) {
+      command.setResponse(
+          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
+      return;
+    }
+
+    for (String key : allKeys) {
+      if (!(key.equals(GeodeRedisServiceImpl.REDIS_META_DATA_REGION)
+          || key.equals(GeodeRedisServiceImpl.STRING_REGION)
+          || key.equals(GeodeRedisServiceImpl.HLL_REGION)) && pattern.matcher(key).matches())
+        matchingKeys.add(key);
+    }
+
+    if (matchingKeys.isEmpty())
+      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
+    else
+      command.setResponse(
+          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), matchingKeys));
+
+
+  }
+}