-
1. Re: Add getCachedType(Class) to PojoCacheMBean?
manik May 23, 2006 11:28 AM (in response to brian.stansberry)I don't have a problem with this, but I'd wait for comment from Ben first ...
-
2. Re: Add getCachedType(Class) to PojoCacheMBean?
ben.wang May 23, 2006 7:44 PM (in response to brian.stansberry)CachedType in theory should be internal. But I guess in this case, we will have to then. Can you create a Jira for 1.4? I will add it next week.
-
3. Re: Add getCachedType(Class) to PojoCacheMBean?
brian.stansberry May 23, 2006 8:19 PM (in response to brian.stansberry)http://jira.jboss.com/jira/browse/JBCACHE-628
From very briefly looking at it, it seems that what the use of getCachedType() is fundamentally doing for us in JBossCacheService is:
1) Analyzing the fields of the entire class hierarchy
2) avoiding adding the session as an Observer to static/transient/final fields in the Pojo.
3) Caching the results of the analysis so it doesn't have to be done again.
Theoretically that could be done in JBossCacheService itself, although it's ugly.
BTW, I believe the cachedTypes WeakHashMap in PojoCache will leak Classloaders. The Class is the key, so that is held in a WeakReference -- no problem there. But the value CachedType also has a reference to the Class, and the value in WeakHashMap is held with a strong reference. That chain of strong references will prevent GC of the Class and thus of the Classloader. -
4. Re: Add getCachedType(Class) to PojoCacheMBean?
ben.wang May 24, 2006 7:11 PM (in response to brian.stansberry)Brian, good catch. Maybe I should turn the CachedType Class reference into weak one. Will fix it and have Clebert review it.