mercredi 25 mars 2015

What's the best way to implement a real time show board to show results from concurrent result producers in Java?


I'm making a load test tool that launches multiple thread to simulate load on the target server. Each thread executes a predefined set of commands in the structure of TestSuite - TestCase- TestStep and each level returns results objects (of respective types). Each thread loops its predefined commands, so a series of TestSuite results are generated and it takes a while for all the loops to finish.


I'm trying to find the best way to show results generated in the still running threads. I've thought about a few possible ways:




  1. Use BlockingQueue and producer - consumer pattern. This requires heavy concurrency programming and I haven't been very clear on how I should handle different levels of results - suite results, case results and step results.




  2. Use a concurrent map to hold reference to results, and poll that map periodically to show what's available. This can be very inefficient. How do I just get the new results every time I poll?




  3. Develop a custom Log4J logger, so I can add appenders which will receive results on-the-fly. I haven't researched on how much work is involved if I use this approach. Is it even possible? Considering the level of result types it needs to handle.







Aucun commentaire:

Enregistrer un commentaire