carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvramana <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #656: [CARBONDATA-773] Fixed multiple Dict...
Date Mon, 10 Apr 2017 12:03:52 GMT
Github user gvramana commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/656#discussion_r106593774
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/dictionary/server/DictionaryServer.java
---
    @@ -43,42 +43,71 @@
     
       private EventLoopGroup boss;
       private EventLoopGroup worker;
    +  private int port;
    +  private static DictionaryServer INSTANCE = null;
    +
    +  private DictionaryServer(int port) {
    +    startServer(port);
    +  }
    +
    +  public static DictionaryServer getInstance(int port) {
    +    if (INSTANCE == null) {
    +      INSTANCE = new DictionaryServer(port);
    +    }
    +    return INSTANCE;
    +  }
     
       /**
        * start dictionary server
        *
        * @param port
        * @throws Exception
        */
    -  public void startServer(int port) {
    -    long start = System.currentTimeMillis();
    +  private void startServer(int port) {
         dictionaryServerHandler = new DictionaryServerHandler();
         boss = new NioEventLoopGroup();
         worker = new NioEventLoopGroup();
         // Configure the server.
    +    this.port = bindToPort(port, 0);
    +  }
    +
    +  private int bindToPort(int port, int retries) {
    +    long start = System.currentTimeMillis();
    --- End diff --
    
    No need for recursion, directly use loop


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message