Package com.caucho.loader

Examples of com.caucho.loader.DynamicClassLoader


   * changed, return null.
   */
  public Class<?> loadClass(String fullClassName, boolean preload)
    throws ClassNotFoundException
  {
    DynamicClassLoader preloadLoader = null;
   
    try {
      ClassLoader loader;

      if (preload) {
        preloadLoader = SimpleLoader.create(getPreloadLoader(),
                                            getWorkDir(),
                                            fullClassName);
        // needed for cases like Amber enhancing
        preloadLoader.setServletHack(true);
        loader = preloadLoader;
      }
      else {
        // XXX: because of automatic instantiation, might cause trouble
        loader = getClassLoader();

        if (loader == null) {
          loader = SimpleLoader.create(getParentLoader(),
                                       getWorkDir(),
                                       fullClassName);
        }
      }

      Class<?> cl = Class.forName(fullClassName, false, loader);

      if (cl == null)
        return null;
     
      if (! preload)
        return cl;

      if (isModified(cl)) {
        return null;
      }

      if (_loader != null)
        loader = _loader;
      else {
        loader = SimpleLoader.create(getParentLoader(),
                                     getWorkDir(),
                                     fullClassName);
      }

      cl = Class.forName(fullClassName, false, loader);

      return cl;
    } catch (RuntimeException e) {
      if (! preload)
        throw e;
      else {
        log.log(Level.FINE, e.toString(), e);
       
        return null;
      }
    } catch (Error e) {
      if (! preload)
        throw e;
      else {
        log.log(Level.FINE, e.toString(), e);
     
        return null;
      }
    } catch (ClassNotFoundException e) {
      if (! preload)
        throw e;
      else
        return null;
    } finally {
      if (preloadLoader != null)
        preloadLoader.destroy();
    }
  }
View Full Code Here


  {
    if (isClassMatch(className)) {
      try {
        ClassLoader tempLoader
          = ((DynamicClassLoader) loader).getNewTempClassLoader();
        DynamicClassLoader workLoader
          = SimpleLoader.create(tempLoader, getPostWorkPath());
        workLoader.setServletHack(true);
        boolean isModified = true;

        Thread thread = Thread.currentThread();
        ClassLoader oldLoader = thread.getContextClassLoader();
View Full Code Here

TOP

Related Classes of com.caucho.loader.DynamicClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.