Open oskar-szwajkowski opened 2 weeks ago
This can result in memory leaks in the case of objects being exported dynamically (via MBeanExporter), as the caches will never be cleaned up and the classes referenced by the caches will never be garbage collected.
Then I don't see a way of creating such cache without introducing 'small' memory leak, that would have positive impact on CPU time / memory needed to go over those JMX annotated classes
other options could be:
context
object as param to all those static methods and pass it, so the cache could be local not staticThreadLocal
, this way its also not needed to be staticthoughts?
Utilize static caches for reflection computations that are specific to classes, which do not change between classloaders
This should improve CPU and memory usage of applications that repeatedly use MBeanBuilders, and should have tiny memory footprint for caches itself