if (EclipseAdaptor.TRACE_BUNDLES && threadChangingState != null) {
if (StatsManager.TRACE_BUNDLES && threadChangingState != null) {
	public Class findLocalClass(String name) throws ClassNotFoundException {		if (EclipseAdaptor.MONITOR_CLASSES) //Suport for performance analysis			ClassloaderStats.startLoadingClass(getClassloaderId(), name);		boolean found = true;		try {			AbstractBundle bundle = (AbstractBundle) hostdata.getBundle();			// If the bundle is active, just return the class			if (bundle.getState() == AbstractBundle.ACTIVE)				return super.findLocalClass(name);			//If the bundle is uninstalled, classes can still be loaded from it			if (bundle.getState() == AbstractBundle.UNINSTALLED)				return super.findLocalClass(name);			//If the bundle is stopping, we don't want to reactive it but we still want to be able to load classes from it.			if (bundle.getState() == AbstractBundle.STOPPING)				return super.findLocalClass(name);			// The bundle is not active and does not require activation, just return the class			if (!shouldActivateFor(name))				return super.findLocalClass(name);			// The bundle is starting			if (bundle.getState() == AbstractBundle.STARTING) {				//If the thread trying to load the class is the one trying to activate the bundle, then return the class 				if (bundle.testStateChanging(Thread.currentThread()) || bundle.testStateChanging(null))					return super.findLocalClass(name);				//If it's another thread, we wait and try again. In any case the class is returned. The difference is that an exception can be logged.				if (!bundle.testStateChanging(Thread.currentThread())) {					Thread threadChangingState = bundle.getStateChanging();					if (EclipseAdaptor.TRACE_BUNDLES && threadChangingState != null) {						System.out.println("Concurrent startup of bundle " + bundle.getSymbolicName() + " by " + Thread.currentThread() + " and " + threadChangingState.getName() + ". Waiting up to 5000ms for " + threadChangingState + " to finish the initialization."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$					}					Object lock = bundle.getStateChangeLock();					long start = System.currentTimeMillis();					long delay = 5000;					long timeLeft = delay;					while (true) {						if (bundle.testStateChanging(null))							break;						if (timeLeft <= 0)							break;						try {							synchronized (lock) {								lock.wait(timeLeft);							}						} catch (InterruptedException e) {							//Ignore and keep waiting						}						timeLeft = start + delay - System.currentTimeMillis();					}					if (timeLeft <= 0 || bundle.getState() != Bundle.ACTIVE) {						String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP", new Object[] {Thread.currentThread(), name, threadChangingState.getName(), bundle.getSymbolicName() == null ? Long.toString(bundle.getBundleId()) : bundle.getSymbolicName()}); //$NON-NLS-1$ 						EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, new Exception(EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_GENERATED_EXCEPTION")), null)); //$NON-NLS-1$					}					return super.findLocalClass(name);				}			}			//The bundle must be started.			try {				hostdata.getBundle().start();			} catch (BundleException e) {				String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_ACTIVATION", bundle.getSymbolicName(), Long.toString(bundle.getBundleId())); //$NON-NLS-1$				EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, e, null));			}			return super.findLocalClass(name);		} catch (ClassNotFoundException e) {			found = false;			throw e;		} finally {			if (EclipseAdaptor.MONITOR_CLASSES)				ClassloaderStats.endLoadingClass(getClassloaderId(), name, found);		}	}