Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top