Package org.jboss.mx.loading

Examples of org.jboss.mx.loading.RepositoryClassLoader


         fail("test.implementation.loading.support.Trivial is already visible");
      }
      catch (ClassNotFoundException expected) {}

      // Add the URL to the repository twice
      RepositoryClassLoader ucl1 = lr.newClassLoader(url, true);
      RepositoryClassLoader 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


                  if (c == null)
                  {
                     continue;
                  }
                  log.debug("found class in repository " + name);
                  RepositoryClassLoader cl = (RepositoryClassLoader) c.getClassLoader();
                  classDefinition = loadByteCode(cl, className);
               }
               catch (Exception e)
               {
                  log.debug("unable to get class from " + name + ": " + e.getMessage(), e);
View Full Code Here

   private ClassLoader initBootLibrariesOld() throws Exception
   {
      List<URL> list = getBootURLs();
     
      // Create loaders for each URL
      RepositoryClassLoader loader = null;
      for (URL url : list)
      {
         log.debug("Creating loader for URL: " + url);

         // This is a boot URL, so key it on itself.
         Object[] args = {url, Boolean.TRUE};
         String[] sig = {"java.net.URL", "boolean"};
         loader = (RepositoryClassLoader) mbeanServer.invoke(DEFAULT_LOADER_NAME, "newClassLoader", args, sig);
      }
      bootstrapUCLName = loader.getObjectName();
      mbeanServer.registerMBean(loader, bootstrapUCLName);
      return loader;
   }
View Full Code Here

   protected ObjectName registerClassLoader(DeploymentInfo di) throws DeploymentException
   {
      ObjectName uclName = null;
      try
      {
         RepositoryClassLoader ucl = di.ucl;
         uclName = ucl.getObjectName();
         if (server.isRegistered(uclName) == false)
         {
            server.registerMBean(di.ucl, uclName);
            registeredClassLoader = true;
         }
View Full Code Here

   protected void unregisterClassLoader(DeploymentInfo di)
   {
      ObjectName uclName = null;
      try
      {
         RepositoryClassLoader ucl = di.ucl;
         if (ucl != null)
         {
            uclName = ucl.getObjectName();
            if (registeredClassLoader && server.isRegistered(uclName))
            {
               server.unregisterMBean(uclName);
               registeredClassLoader = false;
            }
View Full Code Here

   }

   // FIXME: JBAOP-107 REMOVE THIS HACK
   public boolean isValid()
   {
      RepositoryClassLoader cl = (RepositoryClassLoader) getClassLoader();
      if (cl == null)
         return false;
      return cl.getLoaderRepository() != null;
   }
View Full Code Here

            }
           
            if (candidate.getClassLoader() instanceof RepositoryClassLoader)
            {
               //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
               RepositoryClassLoader rcl = (RepositoryClassLoader)candidate.getClassLoader();
               URL[] urls = rcl.getClasspath();
              
               for (int i = 0 ; i < urls.length ; i++)
               {
                  if (resource.indexOf(urls[i].getFile()) >= 0)
                  {
View Full Code Here

      ClassLoader classloader = getClassLoader();
      if (classloader == null)
         throw new IllegalStateException("ClassLoader no longer exists: " + classLoaderString);
      if (classloader instanceof RepositoryClassLoader == false)
         throw new IllegalStateException("ClassLoader is not an instanceof RepositoryClassLoader " + classLoaderString);
      RepositoryClassLoader repositoryClassLoader = (RepositoryClassLoader) classloader;
      LoaderRepository loaderRepository = repositoryClassLoader.getLoaderRepository();
      if (loaderRepository == null)
         throw new IllegalStateException("ClassLoader has been undeployed: " + classLoaderString);
      if (loaderRepository instanceof HeirarchicalLoaderRepository3 == false)
         throw new IllegalStateException("Repository " + loaderRepository + " for classlaoder " + classLoaderString + " is not an HeirarchicalLoaderRepository3");
      return (HeirarchicalLoaderRepository3) loaderRepository;
View Full Code Here

   private URL createURLAndAddToLoader(ClassLoader cl, File tempdir) throws IOException
   {
      URL tmpURL = tempdir.toURL();
      URL tmpCP = new URL(tmpURL, "?dynamic=true");

      RepositoryClassLoader ucl = (RepositoryClassLoader) cl;

      // We may be undeploying.
      if (ucl.getLoaderRepository() != null)
      {
         ucl.addURL(tmpCP);
      }
     
      return tmpCP;
   }
View Full Code Here

   public boolean isUnloadedClassLoader()
   {
      if (getClassLoader() instanceof RepositoryClassLoader)
      {
         RepositoryClassLoader rcl = (RepositoryClassLoader) getClassLoader();
         return rcl.getLoaderRepository() == null;
      }
      return false;
   }
View Full Code Here

TOP

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

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.