[jbossws-issues] [JBoss JIRA] Issue Comment Edited: (JBWS-2317) $JAXBAccessorF_ and $JAXBAccessorM_ cache loosing classes and failing to re-create classes.

Richard Kettelerij (JIRA) jira-events at lists.jboss.org
Mon May 30 09:33:01 EDT 2011


    [ https://issues.jboss.org/browse/JBWS-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605258#comment-12605258 ] 

Richard Kettelerij edited comment on JBWS-2317 at 5/30/11 9:32 AM:
-------------------------------------------------------------------

Thanks for the comment Alessio. Actually we're in the process of upgrading to JBoss 5.1.0 which ships JBossWS 3.1.2 and JAXB 2.1.9 out-of-the-box. It might take a while before we get to 3.4+ and be able to verify the behavior.

      was (Author: rkettelerij):
    Thanks for the comment Alessio. Actually we're in the process of upgrading to JBoss 5.1.0 which ships JBossWS 3.1.2 and JAXB 2.1.9 out-of-the-box. It might take awhile before we get to 3.4+ and be able to verify the behavior.
  
> $JAXBAccessorF_ and $JAXBAccessorM_ cache loosing classes and failing to re-create classes.
> -------------------------------------------------------------------------------------------
>
>                 Key: JBWS-2317
>                 URL: https://issues.jboss.org/browse/JBWS-2317
>             Project: JBoss Web Services
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: jbossws-metro, jbossws-native
>    Affects Versions:  jbossws-native-3.0.3,  jbossws-metro-3.0.3
>            Reporter: Darran Lofthouse
>            Assignee: Alessio Soldano
>         Attachments: Injector.java
>
>
> The JAXB implementation contains a package of classes to optimise field and method access by dynamically generating classes to avoid reflection, this has a start-up performance hit but then leads to an optimised runtime.
> The package is: -
>   'com.sun.xml.bind.v2.runtime.reflect.opt'
> Within the Injector class is a HashMap to maintain a cache of these classes against the classloader they were created for: -
> private static final Map<ClassLoader,WeakReference<Injector>> injectors =
>        Collections.synchronizedMap(new WeakHashMap<ClassLoader,WeakReference<Injector>>());
> A WeakReference has been used to wrap the value to prevent the value retaining a reference to the ClassLoader and then preventing garbage collection and leading to a leak.
> The problem is that nothing retains a reference to the Injector so as this is wrapped with a WeakReference it is garbage collected.
> I will attach to this case a new version of Injector.java.
> The fix switches to using a Strong reference to the Injector so it is not garbage collected.
> To maintain the original requirements the Injector will no longer hold a reference to the ClassLoader and will instead make use of the one passed in.  
> Within the Injector the HashMap of classes will reference the Class with a WeakReference.  If we get a WeakReference with no class it means the class was previously loaded but garbage collected, in this case try to load the class by name from the classloader - if this fails then redefine the class.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbossws-issues mailing list