Ejemplo n.º 1
0
  /**
   * Gets the method defined by <code>name</code> and <code>params</code> for the Class <code>c
   * </code>.
   *
   * @return The desired Method object.
   */
  public Method getMethod(Class c, String name, Object[] params) throws Exception {
    if (c == null) {
      throw new Exception("Introspector.getMethod(): Class method key was null: " + name);
    }

    ClassMap classMap = null;

    synchronized (classMethodMaps) {
      classMap = (ClassMap) classMethodMaps.get(c);

      /*
       *  if we don't have this, check to see if we have it
       *  by name.  if so, then we have a classloader change
       *  so dump our caches.
       */

      if (classMap == null) {
        if (cachedClassNames.contains(c.getName())) {
          /*
           * we have a map for a class with same name, but not
           * this class we are looking at.  This implies a
           * classloader change, so dump
           */
          clearCache();
          rsvc.info(CACHEDUMP_MSG);
        }

        classMap = createClassMap(c);
      }
    }

    return classMap.findMethod(name, params);
  }