User: ejort   
  Date: 02/01/26 07:13:24

  Modified:    src/main/org/jboss/mx/loading BasicLoaderRepository.java
  Log:
  
  
  Revision  Changes    Path
  1.3       +43 -4     jmx/src/main/org/jboss/mx/loading/BasicLoaderRepository.java
  
  Index: BasicLoaderRepository.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/org/jboss/mx/loading/BasicLoaderRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicLoaderRepository.java        2001/12/05 14:26:13     1.2
  +++ BasicLoaderRepository.java        2002/01/26 15:13:24     1.3
  @@ -5,6 +5,7 @@
   
   import java.util.Set;
   import java.util.Iterator;
  +import java.util.HashMap;
   import java.util.HashSet;
   
   public class BasicLoaderRepository implements LoaderRepository {
  @@ -20,9 +21,40 @@
         }
      }
      
  -   
      protected Set loaders = new HashSet();
      
  +
  +   /**
  +    * Native signature to class map
  +    */
  +   private static HashMap nativeClassBySignature;
  +
  +   /**
  +    * Construct the native class map
  +    */
  +   static
  +   {
  +     nativeClassBySignature = new HashMap();
  +     nativeClassBySignature.put(boolean.class.getName(),
  +                                Boolean.TYPE);
  +     nativeClassBySignature.put(byte.class.getName(), 
  +                                Byte.TYPE);
  +     nativeClassBySignature.put(char.class.getName(), 
  +                                Character.TYPE);
  +     nativeClassBySignature.put(double.class.getName(), 
  +                                Double.TYPE);
  +     nativeClassBySignature.put(float.class.getName(), 
  +                                Float.TYPE);
  +     nativeClassBySignature.put(int.class.getName(), 
  +                                Integer.TYPE);
  +     nativeClassBySignature.put(long.class.getName(), 
  +                                Long.TYPE);
  +     nativeClassBySignature.put(short.class.getName(), 
  +                                Short.TYPE);
  +     nativeClassBySignature.put(void.class.getName(), 
  +                                Void.TYPE);
  +   }
  +
      private BasicLoaderRepository() {
      
      
  @@ -31,10 +63,17 @@
      public Class loadClass(String className) throws ClassNotFoundException {
         return loadClassWithout(null, className);
      }
  -   
  -   public Class loadClassWithout(ClassLoader skipLoader, String className) throws 
ClassNotFoundException {
      
  -      Class clazz = null;
  +   public Class loadClassWithout(ClassLoader skipLoader, String className)
  +      throws ClassNotFoundException
  +   {
  +   
  +      // REVIEW: Is this the correct place for this or should it only
  +      //         go where signatures are checked?
  +      // Check for native classes
  +      Class clazz = (Class) nativeClassBySignature.get(className);
  +      if (clazz != null)
  +        return clazz;
         
         // try ctx cl first
         ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to