Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to try Project Loom and would Project Loom replace Threads in java.net.Serve  (Read 70993 times)

0 Members and 1 Guest are viewing this topic.

jenit739

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Windows 10
    Hi
    Scalability is OS-dependent as ServerSocket that handle multiple connections use Threads. In websocket, you would need 1 thread for 1 connection. In other words, scalability is bad if you use IO ServerSocket. Therefore, I believe most people would use NIO for the WebSocket server, but maybe stick with IO for HTTP server.
    What do you think? Would porting to virtual threads e.g this snippet of code will be easy? `SessionHandler implements Runnable`.

    ```

    SessionHandler handler = new SessionHandler(socket);

    new Thread(handler).start();