You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2020/10/22 14:46:11 UTC
[geode] branch develop updated: GEODE-8636: Remove hard-coded value
from String in NettyRedisServer (#5621)
This is an automated email from the ASF dual-hosted git repository.
jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 08e4e9a GEODE-8636: Remove hard-coded value from String in NettyRedisServer (#5621)
08e4e9a is described below
commit 08e4e9acedf0aa157c79ff06feda364b443359e2
Author: John Hutchison <jh...@gmail.com>
AuthorDate: Thu Oct 22 10:45:17 2020 -0400
GEODE-8636: Remove hard-coded value from String in NettyRedisServer (#5621)
Authored-by: john Hutchison <hu...@vmware.com>
---
.../redis/internal/netty/NettyRedisServer.java | 25 +++++++++++++---------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/netty/NettyRedisServer.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/netty/NettyRedisServer.java
index adea25f..f93de64 100644
--- a/geode-redis/src/main/java/org/apache/geode/redis/internal/netty/NettyRedisServer.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/netty/NettyRedisServer.java
@@ -98,12 +98,16 @@ public class NettyRedisServer {
this.shutdownInvoker = shutdownInvoker;
this.redisStats = redisStats;
this.backgroundExecutor = backgroundExecutor;
+
if (port < RANDOM_PORT_INDICATOR) {
- throw new IllegalArgumentException("Redis port cannot be less than 0");
+ throw new IllegalArgumentException(
+ "Redis port cannot be less than " + RANDOM_PORT_INDICATOR);
}
+
selectorGroup = createEventLoopGroup("Selector", true, 1);
workerGroup = createEventLoopGroup("Worker", true, 0);
subscriberGroup = createEventLoopGroup("Subscriber", true, 0);
+
try {
this.bindAddress = getBindAddress(requestedAddress);
serverChannel = createChannel(port);
@@ -116,15 +120,16 @@ public class NettyRedisServer {
}
private Channel createChannel(int port) {
- ServerBootstrap serverBootstrap = new ServerBootstrap();
-
- serverBootstrap.group(selectorGroup, workerGroup).channel(NioServerSocketChannel.class)
- .childHandler(createChannelInitializer())
- .option(ChannelOption.SO_REUSEADDR, true)
- .option(ChannelOption.SO_RCVBUF, getBufferSize())
- .childOption(ChannelOption.SO_KEEPALIVE, true)
- .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS)
- .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
+ ServerBootstrap serverBootstrap =
+ new ServerBootstrap()
+ .group(selectorGroup, workerGroup)
+ .channel(NioServerSocketChannel.class)
+ .childHandler(createChannelInitializer())
+ .option(ChannelOption.SO_REUSEADDR, true)
+ .option(ChannelOption.SO_RCVBUF, getBufferSize())
+ .childOption(ChannelOption.SO_KEEPALIVE, true)
+ .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS)
+ .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
return createBoundChannel(serverBootstrap, port);
}