felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Offenbach" <wolle5...@gmx.de>
Subject Aw: Re: SCR: Sometimes component gets instantiated twice
Date Wed, 09 Mar 2016 14:08:49 GMT
It has something to do with the TargetedPID. The modified or deactivate method gets called
when oldTargetedPID is null. Why is it sometimes null? Is it possible that the component got
instantiated and configured, but has a TargetedPID of null?

ConfigurationSupport.java (Line 338):
TargetedPID oldTargetedPID = componentHolder.getConfigurationTargetedPID(pid, factoryPid);
if ( targetedPid.equals(oldTargetedPID))
  ...
}
 

Gesendet: Mittwoch, 09. März 2016 um 14:44 Uhr
Von: "Carsten Ziegeler" <cziegeler@apache.org>
An: users@felix.apache.org
Betreff: Re: SCR: Sometimes component gets instantiated twice
Jens Offenbach wrote
> Now, I am confused... But I am using 'configuration-policy="require"'. This should force
SCR to activate my component only when there is a valid configuration.
>

Your configuration is changed, config admin fires a configuration
changed event, which in turn reactivates your component. It might be the
same configuration, but as someone updated the config, config admin
needs to send out the event.

If you don't implement modified, your component is deactivated and then
activated. Otherwise modified is called.

As you have require as the configuration policy, the only way to avoid
this is to make sure that the configuration is not updated in config admin.

So this is not an SCR problem, everything behaves as expected. It looks
rather like a provisioning problem to me.

In general, OSGi is dynamic, so your component should behave properly
and expect this "restarting" through a configuration change.

Regards
Carsten
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message