You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Scott Kurz <sc...@gmail.com> on 2009/02/17 00:53:36 UTC

What to do with instance when RuntimeException thrown from @Init?

I feel like I remember seeing this conversation before but can't find it in
my mail search.

Just noticing that if we throw a RuntimeException from an @Init method in a
composite-scoped component ... then the instance gets used anyway even
though it may have failed to initialize.

Was thinking it would be a useful service for the container to provide to
discard the instance, under the assumption that the next time the service is
invoked, we'll retry the instance creation, since maybe later the @Init will
complete successfully?

Don't see anything in a very quick scan of the specs but I didn't look
thoroughly.

Any thoughts on this?

Thanks,
Scott

Re: What to do with instance when RuntimeException thrown from @Init?

Posted by Scott Kurz <sc...@gmail.com>.
Thanks Mark for the quick response:

Opened JIRA:
https://issues.apache.org/jira/browse/TUSCANY-2851

to remind us to address this as agreement here is reached.

Scott



On Tue, Feb 17, 2009 at 3:41 AM, Mark Combellack <mc...@apache.org>wrote:

>  Hi Scott,
>
>
>
> There are two outstanding OASIS issues regarding this problem. Basically,
> the spec does not say what should happen but it should.
>
>
>
> The relevant issues are:
>
>
>
> http://www.osoa.org/jira/browse/JAVA-65             There is no lifecycle
> defined for SCA Components
>
> http://www.osoa.org/jira/browse/JAVA-53             What happens if init()
> throws a runtime exception
>
>
>
> JAVA-65 provides a proposal that will define the lifecycle for SCA
> Components and explicitly details what to do with exceptions. The proposal
> has not yet been accepted so may well be tweaked before it is included in
> the specification.
>
>
>
> Thanks,
>
>
>
> Mark
>   ------------------------------
>
> *From:* Scott Kurz [mailto:scottkurz@gmail.com]
> *Sent:* 16 February 2009 23:54
> *To:* dev@tuscany.apache.org
> *Subject:* What to do with instance when RuntimeException thrown from
> @Init?
>
>
>
> I feel like I remember seeing this conversation before but can't find it in
> my mail search.
>
> Just noticing that if we throw a RuntimeException from an @Init method in a
> composite-scoped component ... then the instance gets used anyway even
> though it may have failed to initialize.
>
> Was thinking it would be a useful service for the container to provide to
> discard the instance, under the assumption that the next time the service is
> invoked, we'll retry the instance creation, since maybe later the @Init will
> complete successfully?
>
> Don't see anything in a very quick scan of the specs but I didn't look
> thoroughly.
>
> Any thoughts on this?
>
> Thanks,
> Scott
>

RE: What to do with instance when RuntimeException thrown from @Init?

Posted by Mark Combellack <mc...@apache.org>.
Hi Scott,

 

There are two outstanding OASIS issues regarding this problem. Basically,
the spec does not say what should happen but it should.

 

The relevant issues are:

 

http://www.osoa.org/jira/browse/JAVA-65             There is no lifecycle
defined for SCA Components

http://www.osoa.org/jira/browse/JAVA-53             What happens if init()
throws a runtime exception

 

JAVA-65 provides a proposal that will define the lifecycle for SCA
Components and explicitly details what to do with exceptions. The proposal
has not yet been accepted so may well be tweaked before it is included in
the specification.

 

Thanks,

 

Mark

  _____  

From: Scott Kurz [mailto:scottkurz@gmail.com] 
Sent: 16 February 2009 23:54
To: dev@tuscany.apache.org
Subject: What to do with instance when RuntimeException thrown from @Init?

 

I feel like I remember seeing this conversation before but can't find it in
my mail search.

Just noticing that if we throw a RuntimeException from an @Init method in a
composite-scoped component ... then the instance gets used anyway even
though it may have failed to initialize. 

Was thinking it would be a useful service for the container to provide to
discard the instance, under the assumption that the next time the service is
invoked, we'll retry the instance creation, since maybe later the @Init will
complete successfully?   

Don't see anything in a very quick scan of the specs but I didn't look
thoroughly.

Any thoughts on this?

Thanks,
Scott