Bertrand Delacretaz wrote:
> On Mon, Jun 15, 2009 at 1:00 PM, Alexander Klimetschek<aklim...@day.com> 
> wrote:
>> On Mon, Jun 15, 2009 at 11:31 AM, Bertrand
>> Delacretaz<bdelacre...@apache.org> wrote:
>>> 1. The goal is to return a 503 status until the system is ready to
>>> process requests.
>>>
>>> 2. Defining readyness is hard due to the dynamic nature of OSGi and
>>> especially Declarative Services. My idea is to use scripts found under
>>> /system/sling/status in the JCR repository to let programmers define
>>> what they require for their system to be ready.
>> Why not put a list under /system/sling/status/requiredBundles and
>> requiredServices with the names of the bundles and services that
>> should be running in order to consider the system to be ready?
> 
> Good idea, and it would allow extensions for use cases that go beyond
> just testing the presence of a given bundle or service: one could
> create a service S that checks the required preconditions before
> coming up (using code, scripts, whatever), and configure S as a
> requiredService.
> 
>> ...That way it
>> a) only depends on the OSGi Framework API
>> b) could be implemented right inside the engine, introducing none of
>> the chicken and egg problems.
>> c) it also allows you to define more than just scripting engines as
>> dependencies for your system ready state....
> 
> Correct, though my original proposal also allowed for more than
> scripting engines. The idea was that readyness scripts would check for
> bundles and services, and maybe run some test code.
> 
> But your proposal seems to cover all of that.
> 
> What do others think?
> 
I'm not sure :)

The stuff Alex suggests is similar to the idea we discussed some time
ago when we first thought about this.
If we use some kind of configuration for this check, the questions is
when is this configuration available? If first the engine starts, the
check is performed (with an empty or minimal configuration) you have
a system which is running, then at a later point the config kicks in
and your system is not ready anymore until the required stuff is running.
This might be nitpicking but the system might appear as ready although
its not.

As a general note, checking if the system is ready might increase the
startup time as you're system is only responding if all required
services are really available. There might be cases where this is not
necessary.

Regardless of what we do, I think that the ready check and the
configuration for this check must form a single unit. Therefore
additional configuration and extra bundles are not a good solution in my
opinion. To be fair, I have not good idea either atm.

But let's add some other requirements :) The stuff must work without a
repository (again my use case for portlets do not have a repository) and
it should work without third bundles like config admin etc.
Therefore a check like Alex suggest above which solely relies on the
OSGI API seems to be good start; the remaining question however is the
configuration therefore.
Now we could do this by requiring people to repackage the engine bundle
and adding a configuration as a resource to the bundle. The default
engine has zero checks. This would solve the provisioning of the config
but creates new problems when it comes to updates of the bundle etc.

Carsten
-- 
Carsten Ziegeler
cziege...@apache.org

Reply via email to