Wise words (as usual) from Neil.  I'd like to single out these sentences
for printing out and hanging on the wall:

"as the caller of a service it is simply not your concern to try to
enforce something about the implementation of the service you are calling.
You should however be prepared for the service invocation to go wrong in
unpredictable ways".

In OSGi invoking a service looks just like any other method call (which is
great), but at the same time it represents crossing a boundary. Maybe you
think you know now how the service will behave, but next week someone may
have the bright idea of moving the implementation to a USB dongle or The
Cloud, or they switch to using a new open-source library - and your
assumptions are rendered invalid.  So every time you invoke another
service you should be asking yourself questions like "do I need a try -
catch -finally here?  Am I holding any locks that could cause problems?".

It's interesting to know that "iPOJO won't do this", but then iPOJO too is
just one implementation. Just as you shouldn't rely on the "known"
behaviour of your services, you certainly shouldn't rely on the "known"
behaviour of a particular framework.

Chris



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

Reply via email to