Examples of ScopedClassPool


Examples of org.jboss.classpool.scoped.ScopedClassPool

  
  
  
   public ClassPool registerClassLoader(ClassLoader classLoader)
   {
      ScopedClassPool classPool = (ScopedClassPool) successor.registerClassLoader(classLoader);
      if (classPool == null)
      {
         // TODO check this works; was delegate before
         successor.unregisterClassLoader(classLoader);
      }
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

   }
  

   public void unregisterClassLoader(ClassLoader classLoader, Module module)
   {
      ScopedClassPool classPool = registeredModules.remove(module);
      if (classLoader == null)
      {
         if (classPool == null)
         {
            //throw new IllegalStateException("Module " + module + " is not registered");
            //TODO JBREFLECT-116
           if (log.isDebugEnabled())
              log.warn("Module " + module + " is not registered");
           return;
         }
         classPool.close();
      }
      else
      {
         unregisterClassLoader(classLoader);
      }
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

               return false;
            }
         }
         else
         {
            ScopedClassPool pool = (ScopedClassPool) getRegisteredClassPool(advisor.getClassLoader());
            if (pool == null) return false;
            if (pool.isUnloadedClassLoader())
            {
               unregisterClassLoader(advisor.getClassLoader());
               return false;
            }
            else
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

      Collections.synchronizedMap(new WeakHashMap<Module, ScopedClassPool>());
  
   @Override
   public ClassPool registerClassLoader(ClassLoader classLoader)
   {
      ScopedClassPool classPool = (ScopedClassPool) super.registerClassLoader(classLoader);
      if (classPool == null)
      {
         // TODO check this works; was delegate before
         super.unregisterClassLoader(classLoader);
      }
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

   }
  

   public void unregisterClassLoader(ClassLoader classLoader, Module module)
   {
      ScopedClassPool classPool = registeredModules.remove(module);
      if (classLoader == null)
      {
         if (classPool == null)
         {
            throw new IllegalStateException("Module " + module + " is not registered");
         }
         classPool.close();
      }
      else
      {
         unregisterClassLoader(classLoader);
      }
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

               return false;
            }
         }
         else
         {
            ScopedClassPool pool = (ScopedClassPool) getRegisteredClassPool(advisor.getClassLoader());
            if (pool == null) return false;
            if (pool.isUnloadedClassLoader())
            {
               unregisterClassLoader(advisor.getClassLoader());
               return false;
            }
            else
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

       {
          if (manager.isNonAdvisableClassName(className))
          {
             return null;
          }
          ScopedClassPool pool = (ScopedClassPool) ClassPoolRepository.getInstance().registerClassLoader(loader);
          CtClass clazz = null;
          try
          {
             clazz = pool.getLocally(className);
          }
          catch (NotFoundException e)
          {
             // todo Bill Burke: this scares the shit out of me, but it must be done
             // I think it will screw up hotdeployment at some time.  Then again, maybe not ;)
             ByteArrayClassPath cp = new ByteArrayClassPath(className, classfileBuffer);
             pool.insertClassPath(cp);
             clazz = pool.getLocally(className);
          }
          if (clazz.isArray())
          {
             if (verbose && logger.isDebugEnabled()) logger.debug("cannot compile, isArray: " + className);
             pool.flushClass(className);
             return null;
          }
          if (clazz.isInterface())
          {
             if (verbose && logger.isDebugEnabled()) logger.debug("cannot compile, isInterface: " + className);
             pool.flushClass(className);
             return null;
          }
          if (clazz.isFrozen())
          {
             if (verbose && logger.isDebugEnabled()) logger.debug("warning, isFrozen: " + className);
             clazz.defrost();
          }

          ClassAdvisor advisor = AdvisorFactory.getClassAdvisor(clazz, manager);
          Instrumentor instrumentor = InstrumentorFactory.getInstrumentor(
                pool,
                manager,
                manager.dynamicStrategy.getJoinpointClassifier(),
                manager.dynamicStrategy.getDynamicTransformationObserver(clazz));

          if (!Instrumentor.isTransformable(clazz))
          {
             if (verbose && logger.isDebugEnabled()) logger.debug("[cannot compile] implements Untransformable: " + className);
             pool.flushClass(className);
             return null;
          }

          manager.attachMetaData(advisor, clazz, true);
          manager.applyInterfaceIntroductions(advisor, clazz);
          boolean transformed = instrumentor.transform(clazz, advisor);
          if (transformed)
          {
             pool.lockInCache(clazz);
             if (AspectManager.debugClasses)
             {
                SecurityActions.debugWriteFile(clazz);
             }

             byte[] rtn = clazz.toBytecode();
             if (AspectManager.getPrune()) clazz.prune();
             return rtn;
          }
          else
          {
             pool.soften(clazz);
          }
          return null;
       }
       catch (Exception ex)
       {
View Full Code Here

Examples of org.jboss.classpool.scoped.ScopedClassPool

         if (manager.isNonAdvisableClassName(className))
         {
            return null;
         }

         ScopedClassPool pool = (ScopedClassPool) ClassPoolRepository.getInstance().registerClassLoader(loader);

         CtClass clazz = obtainCtClassInfo(pool, className, classfileBuffer);
        
         CtClass woven = instrumentClass(manager, pool, clazz, true);
         if (woven != null)
         {
            pool.lockInCache(woven);
            if (AspectManager.debugClasses)
            {
               SecurityActions.debugWriteFile(clazz);
            }
            byte[] rtn = woven.toBytecode();
            if (AspectManager.getPrune()) woven.prune();
            return rtn;
         }
         else
         {
            pool.soften(clazz);
         }
         return null;
      }
      catch (Exception ex)
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.