When using factory components, you get a ComponentInstance and you should dispose once done. For services with prototype scope, you get ComponentServiceObjects from which you need to ungetService after use.
I have some cases where I am creating some UI Widgets and where I don't have a well defined lifecycle that my class controls. It is expected to hand over a widget and the widget will be "disposed" when necessary. The widget can add actions when it is "disposed" or a listener can be added to watch for such events with the UI framework. What is the best way to handle those and is either factory component or CSO better that the other, in this case and others? I was thinking that I might implement a factory for managed widgets that keeps a map of provided widgets and registers for events of disposed widgets and cleans up at that time, but feels like an added moving part. Alain
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev