me0wster / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

spring hits set incorrectly if spring not initted as listener #242

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. set up spring to initialize after javamelody (i.e. as a servlet, not 
listener)
2. use spring bean monitoring. create some spring hits. (say there are n global 
hits)
3. restart the server and go to /monitoring page. spring global hits will be 
set incorrectly (usually to n + (n * #restarts) global hits)

Also attached is a eclipse/maven project that can reproduce this.

I think the problem is that at the time javamelody initializes, it thinks 
spring monitoring is not used/displayed because spring has not yet been 
initialized. Therefore, things that need to be collected during initialization 
is not done. 

In particular, I think the problem revolves around 
n.b.j.Collector.firstCollectDone and SPRING_COUNTER.isDisplayed()

Javamelody should preferably be able to handle such a spring setup, or at least 
document a warning to users to initialize spring before javamelody.

Original issue reported on code.google.com by maxxe...@gmail.com on 10 Aug 2012 at 6:48

Attachments:

GoogleCodeExporter commented 9 years ago
Good catch! Thanks for the issue.

It is now fixed in trunk (revision 3097) and ready for the next release (1.42).
I have made a new build from the current trunk, including the fix, and it is 
available at:
http://javamelody.googlecode.com/files/javamelody-20121028.jar

Original comment by evernat@free.fr on 27 Oct 2012 at 9:44