Package org.jboss.classloading.spi

Examples of org.jboss.classloading.spi.RealClassLoader


      server.registerMBean(system, CLASSLOADER_SYSTEM_OBJECT_NAME);
      system.getDefaultDomain().setParentPolicy(ParentPolicy.BEFORE_BUT_JAVA_ONLY);

      MockClassLoaderPolicy test = createMockClassLoaderPolicy("test");
      test.setPathsAndPackageNames(A.class, B.class);
      RealClassLoader cl = (RealClassLoader) system.registerClassLoaderPolicy(test);
     
      ObjectName testObjectName = cl.getObjectName();

      Set<String> loadedClasses = (Set) server.invoke(testObjectName, "listLoadedClasses", null, null);
      assertFalse(loadedClasses.contains(A.class.getName()));
      Class<?> expected = ((ClassLoader) cl).loadClass(A.class.getName());
      assertEquals(expected, server.invoke(testObjectName, "loadClass", new Object[] { A.class.getName() }, new String[] { String.class.getName() }));
      loadedClasses = (Set) server.invoke(testObjectName, "listLoadedClasses", null, null);
      assertTrue(loadedClasses.contains(A.class.getName()));

      assertEquals(cl.getObjectName(), server.invoke(testObjectName, "findClassLoaderForClass", new Object[] { A.class.getName() }, new String[] { String.class.getName() }));
      assertNull(server.invoke(testObjectName, "findClassLoaderForClass", new Object[] { Object.class.getName() }, new String[] { String.class.getName() }));
     
      String resourceName = ClassLoaderUtils.classNameToPath(B.class.getName());
      Set<String> loadedResourceNames = (Set) server.invoke(testObjectName, "listLoadedResourceNames", null, null);
      assertFalse(loadedResourceNames.contains(resourceName));
View Full Code Here


            }
           
            if (candidate.getClassLoader() instanceof RealClassLoader)
            {
               //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
               RealClassLoader bcl = (RealClassLoader)candidate.getClassLoader();
               URL foundUrl = bcl.getResourceLocally(resourceName);
               if (foundUrl != null)
               {
                  if (url.equals(foundUrl))
                  {
                     if (trace)
View Full Code Here

/* 194 */       return;
/*     */     }
/* 196 */     if (!(classLoader instanceof RealClassLoader)) {
/* 197 */       return;
/*     */     }
/* 199 */     RealClassLoader jmxClassLoader = (RealClassLoader)classLoader;
/* 200 */     ObjectName name = jmxClassLoader.getObjectName();
/* 201 */     if (this.mbeanServer.isRegistered(name)) {
/* 202 */       return;
/*     */     }
/* 204 */     this.mbeanServer.registerMBean(classLoader, name);
/*     */   }
View Full Code Here

/* 216 */       return;
/*     */     }
/* 218 */     if (!(classLoader instanceof RealClassLoader)) {
/* 219 */       return;
/*     */     }
/* 221 */     RealClassLoader jmxClassLoader = (RealClassLoader)classLoader;
/* 222 */     ObjectName name = jmxClassLoader.getObjectName();
/* 223 */     if (!this.mbeanServer.isRegistered(name))
/* 224 */       return;
/* 225 */     this.mbeanServer.unregisterMBean(name);
/*     */   }
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

      {
         // 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 (candidate.getClassLoader() instanceof RealClassLoader)
            {
               //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
               RealClassLoader bcl = (RealClassLoader)candidate.getClassLoader();
               URL foundUrl = bcl.getResourceLocally(resourceName);
               if (foundUrl != null)
               {
                  if (url.equals(foundUrl))
                  {
                     if (trace)
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.