[jboss-dev-forums] [Design of JBoss jBPM] - Re: jBPM Classloading

bwand do-not-reply at jboss.com
Tue Feb 26 12:26:40 EST 2008


The code looks like this:
 

  | public static final String JBPM_CLASSLOADER = "jbpm.classloader";
  | public static final String JBPM_CLASSLOADER_CLASSNAME = "jbpm.classloader.classname";
  | 
  | ...
  | 
  | public static ClassLoader getClassLoader() {
  |     if (System.getProperty(JBPM_CLASSLOADER).equals("jbpm")) {
  |         return ClassLoaderUtil.class.getClassLoader();
  |     } else if (System.getProperty(JBPM_CLASSLOADER).equals("context")) {
  |         return Thread.currentThread().getContextClassLoader();
  |     } else if (System.getProperty(JBPM_CLASSLOADER).equals("custom")) {
  |         try {
  |             String customClassLoaderClassName = System.getProperty(JBPM_CLASSLOADER_CLASSNAME);
  |             if (customClassLoaderClassName == null) {
  |                 throw new JbpmException(
  |                         "'jbpm.classloader' system property set to 'custom' but 'jbpm.classloader.classname' is empty!");
  |             }
  |             return (ClassLoader) Thread.currentThread().getContextClassLoader().loadClass(
  |                     customClassLoaderClassName).newInstance();
  |         } catch (InstantiationException e) {
  |             throw new JbpmException("Error instantiating custom classloader "
  |                     + System.getProperty(JBPM_CLASSLOADER_CLASSNAME), e);
  |         } catch (IllegalAccessException e) {
  |             throw new JbpmException("Error accessing custom classloader "
  |                     + System.getProperty(JBPM_CLASSLOADER_CLASSNAME), e);
  |         } catch (ClassNotFoundException e) {
  |             throw new JbpmException("Custom classloader "
  |                     + System.getProperty(JBPM_CLASSLOADER_CLASSNAME) + " not found ", e);
  |         }
  |     } else {
  |         return ClassLoaderUtil.class.getClassLoader();
  |     }
  | }
  |   
 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132264#4132264

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132264



More information about the jboss-dev-forums mailing list