Question

At the moment I have a server that:

1) Launches 100 servlet requests using an executor on localhost

2) Executes the servlet requests.

3) Decrements a latch counting the total amount of completed servlets.

4) Calculates the execution time.

I would like to move point 1, 3 and 4 on another "client" machine.

So my client should send 100 requests to the server's servlet, wait for all responses (maybe using a remote latch?) and then calculate execution time.

How can I achieve this result?

Was it helpful?

Solution

If you use a ThreadPoolExecutor and issue a shutdown() after supplying it with the 100 requests, won't the workQueue function as the latch? You can awaitTermination() to calculate the total execution time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top