Separate execution queues for one performer to track remaining

In my Jetty service, I have an endpoint that runs multiple threads to run. I am currently using ThreadExecutorPoolto execute my Runnables. But I want to know how many jobs are left for each individual request to the endpoint and allow multiple simultaneous requests.

My idea is to do something like a separate queue for each request and have my own executor who simply extracts from each queue cyclically. I am wondering if something like that exists that works out of the box.

Please note that I do not need the execution order. I take care that every request (that is, a session) is given equal time and that for each session I can find out how many threads have not yet started / completed.

So, I think MultiQueueExecutor or something like that?

+4
source share
1 answer

But I want to know how many jobs are left for each individual request to the endpoint and allow multiple simultaneous requests.

I would just use yours Futureaccordingly in conjunction with ExecutionCompletionService. If you use ECS, your web requests will be notified as soon as each of the tasks is completed so that they always know how many tasks are left to complete.

, ( ) , /.

, " " , , , FIFO. , , , , .

0

Source: https://habr.com/ru/post/1669760/


All Articles