You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Raymond Augé <ra...@liferay.com.INVALID> on 2023/04/25 13:56:29 UTC

felix:persistentFactoryComponent

Hello all,

Could someone explain what it means to use

felix:persistentFactoryComponent="true"

As in:

<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"

xmlns:felix="http://felix.apache.org/xmlns/scr/extensions/v1.0.0">


<scr:component name="factory.component"

felix:persistentFactoryComponent="true"

enabled="false"

factory="factory.component.factory" >

<implementation class="
org.apache.felix.scr.integration.components.SimpleComponent" />

</scr:component>

...

-- 
*Raymond Augé* (@rotty3000)
Senior Software Architect *Liferay, Inc.* (@Liferay)
OSGi Fellow, Java Champion

Re: felix:persistentFactoryComponent

Posted by David Jencks <da...@gmail.com>.
Yes, now that you mention it, that is actually seeming like more of the motivation for the flag than what I originally recalled. In general I think it’s supposed to make the factory-created instances act as much as possible like regular components.

David Jencks

> On Apr 25, 2023, at 9:05 AM, Raymond Augé <ra...@liferay.com.INVALID> wrote:
> 
> Thanks David, that's great information.
> 
> Let me try to explain what I've witnessed in another way to see if that is
> something you would have expected:
> 
> * When a factory component has a reference, which cannot be _immediately_
> resolved at the moment of activation, it will fail.
> 
> * However, when setting felix:persistentFactoryComponent="true" the
> component behaves as any other component which might have an unresolved
> reference, resulting in deferred activation only upon satisfaction of the
> reference.
> 
> Would you consider that inline with the intent? (I certainly hope so :D
> because that's what I'm looking for.)
> 
> Ray
> 
> On Tue, Apr 25, 2023 at 11:54 AM David Jencks <da...@gmail.com>
> wrote:
> 
>> This is my recollection from the distant past, it could be wrong in
>> several ways.
>> 
>> IIRC if you have a factory component, when you call it to create a
>> component the properties are a mix of the factory component’s properties
>> and the ones you supply.
>> 
>> Furthermore, the spec says if you change the factory component’s
>> properties, all the previously created instances are immediately disposed
>> of. If the manually created component instances are used as dependencies
>> this might not be what you want.
>> 
>> So, IIRC, setting this property changes the behavior when you change the
>> factory properties so the created instances are not automatically disposed
>> of.
>> 
>> I thought I’d documented all the non-standard behaviors I implemented, but
>> this certainly isn’t in the .md.
>> 
>> David Jencks
>> 
>>> On Apr 25, 2023, at 6:56 AM, Raymond Augé <ra...@liferay.com.INVALID>
>> wrote:
>>> 
>>> Hello all,
>>> 
>>> Could someone explain what it means to use
>>> 
>>> felix:persistentFactoryComponent="true"
>>> 
>>> As in:
>>> 
>>> <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>> 
>>> xmlns:felix="http://felix.apache.org/xmlns/scr/extensions/v1.0.0">
>>> 
>>> 
>>> <scr:component name="factory.component"
>>> 
>>> felix:persistentFactoryComponent="true"
>>> 
>>> enabled="false"
>>> 
>>> factory="factory.component.factory" >
>>> 
>>> <implementation class="
>>> org.apache.felix.scr.integration.components.SimpleComponent" />
>>> 
>>> </scr:component>
>>> 
>>> ...
>>> 
>>> --
>>> *Raymond Augé* (@rotty3000)
>>> Senior Software Architect *Liferay, Inc.* (@Liferay)
>>> OSGi Fellow, Java Champion
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
>> 
> 
> -- 
> *Raymond Augé* (@rotty3000)
> Senior Software Architect *Liferay, Inc.* (@Liferay)
> OSGi Fellow, Java Champion


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


Re: felix:persistentFactoryComponent

Posted by Raymond Augé <ra...@liferay.com.INVALID>.
Thanks David, that's great information.

Let me try to explain what I've witnessed in another way to see if that is
something you would have expected:

* When a factory component has a reference, which cannot be _immediately_
resolved at the moment of activation, it will fail.

* However, when setting felix:persistentFactoryComponent="true" the
component behaves as any other component which might have an unresolved
reference, resulting in deferred activation only upon satisfaction of the
reference.

Would you consider that inline with the intent? (I certainly hope so :D
because that's what I'm looking for.)

Ray

On Tue, Apr 25, 2023 at 11:54 AM David Jencks <da...@gmail.com>
wrote:

> This is my recollection from the distant past, it could be wrong in
> several ways.
>
> IIRC if you have a factory component, when you call it to create a
> component the properties are a mix of the factory component’s properties
> and the ones you supply.
>
> Furthermore, the spec says if you change the factory component’s
> properties, all the previously created instances are immediately disposed
> of. If the manually created component instances are used as dependencies
> this might not be what you want.
>
> So, IIRC, setting this property changes the behavior when you change the
> factory properties so the created instances are not automatically disposed
> of.
>
> I thought I’d documented all the non-standard behaviors I implemented, but
> this certainly isn’t in the .md.
>
> David Jencks
>
> > On Apr 25, 2023, at 6:56 AM, Raymond Augé <ra...@liferay.com.INVALID>
> wrote:
> >
> > Hello all,
> >
> > Could someone explain what it means to use
> >
> > felix:persistentFactoryComponent="true"
> >
> > As in:
> >
> > <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
> >
> > xmlns:felix="http://felix.apache.org/xmlns/scr/extensions/v1.0.0">
> >
> >
> > <scr:component name="factory.component"
> >
> > felix:persistentFactoryComponent="true"
> >
> > enabled="false"
> >
> > factory="factory.component.factory" >
> >
> > <implementation class="
> > org.apache.felix.scr.integration.components.SimpleComponent" />
> >
> > </scr:component>
> >
> > ...
> >
> > --
> > *Raymond Augé* (@rotty3000)
> > Senior Software Architect *Liferay, Inc.* (@Liferay)
> > OSGi Fellow, Java Champion
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

-- 
*Raymond Augé* (@rotty3000)
Senior Software Architect *Liferay, Inc.* (@Liferay)
OSGi Fellow, Java Champion

Re: felix:persistentFactoryComponent

Posted by David Jencks <da...@gmail.com>.
This is my recollection from the distant past, it could be wrong in several ways.

IIRC if you have a factory component, when you call it to create a component the properties are a mix of the factory component’s properties and the ones you supply.

Furthermore, the spec says if you change the factory component’s properties, all the previously created instances are immediately disposed of. If the manually created component instances are used as dependencies this might not be what you want.

So, IIRC, setting this property changes the behavior when you change the factory properties so the created instances are not automatically disposed of.

I thought I’d documented all the non-standard behaviors I implemented, but this certainly isn’t in the .md.

David Jencks

> On Apr 25, 2023, at 6:56 AM, Raymond Augé <ra...@liferay.com.INVALID> wrote:
> 
> Hello all,
> 
> Could someone explain what it means to use
> 
> felix:persistentFactoryComponent="true"
> 
> As in:
> 
> <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
> 
> xmlns:felix="http://felix.apache.org/xmlns/scr/extensions/v1.0.0">
> 
> 
> <scr:component name="factory.component"
> 
> felix:persistentFactoryComponent="true"
> 
> enabled="false"
> 
> factory="factory.component.factory" >
> 
> <implementation class="
> org.apache.felix.scr.integration.components.SimpleComponent" />
> 
> </scr:component>
> 
> ...
> 
> -- 
> *Raymond Augé* (@rotty3000)
> Senior Software Architect *Liferay, Inc.* (@Liferay)
> OSGi Fellow, Java Champion


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