According to the Sun’s documentation on ServerSocket:
The maximum queue length for incoming connection indications (a request to connect) is set to 50. If a connection indication arrives when the queue is full, the connection is refused.
How can I increase the the queue length? It’s my server’s bottle-neck.
Thank you.
Use the ServerSocket constructor with the
backlogparameter.You may also want to consider using a Thread pool (or really an ExecutorService) to dispatch incoming requests. Depending on how you architect it, this will generally lead to better throughput.