Thanks for your reply!

On 03.06.2011 14:34, BJ Hargrave wrote:

> For a factory component instance created (and activated) with 
> newInstance, it does not really matter whether the instance is 
> activated before it is registered as a service or not.

I don't understand why it doesn't matter.  If the instance is registered
first, then bundles can retrieve a not yet activated component instance
via the service registry.  Since activation includes running the
activate method which may perform important initialization tasks, I
think it should be required to activate the component instance first.

> The main reason for (non-factory) components to be registered before 
> being activated is to allow for lazy loading of the component class 
> (and dependent classes). With a factory component, there is no need 
> for this since the call to newInstance must immediately load the 
> component class.

Okay, I understand this point, thank you.

> Since there is no opportunity for laziness, activation before
> registration makes sense.

Yes, I agree it makes sense, but I would go even further and think the
spec must require it for the reason stated above.

But even if I miss an important point here, the spec should IMHO do one
of three things:

(1) require activation before registration
(2) require registration before activation
(3) let the order explicitly undefined

As I wrote in my first mail, the spec seems to do (1) at some places and
(2) at some other places.

Regards,
Daniel

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to