Wow, your're fast...

I'll try both the workaround and the fix since I'll probably need to use the
workaround until the next iPOJO release.

/Bengt

2010/11/10 Clement Escoffier <[email protected]>

>
>
> On 10.11.10 20:45, "Bengt Rodehav" <[email protected]> wrote:
>
> >Thanks a lot Clement. I'll try your workaround while wating for a fix on
> >trunk.
>
> Already Fixed in trunk :-)
>
> Clement
>
> >
> >/Bengt
> >
> >2010/11/10 Clement Escoffier <[email protected]>
> >
> >> Hi,
> >>
> >> So, I've checked. So, what I explained works correctly. So if the
> >>instance
> >> is INVALID and we reconfigure the instance, the instance state is
> >> recomputed. However... In your case you're not INVALID but STOPPED.
> >> Indeed, when the constructor or a @Validate callback throw an exception,
> >> the instance is shutdown.
> >>
> >> Unfortunately, when a stopped instance is reconfigured, the state is not
> >> recomputed. That's definitely a bug (and a pretty nice catch !). The
> >> instance should be restarted with the new configuration. This issue will
> >> be fixed pretty soon in the trunk.
> >>
> >> What you can do for now is to use a lifecycle controller (@Controller),
> >> catch the Exception and set the controller to false. Then the instance
> >>is
> >> invalid not stopped.
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >>
> >> On 10.11.10 18:00, "Bengt Rodehav" <[email protected]> wrote:
> >>
> >> >Thanks Clement.
> >> >
> >> >I forgot to write that I use iPOJO 1.6.6.
> >> >
> >> >/Bengt
> >> >
> >> >2010/11/10 Clement Escoffier <[email protected]>
> >> >
> >> >> Hi,
> >> >>
> >> >>
> >> >> On 10.11.10 17:04, "Bengt Rodehav" <[email protected]> wrote:
> >> >>
> >> >> >I create iPOJO instances from factory configurations using
> >> >>Configuration
> >> >> >Admin and File Install. When the iPOJO instance becomes valid I do
> >>my
> >> >> >initialisation (which normally starts a Camel route) and when the
> >>iPOJO
> >> >> >instance becomes invalid I terminate my processing (which means
> >>that I
> >> >> >normally stop a Camel route).
> >> >> >
> >> >> >  @Validate
> >> >> >  public void start() {
> >> >> >    // Start the route
> >> >> >  }
> >> >> >
> >> >> >  @Invalidate
> >> >> >  public void stop() {
> >> >> >    // Stop the route
> >> >> >  }
> >> >> >
> >> >> >To make it possible to control my iPOJO instances I use a controller
> >> >> >property as follows:
> >> >> >
> >> >> >  @Controller
> >> >> >  @Property(name = "enable", mandatory = true)
> >> >> >  private boolean mValid;
> >> >> >
> >> >> >This allows me to enable/disable my service via configuration.
> >> >>However, I
> >> >> >have noticed that if an exception is thrown in the start() method
> >> >>above,
> >> >> >then the iPOJO becomes invalid and there is no way for me to make it
> >> >>valid
> >> >> >by changing any configuration property. It seems like I have to
> >>delete
> >> >>the
> >> >> >configuration and create a new one. Have I understood this
> >>correctly?
> >> >>
> >> >> Modifying the configuration should trigger a reconfiguration of the
> >> >> instance. It should then recompute the state (in theory it should
> >>work).
> >> >> Deleting the configuration disposes the instance and recreates a new
> >> >>one.
> >> >>
> >> >> >
> >> >> >I would like a convenient way to either make my iPOJO instance valid
> >> >>again
> >> >> >or a way to dispose of the old instance and create a new one. How
> >>can I
> >> >> >accomplish this? It would be convenient if I could flag my iPOJO
> >>class
> >> >> >with
> >> >> >an annotation like "deleteOnException" or something like that.
> >> >>
> >> >> Modifying the configuration should do the work. I will check that.
> >> >>
> >> >> Regards,
> >> >>
> >> >> Clement
> >> >>
> >> >> >
> >> >> >/Bengt
> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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