Hi,

On 11.01.11 21:19, "Loic Petit" <[email protected]> wrote:

>Oh... that's weird :)
>
>I'll check tomorrow what is different in my case... thank you about that !

iPOJO creates the POJO object only when required. In your case, it's when
the service will be used. If you'd like to initialize the object first,
you should not use the SERVICE strategy (one object per requiring bundle)
but keep the default one (Singleton) and add 'immediate=true' to your
@Component.

Regards,

Clement


>
>LP
>
>Le 11 janv. 2011 à 21:05, Richard S. Hall a écrit :
>
>> I created this component:
>> 
>> @Provides(strategy="SERVICE")
>> @Component
>> public class ServiceImpl implements Service
>> {
>>    @Validate
>>    public void ready()
>>    {
>>        System.out.println("Starting");
>>    }
>> 
>>   ...
>> 
>> And deployed it and instantiated an instance:
>> 
>> g! (getService ((getServiceReferences null
>>"(factory.name=main.bundle.ServiceImpl)") 0)) createComponentInstance
>>null
>> Starting
>> 
>> You can see that it prints out the "Starting" message, so it seems to
>>be working for me.
>> 
>> -> richard
>> 
>> 
>> On 1/11/11 13:00, Loic Petit wrote:
>>> Hi everyone,
>>> 
>>> I think I discovered a bug with iPojo.
>>> I quickly summarize what I do. I've got a class
>>> 
>>> @Component
>>> @Provides(strategy = "SERVICE")
>>> class A implements B {
>>>     @Validate
>>>     public void ready() {
>>>            // Initialize Stuff
>>>     }
>>> }
>>> 
>>> Then, inside my code, I create a new instance via the factory and the
>>>API.
>>> (mostly copied from
>>> 
>>>http://felix.apache.org/site/how-to-use-ipojo-factories.html#How-touseiP
>>>OJOfactories-Creatinginstances
>>> )
>>> Unfortunately, when I get the service via OSGi (or @Requires) the
>>>object is
>>> well created, the instance is valid, but the method @Validate is not
>>>called.
>>> 
>>> I tried this on the ipojo core versions 1.6.2, 1.6.8 release and on the
>>> trunk snapshot.
>>> Is it me or the core has a bug ? When I do a ipojo:instance on the
>>>created
>>> instance in the shell, I see that the handler callback is in the list
>>>but I
>>> did not look inside the code to see how it is handled.
>>> 
>>> Thanks
>>> 
>>> LP
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to