curLimited.put(eclipseApp.getApplicationId(), limited);
activeLimited.put(eclipseApp.getApplicationId(), limited);
	synchronized void lock(EclipseAppHandle appHandle) throws ApplicationException {		EclipseAppDescriptor eclipseApp = (EclipseAppDescriptor) appHandle.getApplicationDescriptor();		switch (isLocked(eclipseApp)) {			case NOT_LOCKED : 				break;			case LOCKED_SINGLETON_GLOBAL_RUNNING :				throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.singleton_running, curGlobalSingleton.getInstanceId()));			case LOCKED_SINGLETON_GLOBAL_APPS_RUNNING :				throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, Messages.apps_running);			case LOCKED_SINGLETON_SCOPED_RUNNING :				throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.singleton_running, curScopedSingleton.getInstanceId()));			case LOCKED_SINGLETON_LIMITED_RUNNING : 				throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.max_running, eclipseApp.getApplicationId()));			case LOCKED_MAIN_THREAD_RUNNING :				throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, NLS.bind(Messages.main_running, curMain.getInstanceId()));			default :				break;		}		if (eclipseApp.getThreadType() == EclipseAppDescriptor.FLAG_TYPE_MAIN_THREAD) {			if (curMain != null)				throw new IllegalStateException(Messages.main_running + curMain.getInstanceId());		}		// ok we can now successfully lock the container		switch (eclipseApp.getCardinalityType()) {			case EclipseAppDescriptor.FLAG_CARD_SINGLETON_GLOGAL :				curGlobalSingleton = appHandle;				break;			case EclipseAppDescriptor.FLAG_CARD_SINGLETON_SCOPED :				curScopedSingleton = appHandle;				break;			case EclipseAppDescriptor.FLAG_CARD_LIMITED :				if (curLimited == null)					curLimited = new HashMap(3);				ArrayList limited = (ArrayList) curLimited.get(eclipseApp.getApplicationId());				if (limited == null) {					limited = new ArrayList(eclipseApp.getCardinality());					curLimited.put(eclipseApp.getApplicationId(), limited);				}				limited.add(appHandle);				break;			case EclipseAppDescriptor.FLAG_CARD_UNLIMITED :				break;			default :				break;		}		if (eclipseApp.getThreadType() == EclipseAppDescriptor.FLAG_TYPE_MAIN_THREAD)			curMain = appHandle;		curHandles.add(appHandle);		refreshAppDescriptors();	}