I changed the reset logic such that it resets to the state that it was before the resolve attept.
Instead of always reset to "DESCRIBE".
// Advance the bundles to stage CLASSLOADER and check at the end
if (advanceBundlesToClassloader(resolvableBundles) == false)
{
resetBundleDeploymentStates(resolvableBundles);
allResolved = false;
}
private void resetBundleDeploymentStates(List<OSGiBundleState> resolvableBundles)
{
for (OSGiBundleState bundleState: resolvableBundles)
{
DeploymentUnit unit = bundleState.getDeploymentUnit();
StateTuple stateTuple = unit.removeAttachment(StateTuple.class);
if (stateTuple != null)
{
stateTuple.reset(unit);
}
}
}
The DeploymentMetaData is not available in 6.0.0.M2, so I had to refactor that out into a separate deployer that does a noop in M2.
With the recent change we also get spurious WARN messages
22:54:34,034 WARN [BaseDelegateLoader] Not getting package org.osgi.service.log from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,040 WARN [BaseDelegateLoader] Not getting package org.osgi.service.log from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,065 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=8,classes=[org.osgi.service.log.LogService]}
22:54:34,069 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=9,classes=[org.osgi.service.log.LogReaderService]}
22:54:34,075 WARN [BaseDelegateLoader] Not getting package org.osgi.util.tracker from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,076 WARN [BaseDelegateLoader] Not getting package org.osgi.util.tracker from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,076 WARN [BaseDelegateLoader] Not getting resource org/osgi/util/tracker/ServiceTrackerCustomizer.class from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,111 WARN [BaseDelegateLoader] Not getting resource org/osgi/util/tracker/ServiceTracker$AllTracked.class from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,112 WARN [BaseDelegateLoader] Not getting resource org/osgi/util/tracker/ServiceTracker$Tracked.class from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>}
22:54:34,114 WARN [BaseDelegateLoader] Not getting resource org/osgi/util/tracker/AbstractTracked.class from policy that has no classLoader: LazyFilteredDelegateLoader@191eb90{factory=org.jboss.classloading.spi.dependency.policy.DynamicClassLoaderPolicyFactory@1004a1a filter=<EVERYTHING>
which is because the DynamicClassLoaderPolicyFactory does not create a policy. Not sure how this is suposed to work.