title: how to accept a socket without setting a thread on it in java?
body: <p>How can I create a server which accept entered sockets and than enter them into a queue (wihout setting a thread on each one of them)?</p>
  
  <p>here is a code of regular multithread (here you create thread per a socket, but I want that each socket which I accept, will enter the queue, without creating thread per a socket):</p>
  
  <pre><code>public class MultiThreadedServer implements Runnable{
  
      int          serverPort   = 10000;
      ServerSocket serverSocket = null;
  
      public MultiThreadedServer(int port){
          this.serverPort = port;
      }
  
      public void run(){
  
           try {
              this.serverSocket = new ServerSocket(this.serverPort);
          } catch (IOException e) {
              throw new RuntimeException("Cannot open port 10000", e);
          }
          while(true){
              Socket clientSocket = null;
              try {
                  clientSocket = this.serverSocket.accept();
              } catch (IOException e) {
                  throw new RuntimeException(
                      "Error accepting client connection", e);
              }
              new Thread(new WorkerRunnable( clientSocket, "Multithreaded Server")).start();
          }
      }
  </code></pre>
  
  <p>thank you</p>