dschneider-pivotal commented on a change in pull request #7080:
URL: https://github.com/apache/geode/pull/7080#discussion_r743419090



##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/RedisProperties.java
##########
@@ -16,38 +16,90 @@
 package org.apache.geode.redis.internal;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.logging.internal.log4j.api.LogService;
 
 public class RedisProperties {
-  /** System Property Names **/
-  public static final String REDIS_REGION_NAME_PROPERTY = 
"geode-for-redis-region-name";
-  public static final String WRITE_TIMEOUT_SECONDS = 
"geode-for-redis-write-timeout-seconds";
-  public static final String EXPIRATION_INTERVAL_SECONDS =
-      "geode-for-redis-expiration-interval-seconds";
+  private static final Logger logger = LogService.getLogger();
+
+  private static final String PREFIX = "geode.geode-for-redis-";
+  public static final String REDIS_REGION_NAME_PROPERTY = PREFIX + 
"region-name";
+  public static final String WRITE_TIMEOUT_SECONDS = PREFIX + 
"write-timeout-seconds";
+  public static final String EXPIRATION_INTERVAL_SECONDS = PREFIX + 
"expiration-interval-seconds";
+  public static final String REGION_BUCKETS = PREFIX + "region-buckets";
+  public static final String UNAUTHENTICATED_MAX_ARRAY_SIZE =
+      PREFIX + "unauthenticated-max-array-size";
+  public static final String UNAUTHENTICATED_MAX_BULK_STRING_LENGTH =
+      PREFIX + "unauthenticated-max-bulk-string-length";
+
+
+  private static String convertToGemfire(String geodeName) {
+    return "gemfire." + geodeName.substring("geode.".length());
+  }
+
+  private static void validatePropertyName(String geodeName) {
+    if (!geodeName.startsWith(PREFIX)) {
+      throw new IllegalStateException("Property names must start with \"" + 
PREFIX + "\"");
+    }
+  }
 
   public static String getStringSystemProperty(String propName, String 
defaultValue) {
-    String geodeValue = System.getProperty("geode." + propName, defaultValue);
-    String gemfireValue = System.getProperty("gemfire." + propName, 
defaultValue);
+    validatePropertyName(propName);
 
+    String geodeValue = System.getProperty(propName, defaultValue);
     if (StringUtils.isNotEmpty(geodeValue) && 
!geodeValue.equals(defaultValue)) {

Review comment:
       Are you suggesting that it should use System.getProperty(propName) 
instead of System.getProperty(propName, defaultValue)? I think that it is a 
good idea since it is simpler and since we never end up using geodeValue if it 
is defaultValue. 

##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/netty/ByteToCommandDecoder.java
##########
@@ -51,16 +53,16 @@
 public class ByteToCommandDecoder extends ByteToMessageDecoder {
 
   public static final String UNAUTHENTICATED_MAX_ARRAY_SIZE_PARAM =
-      "gemfire.geode-for-redis-unauthenticated-max-array-size";
+      RedisProperties.UNAUTHENTICATED_MAX_ARRAY_SIZE;
   public static final String UNAUTHENTICATED_MAX_BULK_STRING_LENGTH_PARAM =
-      "gemfire.geode-for-redis-unauthenticated-max-bulk-string-length";
+      RedisProperties.UNAUTHENTICATED_MAX_BULK_STRING_LENGTH;
 
   private static final int MAX_BULK_STRING_LENGTH = 512 * 1024 * 1024; // 512 
MB
   // These 2 defaults are taken from native Redis
   public static final int UNAUTHENTICATED_MAX_ARRAY_SIZE =
-      Integer.getInteger(UNAUTHENTICATED_MAX_ARRAY_SIZE_PARAM, 10);
+      getIntegerSystemProperty(UNAUTHENTICATED_MAX_ARRAY_SIZE_PARAM, 10, 1);
   public static final int UNAUTHENTICATED_MAX_BULK_STRING_LENGTH =
-      Integer.getInteger(UNAUTHENTICATED_MAX_BULK_STRING_LENGTH_PARAM, 16384);
+      getIntegerSystemProperty(UNAUTHENTICATED_MAX_BULK_STRING_LENGTH_PARAM, 
16384, 1);

Review comment:
       They could. At the time I didn't because they are public and I worried 
that they were used outside of the geode code base. But they probably are not 
so I'll try getting rid of them.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to