简体   繁体   中英

newFixedThreadPool in asynchronous web services Jersey

Hello I tried to create a async web services following a tutorial. I'm not understand this statement:

service = MoreExecutors.listeningDecorator ( Executors.newFixedThreadPool (10) ) ;

What does that mean ? I can have 10 simultaneous requests ?

because I wanted to know when they get so many simultaneous requests as he works async web services ? there is a queue ?

Yes, you understand correctly, it means that there is a pool of 10 parallel threads that handles the requests. Usually there is 1 acceptor that takes the request and forward it to a handler (one of the 10 threads).

But, it doesnt mean that if you will have 100 requests they will be rejected. it just will take longer since they will go into the ThreadPool queue and wait untill there is a free thread to handle them

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM