You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Ivan <xh...@gmail.com> on 2013/06/20 18:08:11 UTC

Simplify classloading for asm classes in ASMHelper

Hi,

Now, CXF uses ASMHelper to dynamicly detect the asm class source, in the
initialization, it will try to load the all the asm writer candidate.

In the future invocation for createLable/getType, now, the codes will use
ClassLoaderUtils to load the expected classes based on the current asm
writer. I am thinking that we could simplify the loading strategy, just use
:

cwClass.getClassLoader().loadClass(cwClass.getPackage().getName() +
".Label"); //Think no need to consider the getClassLoader() will return
null for cwClass is loaded by system classloader

As since we have saved the asm writer class, we should always use the
classloader load asm writer to load those type/lable classes, this would be
applicable for both traidional java ee and OSGi environment. with the
classloaderUtils, we will try the context classloader, invoker classloader
and then calling classloader. In most scenarios, it looked like we could
avoid the first two steps, as CXF should always use the type/label class
loaded by cwClass (Think it is not correct to load those classes with
context classloader, as it may cause class violation in some rare
scenarios, e.g. context classloader could see another copy of asm).


I understood that it may not a big issue, while it will be better that we
could improve this, it is mostly useful in an OSGi based application
server, as those ASM classes may not be visible to the app classloader.

Thoughts ?

-- 
Ivan