How to use setThreadPool() in Jetty

前端 未结 2 1057
暗喜
暗喜 2021-01-23 04:10

I wanted to see how to use the setThreadPool() functionality. Let\'s say my main class is the following:

import javax.servlet.SingleThreadModel;
imp         


        
相关标签:
2条回答
  • 2021-01-23 04:21

    Here is an example:

    QueuedThreadPool threadPool = new QueuedThreadPool();
    threadPool.setMaxThreads(5);
    server.setThreadPool(threadPool);
    
    0 讨论(0)
  • 2021-01-23 04:24

    You can also use the following:

    server.setThreadPool(new ExecutorThreadPool(5, 10, 10, TimeUnit.SECONDS))
    
    0 讨论(0)
提交回复
热议问题