Github user ManoharVanam commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1662#discussion_r157157194
--- Diff:
core/src/main/java/org/apache/carbondata/core/dictionary/server/NonSecureDictionaryServer.java
---
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.carbondata.core.dictionary.server;
+
+import java.net.InetSocketAddress;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import
org.apache.carbondata.core.dictionary.generator.key.DictionaryMessage;
+import
org.apache.carbondata.core.dictionary.generator.key.DictionaryMessageType;
+import
org.apache.carbondata.core.dictionary.service.AbstractDictionaryServer;
+import org.apache.carbondata.core.metadata.schema.table.CarbonTable;
+import org.apache.carbondata.core.util.CarbonProperties;
+
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
+
+/**
+ * Dictionary Server to generate dictionary keys.
+ */
+public class NonSecureDictionaryServer extends AbstractDictionaryServer
+ implements DictionaryServer {
+
+ private static final LogService LOGGER =
+
LogServiceFactory.getLogService(NonSecureDictionaryServer.class.getName());
+
+ private NonSecureDictionaryServerHandler
nonSecureDictionaryServerHandler;
+
+ private EventLoopGroup boss;
+ private EventLoopGroup worker;
+ private int port;
+ private String host;
+ private static Object lock = new Object();
+ private static NonSecureDictionaryServer INSTANCE = null;
+
+ private NonSecureDictionaryServer(int port) {
+ this.port = port;
+ startServer();
+ }
+
+ public static synchronized DictionaryServer getInstance(int port,
CarbonTable carbonTable)
+ throws Exception {
+ if (INSTANCE == null) {
+ INSTANCE = new NonSecureDictionaryServer(port);
+ }
+ INSTANCE.initializeDictionaryGenerator(carbonTable);
--- End diff --
INSTANCE.initializeDictionaryGenerator(carbonTable); is this statement
required to be in synchronized method?
---