There's a serversocket handling incoming request on a per
thread basis. Each request is assigned a new Thread by submitting to the ExecutorService.
For argument sake say I create a ExecutorSevice with pool size 1. Executors.newFixedThreadPool(1). I submit all the incoming request to this.
Now the first request comes in and gets submitted to the Thread pool. During execution of this thread this calls the ServerSocket again. This is the portion
of the server code
When the server receives the second request, it tries to create another runnable object and submit it to the Thread Pool. But since the thread pool size is 1 this new thread never gets a chance to run.
And the first thread which initiated the process is still waiting for this thread to complete. Essentially there is a deadlock.
This is similar to a client calling a remote
EJB which in turn will call another remote EJB in the same server.
Is there some way to get rid of this situation