title: Java thread pool - is thread getting renewed?
body: <p>I have a Thread pool in my Java.NIO socket server.
  I sometimes received runtime errors like <code>Connection reset by peer</code> or <code>Broken Pipe</code>, etc.</p>
  
  <p>My question is: is the thread getting killed when an exception is thrown? If it is - is a new thread created in the thread pool in place of the killed thread??</p>
  
  <p>This is my ThreadManager:</p>
  
  <pre><code>import java.nio.channels.SocketChannel;
  import java.util.concurrent.ExecutorService;
  import java.util.concurrent.Executors;
  
  
  public class ThreadsManager {
  
      private ExecutorService threadPool = null;
      private LiveConnectionsManager liveConnectionsManager;
      private int threadPoolSize = 35; //number of tasks thread
  
      public ThreadsManager(LiveConnectionsManager liveConnectionsManager) {
          this.liveConnectionsManager = liveConnectionsManager;
          threadPool = Executors.newFixedThreadPool(threadPoolSize);
          ServerActions.threadPool = threadPool;
      }
  
      public void processNewMessage(SocketChannel socketChannel, Client client)
      {
          threadPool.execute(new MessagesProcessor(socketChannel, client, liveConnectionsManager));
      }
  
      public void closeConnection(SocketChannel socketChannel, Client client) {
          threadPool.execute(new LogoutClient(socketChannel, client, null));
      }   
  }
  </code></pre>