public static void ensureClassLoaderConsistency(Class<?> existingClass,
                                                  ClassLoader classLoader) {
    Class<?> loadedClass;
    try {
      loadedClass = Class.forName(existingClass.getName(), true, classLoader);
    } catch (ClassNotFoundException e) {
      return; // let class loading fail some where else.
    }

    if (!loadedClass.equals(existingClass)) {
      throw new RuntimeException("The class loader is incosistent with the "
              + "class loader that initially loaded "
              + existingClass.getClass()
              + ". This can lead to various unexpected side effects.");

    }
  }
public static void ensureClassLoaderConsistency(Class<?> existingClass,
                                                  ClassLoader classLoader) {
    Class<?> loadedClass;
    try {
      loadedClass = Class.forName(existingClass.getName(), true, classLoader);
    } catch (ClassNotFoundException e) {
      return; 
    }

    if (!loadedClass.equals(existingClass)) {
      throw new RuntimeException("The class loader is incosistent with the "
              + "class loader that initially loaded "
              + existingClass.getClass()
              + ". This can lead to various unexpected side effects.");

    }
  }
public static void ensureClassLoaderConsistency ( Class < ? > existingClass , ClassLoader classLoader ) { Class < ? > loadedClass ; try { loadedClass = Class . forName ( existingClass . getName ( ) , true , classLoader ) ; } catch ( ClassNotFoundException e ) { return ; // let class loading fail some where else. } if ( ! loadedClass . equals ( existingClass ) ) { throw new RuntimeException ( "The class loader is incosistent with the " + "class loader that initially loaded " + existingClass . getClass ( ) + ". This can lead to various unexpected side effects." ) ; } }
Ensures the <code>classLoader</code> is 'consistent' with the original
class loader that created <code>existingClass</code>. Asserts<br>
<code>classLoader.loadClass(existingClass.getName()) == existingClass</code>.
<p>

If classLoader fails to load the class, this returns silently.<br>
Throws a RuntimeException with detailed message if the consistency
check fails.

@param existingClass
@param classLoader
Ensures the <code > classLoader< / code > is consistent with the original class loader that created <code > existingClass< / code > . Asserts<br > <code > classLoader . loadClass ( existingClass . getName () ) == existingClass< / code > . <p >