felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Sauthier (OW2/GMail)" <guillaume....@gmail.com>
Subject Re: [iPOJO] how to control when instance starts?
Date Sat, 04 May 2013 21:55:27 GMT
1) Yes, when created, instances are auto started.
ComponentInstance.start() is useful because you can start/stop the instance
plenty of times

2) Looks like the annotations are not read with the API, Maybe Clement can
confirm. if that's true, it's a bug.

3) when instance is started, that really means the component instance
management begins, this includes starting all the handlers (start tracking
of dependencies, configuration injection, ...). The real POJO instance
(instance of the class you wrote) will be instantiated only if all handlers
are valid. So POJO instance may not be started/created when component
instance is started.
So if you're referring to the POJO instance, you may control its lifecycle
with something like a @Controller handler, or playing with required
dependencies. If you're referring to the component instance, you have no
real choice ATM since its started automatically after creation. You can
stop the component instance, but it's possible that it succeded to be VALID
on creation.

--G



2013/5/4 Michiel Vermandel <mvermand@yahoo.com>

> Hi,
>
> I create a component instance like this:
>
> ComponentInstance instance = new PrimitiveComponentType()
>             .setBundleContext(context)
>             .setClassName(BeanFilterImpl.class.getName())
>             .setValidateMethod("start")
>
> .createInstance("com.ce.flowbeans.impl.BeanFilterImpl-1455-8997-5268-2476");
>
> 1) It seems that the moment that createInstance is called, the start
> method is called.
> Is this normal? If so, then what is the purpose of instance.start()?
>
>
> 2) I have the annotation @Validate on my start method of my component.
> Though, when I do not add .setValidateMethod("start") then the component
> is not started, not even when I call instance.start() ?
>
> 3) Is there a way to create an instance and have control over the moment
> when the instance is started?
>
> Thanks
>
> Michiel
>
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message