if (delta.length > 0) systemState.setTimeStamp(systemState.getTimeStamp() == Long.MAX_VALUE ? 0 : systemState.getTimeStamp() + 1);
	synchronized void doResolveBundles(AbstractBundle[] bundles, boolean refreshPackages) {		try {			if (Profile.PROFILE && Profile.STARTUP)				Profile.logEnter("resolve bundles"); //$NON-NLS-1$			framework.publishBundleEvent(Framework.BATCHEVENT_BEGIN, framework.systemBundle);			AbstractBundle[] refreshedBundles = null;			BundleDescription[] descriptions = null;			synchronized (framework.bundles) {				int numBundles = bundles == null ? 0 : bundles.length;				if (!refreshPackages)					// in this case we must make descriptions non-null so we do					// not force the removal pendings to be processed when resolving					// the state.					descriptions = new BundleDescription[0];				else if (numBundles > 0) {					ArrayList results = new ArrayList(numBundles);					for (int i = 0; i < numBundles; i++) {						BundleDescription description = bundles[i].getBundleDescription();						if (description != null && description.getBundleId() != 0 && !results.contains(description))							results.add(description);						// add in any singleton bundles if needed						AbstractBundle[] sameNames = framework.bundles.getBundles(bundles[i].getSymbolicName());						if (sameNames != null && sameNames.length > 1) {							for (int j = 0; j < sameNames.length; j++)								if (sameNames[j] != bundles[i]) {									BundleDescription sameName = sameNames[j].getBundleDescription();									if (sameName != null && sameName.getBundleId() != 0 && sameName.isSingleton() && !results.contains(sameName))										results.add(sameName);								}						}					}					descriptions = (BundleDescription[]) (results.size() == 0 ? null : results.toArray(new BundleDescription[results.size()]));				}			}			StateDelta stateDelta = framework.adaptor.getState().resolve(descriptions);			refreshedBundles = processDelta(stateDelta.getChanges(), refreshPackages);			if (refreshPackages) {				AbstractBundle[] allBundles = framework.getAllBundles();				for (int i = 0; i < allBundles.length; i++)					allBundles[i].unresolvePermissions();			}			// always resume bundles incase we have lazy-start bundles			resumeBundles(refreshedBundles, refreshPackages);		} catch (Throwable t) {			if (Debug.DEBUG && Debug.DEBUG_PACKAGEADMIN) {				Debug.println("PackageAdminImpl.doResolveBundles: Error occured :"); //$NON-NLS-1$				Debug.printStackTrace(t);			}			if (t instanceof RuntimeException)				throw (RuntimeException) t;			if (t instanceof Error)				throw (Error) t;		} finally {			if (Profile.PROFILE && Profile.STARTUP)				Profile.logExit("resolve bundles"); //$NON-NLS-1$			framework.publishBundleEvent(Framework.BATCHEVENT_END, framework.systemBundle);			if (refreshPackages)				framework.publishFrameworkEvent(FrameworkEvent.PACKAGES_REFRESHED, framework.systemBundle, null);		}	}