Can Java use only one thread to process the user's request, and several worker threads to do IO, simulation node?

  1. when it comes to the high concurrency advantages of Node, event-based, non-blocking IO is always mentioned, so here"s the problem.
    can Java use only one thread to process the user"s request, and can several worker threads do IO, to simulate node?
  2. in addition, some articles on Java concurrency will use NIO to deal with concurrency. Although NIO is non-blocking, each request on the client side is still a separate thread. Instead of suspending a NIO to do something else, it will still block new tasks such as waiting for NIO to complete the request and then go to the thread pool. Where is NIO"s help for Java concurrency? Or is my understanding of NIO wrong?

if you just want to achieve one worker thread + n io threads, either blocking or non-blocking can be done.

Menu