Hi,

I'm currently working on a prototype for new startup features of the
Sling launchpad.
I've already committed the prototype into trunk :) This gives is not
only words but also code to discuss and it can directly be tested out.

With SLING-2372 I've added a mechanism which detects whether the
current startup is a fresh installation, an update (launchpad bundles
changed) or a restart.

I think it makes sense to make this information available.

So I started and added something to the launchpad api:
- The StartupMode enumeration
- A StartupListener interface - this can be implemented bu custom
components which are interested in the startup mode, the startup
progress and finishing of the startup
- A StartupHandler - I'll come to that later :)

As we are now able to detect the startup mode, we can do "safer"
updates and installs. Usually, the framework is started with a start
level of 30. Plainly put, the framework tries to reach this level as
fast as possible. This is no problem for a restart, but for
installations and especially updates this might create unnecessary
overhead like bundles get started which are later on removed etc.
So I've added a feature which we're using internally for a longer
time: instead of directly going to the configured start level, the
framework will be started with a much lower beginning start level like
10. A special startup handler inside the launchpad now increases the
start level one by one until the original level (30) is reached.

This alone does not make a hugh difference, but with the new
StartupHandler interface any service can interrupt this startup until
some work is done. For example, the OSGi installer we have is such a
component. As long as the installer is doing some work, the start
level should not be increased. A component can now use the startup
handler interface to exactly notify such cases.

So far so good, however this comes with a caveat - services might need
some time to be started and start with their work - therefore the
startup handler currently waits 2 secs between each increase of the
start level. You can do the maths, as we increment one by one from 10
to 30, this approx adds 40 seconds to the install/upgrade time.

Please keep in mind, this is a prototype - nothing is carved in stone :)

WDYT?

Regards
Carsten
-- 
Carsten Ziegeler
[email protected]

Reply via email to