You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Michiel Vermandel <mv...@yahoo.com> on 2013/05/21 12:52:49 UTC

[iPOJO] FieldInterceptor question

Hi,

I want to use the FieldInterceptor capabilities to initialize a field.
It isn't hard to do but after analyzing the source code (InstanceManager.java) I'm a bit afraid of the overhead of using a FieldInterceptor.
It seems to do quite a lot.
In my scenario, I just want to initialize the field upon first access and then, once initialized, the FieldInterceptor should not do anything anymore.
Is this possible?

Thanks,

Michiel


 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials

Re: [iPOJO] FieldInterceptor question

Posted by Michiel Vermandel <mv...@yahoo.com>.
>what about injecting the value using reflection
 
That is what I'm doing right now.
I just wanted to try to minimize my own code... avoiding to reinvent the wheel ;-)

Regards


-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Clement Escoffier <cl...@gmail.com>
To: users@felix.apache.org; Michiel Vermandel <mv...@yahoo.com> 
Sent: Tuesday, May 21, 2013 3:41 PM
Subject: Re: [iPOJO] FieldInterceptor question
 

Hi,

If you are sure you are not interested by the value set by the component code, then what about injecting the value using reflection (so without a field interceptor) ? 

Regards,

Clement

On 21 mai 2013, at 15:17, Michiel Vermandel <mv...@yahoo.com> wrote:

> Hi Clement,
> 
> I know it its possible like that, but I am a bit afraid that the overhead of this implementation will be considerable if this field is called very frequently.
> 
> Regards,
> 
> Michiel
> 
> 
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
> 
> 
> ________________________________
> From: Clement Escoffier <cl...@gmail.com>
> To: users@felix.apache.org; Michiel Vermandel <mv...@yahoo.com> 
> Sent: Tuesday, May 21, 2013 1:15 PM
> Subject: Re: [iPOJO] FieldInterceptor question
> 
> 
> 
> Hi,
> 
> Yes of course.
> 
> Check this handler (used for testing purpose) doing somewhat what you want:
> https://github.com/apache/felix/blob/trunk/ipojo/runtime/core-it/src/it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java
> 
> Regards,
> 
> Clement
> 
> 
> On 21 mai 2013, at 12:52, Michiel Vermandel <mv...@yahoo.com> wrote:
> 
> Hi,
>> 
>> I want to use the FieldInterceptor capabilities to initialize a field.
>> It isn't hard to do but after analyzing the source code (InstanceManager.java) I'm a bit afraid of the overhead of using a FieldInterceptor.
>> It seems to do quite a lot.
>> In my scenario, I just want to initialize the field upon first access and then, once initialized, the FieldInterceptor should not do anything anymore.
>> Is this possible?
>> 
>> Thanks,
>> 
>> Michiel
>> 
>> 
>>  
>> -----------------
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials

Re: [iPOJO] FieldInterceptor question

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

If you are sure you are not interested by the value set by the component code, then what about injecting the value using reflection (so without a field interceptor) ? 

Regards,

Clement

On 21 mai 2013, at 15:17, Michiel Vermandel <mv...@yahoo.com> wrote:

> Hi Clement,
> 
> I know it its possible like that, but I am a bit afraid that the overhead of this implementation will be considerable if this field is called very frequently.
> 
> Regards,
> 
> Michiel
> 
> 
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
> 
> 
> ________________________________
> From: Clement Escoffier <cl...@gmail.com>
> To: users@felix.apache.org; Michiel Vermandel <mv...@yahoo.com> 
> Sent: Tuesday, May 21, 2013 1:15 PM
> Subject: Re: [iPOJO] FieldInterceptor question
> 
> 
> 
> Hi,
> 
> Yes of course.
> 
> Check this handler (used for testing purpose) doing somewhat what you want:
> https://github.com/apache/felix/blob/trunk/ipojo/runtime/core-it/src/it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java
> 
> Regards,
> 
> Clement
> 
> 
> On 21 mai 2013, at 12:52, Michiel Vermandel <mv...@yahoo.com> wrote:
> 
> Hi,
>> 
>> I want to use the FieldInterceptor capabilities to initialize a field.
>> It isn't hard to do but after analyzing the source code (InstanceManager.java) I'm a bit afraid of the overhead of using a FieldInterceptor.
>> It seems to do quite a lot.
>> In my scenario, I just want to initialize the field upon first access and then, once initialized, the FieldInterceptor should not do anything anymore.
>> Is this possible?
>> 
>> Thanks,
>> 
>> Michiel
>> 
>> 
>>  
>> -----------------
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials


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


Re: [iPOJO] FieldInterceptor question

Posted by Michiel Vermandel <mv...@yahoo.com>.
Hi Clement,

I know it its possible like that, but I am a bit afraid that the overhead of this implementation will be considerable if this field is called very frequently.

Regards,

Michiel


 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Clement Escoffier <cl...@gmail.com>
To: users@felix.apache.org; Michiel Vermandel <mv...@yahoo.com> 
Sent: Tuesday, May 21, 2013 1:15 PM
Subject: Re: [iPOJO] FieldInterceptor question
 


Hi,

Yes of course.

Check this handler (used for testing purpose) doing somewhat what you want:
https://github.com/apache/felix/blob/trunk/ipojo/runtime/core-it/src/it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java

Regards,

Clement


On 21 mai 2013, at 12:52, Michiel Vermandel <mv...@yahoo.com> wrote:

Hi,
>
>I want to use the FieldInterceptor capabilities to initialize a field.
>It isn't hard to do but after analyzing the source code (InstanceManager.java) I'm a bit afraid of the overhead of using a FieldInterceptor.
>It seems to do quite a lot.
>In my scenario, I just want to initialize the field upon first access and then, once initialized, the FieldInterceptor should not do anything anymore.
>Is this possible?
>
>Thanks,
>
>Michiel
>
>
> 
>-----------------
>http://www.codessentials.com - Your essential software, for free!
>Follow us at http://twitter.com/#!/Codessentials

Re: [iPOJO] FieldInterceptor question

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

Yes of course.

Check this handler (used for testing purpose) doing somewhat what you want:
https://github.com/apache/felix/blob/trunk/ipojo/runtime/core-it/src/it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java

Regards,

Clement

On 21 mai 2013, at 12:52, Michiel Vermandel <mv...@yahoo.com> wrote:

> Hi,
> 
> I want to use the FieldInterceptor capabilities to initialize a field.
> It isn't hard to do but after analyzing the source code (InstanceManager.java) I'm a bit afraid of the overhead of using a FieldInterceptor.
> It seems to do quite a lot.
> In my scenario, I just want to initialize the field upon first access and then, once initialized, the FieldInterceptor should not do anything anymore.
> Is this possible?
> 
> Thanks,
> 
> Michiel
> 
> 
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials