I have a big web-app, this web-app uses a master ThreadPoolExecutor based class (named MasterExecutor) to run some heavy processes.
The MasterExecutor class has a method that prints out statistics (a method named 'printStats' that returns an String) of the work load of its threads. This stats are printed to logs upon thread execution, but we need to have a webpage that prints that information upon user request, that means, to monitor the MasterExecutor upon request.
Now, I wrote a JSP with reflection that is able to create an instance of the MasterExecutor and calls the 'printStats' method, however it prints the state of a new MasterExecutor instance:
How can I get the main and only instance of the web-app "MasterExecutor" running in tomcat with reflection?