title: Dynamic thread creation possible problems or safe approach
body: <p>I am using java for socket programming, I am using two dynamic thread sets </p>
  
  <h3>First for accepting client request... Creation of thread dynamically for each client</h3>
  
  <pre><code>try (ServerSocket listener = new ServerSocket(1000)) {
     while (true) {
     Socket socket = listener.accept();
     logger.debug(socket.getRemoteSocketAddress().toString() + " Has joined :::");
     new ThreadPool(socket).start();
    }
  }
  </code></pre>
  
  <h3>And second one is accepting client packets which they are sending and create new thread for parsing client data</h3>
  
  <pre><code>public void run() { // this run() in ThreadPool class
      while (true) {
      new parserThread();//creating new thread for parsing information
     }
  }
  </code></pre>
  
  <p>But my problem is after long time like 24 hr my application getting stuck and doesn't printing anything in console. I don't no why it's getting stuck but I have few doubts with my coding approach. Tell me whether those are the possibilities or not.</p>
  
  <p><ol>
  <li>Creating thread in another dynamic thread.</li>
  <li>Thread name allocation problem because it's increasing like :</p>
  
  <blockquote>
    <p>549790 [Thread-17569]<br>
    549791 [Thread-17570] <br>
    549792 [Thread-17571]</li>
    <li>Log4j console appender problem.</li>
    </ol>
    Please correct me if I am wrong. Is ExecutorService with CountDownLatch is better approach then that one ?Thank you very much </p>
  </blockquote>