[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] JBoss support/ClassLoaderFactory

Peter Antman wrote:
I have done a first round of updates to the j2ee (JBoss) support that I
would like to commit. However, to get it to work I had to abstract the
way XMlBlaster handles the ClassLoaderFactory.

Basically I have done this:
Made ClassLoaderFactory and intercace:

public interface ClassLoaderFactory {
   public void init(Global glob);
   public URLClassLoader getPluginClassLoader(PluginInfo pluginInfo)
throws XmlBlasterException;
   public URLClassLoader getXmlBlasterClassLoader() throws

Moved the old implementation to StandaloneClassLoaderFactory. Created an
aditional factory: ContextClassLoaderFactory, which used returnes the
context class loader.

Which factory to use is now configurable with the property
classLoaderFactory. Here's the new method in Global:

public ClassLoaderFactory getClassLoaderFactory() {
      boolean usemlBlasterClassloader =
getProperty().get("usemlBlasterClassloader", true);
      if (usemlBlasterClassloader == false) return null;

synchronized (ClassLoaderFactory.class) {
if (classLoaderFactory == null) {
String clf =
if ( clf != null) {
try {
Class clfc =
classLoaderFactory =
return classLoaderFactory;
} catch (Exception e) {
log.warn(ME,"Could not load custom classLoaderFactory
" + clf + " using StandaloneClassLoaderFactory");
} // end of try-catch
} // end of if ()
classLoaderFactory = new StandaloneClassLoaderFactory(this);
return classLoaderFactory;

Basically I am wondering if this is an ok change to check in, or if you
would like it done in a different way?


i think this is a good way to go.
Could you please update the outdated classloader requirements as well
(probably merge the 3 reqs to one) and add a note to xmlBlaster/CHANGES?