Hi, On 03.05.2010 18:40, Andrea Zoppello wrote: > Hi Stojan, > > Thanks for the response, actually as you described ( specifically for > component factories implementing the Event Handler ) interface, i see > SCR is > trying to reactivate the component.
Really ? Component Factory component configurations are not created by SCR, they are created by calling the ComponentFactory.newInstance() method. IIUIC if the activate method throws, the newInstance method should throw a ComponentException because "the Service Component Runtime is unable to activate the component configuration." (112.12.5.1). Though this seems to not be explicitly stated in 112.5.5, yet the Felix SCR does it. > > You suggest to use another component to manage enable/disable state of > my components, but i've not clear how to do that. > Actually i've a component Deployer ( not DS ) that tracks the factory > components and use it calling the ci.newInstance() method. > You suggest to control my componen in the Deployer Component?? I am confused .... Aren't you using a factory components (or ComponentFactory) ? Or are you using regular components configured with factory configurations ? In the first case, you have to call the newInstance() method to create component configurations and you won't get an instance back if the activation fails. In the second case, SCR of course deactivates the component but upon a new event (like service registration/unregistration or configuration update) may try to activate the component again. Regards Felix > > Andrea > > > Il 03/05/2010 17:46, Stoyan Boshev ha scritto: >> Your solution seems correct but I would like to add a note here. >> Your component will not get activated but is still enabled and >> satisfied, so SCR will try to activate it later again. >> So, if you don't want to see subsequent unsuccessful activations of >> your component you should implement a better handling of your component. >> E.g. you could use another component to manage the enabled/disabled >> state of your components. >> >> Regards, >> Stoyan >> >> Andrea Zoppello wrote: >>> Hi all, >>> >>> In my project i'm using a lot OSGi DS and in particulra component >>> factories to create DS component/services. >>> >>> In my DS Component Factories i'm using the activate() method to >>> perform some initialization step i need >>> to do in my components. >>> >>> In my case if the code in the activate method() fail this must result >>> in a failure of component creation, and must >>> result in *non registration* of the services provided by the component. >>> >>> At the moment i've solved this throwing a RuntimeException from the >>> activate method but i'm not sure this is the >>> right way to do... >>> >>> Any suggestion?? >>> >>> Andrea >>> _______________________________________________ >>> OSGi Developer Mail List >>> [email protected] >>> https://mail.osgi.org/mailman/listinfo/osgi-dev >>> >>> >>> >> >> _______________________________________________ >> OSGi Developer Mail List >> [email protected] >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
