The latest javedoc states the following: <javadoc> If this bundle's state was ACTIVE prior to setting the state to STOPPING, the BundleActivator.stop% method of this bundle's BundleActivator, if one is specified, is called. If that method throws an exception, this method must continue to stop this bundle and a BundleException must be thrown after completion of the remaining steps. </javadoc>
Note that the BundleActivator.stop method is only called if the state of the bundle was ACTIVE. If there is a BundeActivator specified then the bundle can only enter the ACTIVE state after a successful call to BundleActivator.start. This means that BundleActivator.stop will only ever be call on stop if BundleActivator.start was previously called successfully. Mirko is correct that the state diagram does not describe the path for stopping a lazy STARTING bundle. This has been discussed recently in the CPEG and we are looking to improve the diagram. Tom |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Mirko Jahn <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |OSGi Developer Mail List <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |07/14/2009 05:41 AM | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Re: [osgi-dev] stop() for Lazy Activation Policy | >--------------------------------------------------------------------------------------------------------------------------------------------------| Just my interpretation, but I would expect the bundle to enter the resolved state (removing the lazy activation flag) without further changes. So, only the state changes from starting to resolved, without going through the active state. Again, just my "interpretation". The only "odd" thing is that this path is not described in the state diagram, although pretty common, when shutting down an OSGi runtime with not activated bundles. Well, maybe it can be interpreted as the case when the activator starts with an exception, there you would have the same behavior... Cheers, Mirko On Tue, Jul 14, 2009 at 8:17 AM, Ikuo Yamasaki<[email protected]> wrote: > Hi all, > > I have a question regarding Bundle#stop() against lazy activation policy. > > Q. What happen , if Bundle#stop() is called for bundle A that is in > STARTING state due to lazy activation policy ? > > According to javadoc of Bundle#stop() in either R4.2 or R4.1 spec, > BundleActivator#stop() must be called if specified. > > However, IMO, it seems strange because Bundle#start() has not been > called yet (even the bundle classloader has not been created). > > Best regards, > > ======= > Ikuo YAMASAKI > > # If needed, I'll open a bug report on the OSGi bugzilla. > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
