Package org.jboss.classloading.spi

Examples of org.jboss.classloading.spi.RealClassLoader


      {
         // Has this classloader been undeployed?
         ClassLoader otherClassLoader = getClassLoader(result);
         if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader)
         {
            RealClassLoader rcl = (RealClassLoader) otherClassLoader;
            // Ignore when undeployed
            if (rcl.isValid() == false)
            {
               if (trace)
                  log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result));
               result = null;
            }
View Full Code Here


      {
         // Has this classloader been undeployed?
         ClassLoader otherClassLoader = getClassLoader(result);
         if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader)
         {
            RealClassLoader rcl = (RealClassLoader) otherClassLoader;
            // Ignore when undeployed
            if (rcl.isValid() == false)
            {
               if (trace)
                  log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result));
               result = null;
            }
View Full Code Here

      if (cl == null)
         return defaultClassLoader;

      if (cl instanceof RealClassLoader)
      {
         RealClassLoader rcl = RealClassLoader.class.cast(cl);
         return rcl.getObjectName();
      }

      return findLoaderName(cl.getParent());
   }
View Full Code Here

   {
      ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();

      MockClassLoaderPolicy policy = createMockClassLoaderPolicy("simple");
      policy.setPathsAndPackageNames(Simple.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(policy);
     
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      ObjectName clName = cl.getObjectName();
      server.registerMBean(cl, clName);
      getLog().debug("Registered classloader " + cl + " with name " + clName);
     
      ObjectName name = new ObjectName("test:test=simple");
      server.createMBean(Simple.class.getName(), name, clName);
View Full Code Here

      ClassLoaderDomain domain = system.createAndRegisterDomain("test");

      MockClassLoaderPolicy policy = createMockClassLoaderPolicy("simple");
      policy.setPathsAndPackageNames(Simple.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), policy);
     
      assertTrue(server.isRegistered(cl.getObjectName()));
     
      system.unregisterClassLoader((ClassLoader) cl);

      assertFalse(server.isRegistered(cl.getObjectName()));
   }
View Full Code Here

      ClassLoaderDomain domain = system.createAndRegisterDomain("test");

      MockClassLoaderPolicy policy = createMockClassLoaderPolicy("simple");
      policy.setPathsAndPackageNames(Simple.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), policy);
     
      server.registerMBean(system, CLASSLOADER_SYSTEM_OBJECT_NAME);
      assertTrue(server.isRegistered(cl.getObjectName()));
   }
View Full Code Here

      ClassLoaderDomain domain = system.createAndRegisterDomain("test");

      MockClassLoaderPolicy policy = createMockClassLoaderPolicy("simple");
      policy.setPathsAndPackageNames(Simple.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), policy);
     
      assertTrue(server.isRegistered(cl.getObjectName()));
     
      server.unregisterMBean(CLASSLOADER_SYSTEM_OBJECT_NAME);

      assertFalse(server.isRegistered(cl.getObjectName()));
   }
View Full Code Here

      ClassLoaderDomain domain = system.createAndRegisterDomain("test");

      MockClassLoaderPolicy policy = createMockClassLoaderPolicy("simple");
      policy.setPathsAndPackageNames(Simple.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), policy);
     
      assertTrue(server.isRegistered(cl.getObjectName()));

      system.unregisterDomain(domain);

      assertFalse(server.isRegistered(cl.getObjectName()));
   }
View Full Code Here

      ClassLoaderDomain defaultDomain = system.getDefaultDomain();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE_BUT_JAVA_ONLY, defaultDomain);

      MockClassLoaderPolicy a1 = createMockClassLoaderPolicy("a1");
      a1.setPathsAndPackageNames(A.class);
      RealClassLoader clA1 = (RealClassLoader) system.registerClassLoaderPolicy(domain, a1);

      MockClassLoaderPolicy a2 = createMockClassLoaderPolicy("a2");
      a2.setPathsAndPackageNames(A.class);
      RealClassLoader clA2 = (RealClassLoader) system.registerClassLoaderPolicy(domain, a2);

      MockClassLoaderPolicy b1 = createMockClassLoaderPolicy("b1");
      b1.setPathsAndPackageNames(B.class);
      RealClassLoader clB1 = (RealClassLoader) system.registerClassLoaderPolicy(domain, b1);

      MockClassLoaderPolicy b2 = createMockClassLoaderPolicy("b2");
      b2.setPaths(B.class);
      RealClassLoader clB2 = (RealClassLoader) system.registerClassLoaderPolicy(domain, b2);
     
      ObjectName testDomain = domain.getObjectName();
      List<ObjectName> classLoaders = (List) server.invoke(testDomain, "listClassLoaders", null, null);
      List<ObjectName> expected = Arrays.asList(clA1.getObjectName(), clA2.getObjectName(), clB1.getObjectName(), clB2.getObjectName());
      assertEquals(expected, classLoaders);
     
      Map<String, List<ObjectName>> packageClassLoaders = (Map) server.invoke(testDomain, "listExportingClassLoaders", null, null);
      Map<String, List<ObjectName>> expectedMap = new HashMap<String, List<ObjectName>>();
      expectedMap.put(A.class.getPackage().getName(), Arrays.asList(clA1.getObjectName(), clA2.getObjectName()));
View Full Code Here

      ClassLoaderDomain defaultDomain = system.getDefaultDomain();
      ClassLoaderDomain domain = system.createAndRegisterDomain("test", ParentPolicy.BEFORE_BUT_JAVA_ONLY, defaultDomain);

      MockClassLoaderPolicy a = createMockClassLoaderPolicy("a");
      a.setPathsAndPackageNames(A.class);
      RealClassLoader clA = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), a);

      MockClassLoaderPolicy b = createMockClassLoaderPolicy("b");
      b.setPathsAndPackageNames(B.class);
      RealClassLoader clB = (RealClassLoader) system.registerClassLoaderPolicy(domain.getName(), b);
     
      MockClassLoaderPolicy test = createMockClassLoaderPolicy("test");
      test.setImportAll(true);
      test.setDelegates(Arrays.asList(a.getExported(), b.getExported()));
      test.setPathsAndPackageNames(A.class, B.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(domain, test);
     
      ObjectName testObjectName = cl.getObjectName();
      assertEquals(domain.getObjectName(), server.getAttribute(testObjectName, "ClassLoaderDomain"));
      assertEquals("test", server.getAttribute(testObjectName, "Name"));
      assertTrue((Boolean) server.getAttribute(testObjectName, "ImportAll"));
      assertTrue((Boolean) server.getAttribute(testObjectName, "Valid"));
      Set<String> expectedPackages = makeSet(A.class.getPackage().getName(), B.class.getPackage().getName());
View Full Code Here

TOP

Related Classes of org.jboss.classloading.spi.RealClassLoader

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.