Package org.jboss.mx.loading

Examples of org.jboss.mx.loading.LoaderRepository


         System.out.println("POJO CLASSLOADER " + POJO.class.getClassLoader());
  
         if (getClass().getClassLoader() instanceof RepositoryClassLoader)
         {
            //Check that the classloaders have the same repositories
            LoaderRepository repository1 = ((RepositoryClassLoader)getClass().getClassLoader()).getLoaderRepository();
            LoaderRepository repository2 = ((RepositoryClassLoader)ScopedInterceptor.class.getClassLoader()).getLoaderRepository();
            LoaderRepository repository3 = ((RepositoryClassLoader)POJO.class.getClassLoader()).getLoaderRepository();
            if (repository1 != repository2)
            {
               throw new RuntimeException("Repositories were not the same");
            }
            if (repository1 != repository3)
View Full Code Here


               log.debug("searching repository " + name);
              
               try
               {
                  Object o =  server.getAttribute(name, "Instance");
                  LoaderRepository repository = (LoaderRepository) o;
                  Class c = repository.loadClass(className);
                  if (c == null)
                  {
                     continue;
                  }
                  log.debug("found class in repository " + name);
View Full Code Here

   public static boolean isScopedClassLoader(ClassLoader loader)
   {
      boolean scoped = false;
      if (loader instanceof RepositoryClassLoader)
      {
         LoaderRepository repository = ((RepositoryClassLoader)loader).getLoaderRepository();
         if (repository instanceof HeirarchicalLoaderRepository3)
         {
            scoped = true;
            //HeirarchicalLoaderRepository3 hlr = (HeirarchicalLoaderRepository3)repository;
            //boolean parentFirst = hlr.getUseParentFirst();
View Full Code Here

      return new NonDelegatingClassPool(cl, parent, repository, true);
   }

   private ClassPoolDomain getDomain(RepositoryClassLoader cl)
   {
      LoaderRepository loaderRepository = cl.getLoaderRepository();
      ClassPoolDomainRegistry registry = ClassPoolDomainRegistry.getInstance();
      ClassPoolDomain domain = registry.getDomain(loaderRepository);
      if (domain == null)
      {
         if (loaderRepository instanceof HeirarchicalLoaderRepository3)
View Full Code Here

   public ScopedJBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
   {
      super(cl, src, repository, tmp, tmpURL);
     
      boolean parentFirst = false;
      LoaderRepository loaderRepository = null;
      ClassLoader prnt = cl;
      while (prnt != null)
      {
         if (prnt instanceof RepositoryClassLoader)
         {
View Full Code Here

      if (ScopedRepositoryClassLoaderHelper.isScopedClassLoader(di.ucl))
      {
         return di.ucl;
      }

      LoaderRepository attachToRepository = getLoaderRepositoryIfAttaching(di, docUrl);
      if (attachToRepository != null)
      {
         di.ucl.setRepository(attachToRepository);
         attachToRepository.addClassLoader(di.ucl);
         return di.ucl;
      }
      return null;
   }
View Full Code Here

                  catch (InstanceNotFoundException e)
                  {
                     log.warn("No scoped loader repository exists with the name " + on);
                  }

                  LoaderRepository repository = (LoaderRepository)server.getAttribute(on, "Instance");
                  if (repository instanceof HeirarchicalLoaderRepository3)
                  {
                     return repository;
                  }
                  else
View Full Code Here

         if (Arrays.asList(getURLs()).contains(url))
            return;

         // since we don't have the URLs til getMBeansFromURL() is called we
         // need to add these UCLs late, after the MBean registration
         LoaderRepository ulr = LoaderRepository.getDefaultLoaderRepository();
         try
         {
            UnifiedClassLoader cl = ulr.newClassLoader(url, true);
            if (ucl == null)
               ucl = cl;

            // Keep track of the urls
            super.addURL(url);
View Full Code Here

      // NOTE:
      // the urls used here are relative to the location of the build.xml
      final URL url = new URL("file:./output/etc/test/implementation/loading/MyMBeans.jar");

      // Retrieve the loader repository
      LoaderRepository lr = LoaderRepository.getDefaultLoaderRepository();

      // Should not be able to load the class
      try
      {
         lr.loadClass("test.implementation.loading.support.Trivial");
         fail("test.implementation.loading.support.Trivial is already visible");
      }
      catch (ClassNotFoundException expected) {}

      // Add the URL to the repository twice
      UnifiedClassLoader ucl1 = lr.newClassLoader(url, true);
      UnifiedClassLoader ucl2 = lr.newClassLoader(url, true);

      // Should be able to load the class
      lr.loadClass("test.implementation.loading.support.Trivial");

      // Remove one
      ucl1.unregister();

      // Should still be able to load the class
      lr.loadClass("test.implementation.loading.support.Trivial");

      // Remove the other
      ucl2.unregister();
   }
View Full Code Here

         System.out.println("POJO CLASSLOADER " + POJO.class.getClassLoader());
  
         if (getClass().getClassLoader() instanceof RepositoryClassLoader)
         {
            //Check that the classloaders have the same repositories
            LoaderRepository repository1 = ((RepositoryClassLoader)getClass().getClassLoader()).getLoaderRepository();
            LoaderRepository repository2 = ((RepositoryClassLoader)ScopedInterceptor.class.getClassLoader()).getLoaderRepository();
            LoaderRepository repository3 = ((RepositoryClassLoader)POJO.class.getClassLoader()).getLoaderRepository();
            if (repository1 != repository2)
            {
               throw new RuntimeException("Repositories were not the same");
            }
            if (repository1 != repository3)
View Full Code Here

TOP

Related Classes of org.jboss.mx.loading.LoaderRepository

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.