You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Simon Laws <si...@googlemail.com> on 2011/05/26 13:42:23 UTC

Exception on Init

I'm working on a test to look at the lifecycle events to make sure
that they happen in the right places [1]. One of the tests looks at
what happens when an exception is thrown in the @Init operation. It
happens to use the domain node implementation and does the following
when starting the composite...

        // start a composite
        try {
            node.startComposite("HelloworldContrib", "lifecycle.composite");

            // stop a composite - it won't do this
            node.stopComposite("HelloworldContrib", "lifecycle.composite");
        } catch (Exception exception) {
            // it's thrown from the HelloworldClientImpl @Init method
        }

I did run the test to see what happens if I try and stop the composite
after the error and the runtime reports.

java.lang.IllegalStateException: not supportted for LocalOnly
	at org.apache.tuscany.sca.core.assembly.impl.DomainRegistryImpl.remoteCommand(DomainRegistryImpl.java:251)
	at org.apache.tuscany.sca.impl.NodeImpl.stopComposite(NodeImpl.java:270)
	at org.apache.tuscany.sca.itest.lifecycle.LifecycleTestCase.testInitExceptionShutdown(LifecycleTestCase.java:113)

It looks like it tries to do remote things if it doesn't find a
started composite when it's asked to stop one. It would be good to be
able to call the stop operation regardless and have is just warn that
there isn't a composite to stop.

Regards

Simon

[1] http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Exception on Init

Posted by Simon Laws <si...@googlemail.com>.
On Thu, May 26, 2011 at 1:30 PM, Simon Laws <si...@googlemail.com> wrote:
> On Thu, May 26, 2011 at 1:17 PM, ant elder <an...@gmail.com> wrote:
>> On Thu, May 26, 2011 at 12:42 PM, Simon Laws <si...@googlemail.com> wrote:
>>> I'm working on a test to look at the lifecycle events to make sure
>>> that they happen in the right places [1]. One of the tests looks at
>>> what happens when an exception is thrown in the @Init operation. It
>>> happens to use the domain node implementation and does the following
>>> when starting the composite...
>>>
>>>        // start a composite
>>>        try {
>>>            node.startComposite("HelloworldContrib", "lifecycle.composite");
>>>
>>>            // stop a composite - it won't do this
>>>            node.stopComposite("HelloworldContrib", "lifecycle.composite");
>>>        } catch (Exception exception) {
>>>            // it's thrown from the HelloworldClientImpl @Init method
>>>        }
>>>
>>> I did run the test to see what happens if I try and stop the composite
>>> after the error and the runtime reports.
>>>
>>> java.lang.IllegalStateException: not supportted for LocalOnly
>>>        at org.apache.tuscany.sca.core.assembly.impl.DomainRegistryImpl.remoteCommand(DomainRegistryImpl.java:251)
>>>        at org.apache.tuscany.sca.impl.NodeImpl.stopComposite(NodeImpl.java:270)
>>>        at org.apache.tuscany.sca.itest.lifecycle.LifecycleTestCase.testInitExceptionShutdown(LifecycleTestCase.java:113)
>>>
>>> It looks like it tries to do remote things if it doesn't find a
>>> started composite when it's asked to stop one. It would be good to be
>>> able to call the stop operation regardless and have is just warn that
>>> there isn't a composite to stop.
>>>
>>
>> I've just changed it so that doesn't happen and now its throwing an
>> IllegalStateException saying "composite not started:
>> lifecycle.composite". Does that do more closely what you want?
>>
>>   ...ant
>>
>
> Sounds spot on. Let me give it a try.
>
> Thanks
>
> Simon
>
>
> --
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>

Looks good Ant.

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Exception on Init

Posted by Simon Laws <si...@googlemail.com>.
On Thu, May 26, 2011 at 1:17 PM, ant elder <an...@gmail.com> wrote:
> On Thu, May 26, 2011 at 12:42 PM, Simon Laws <si...@googlemail.com> wrote:
>> I'm working on a test to look at the lifecycle events to make sure
>> that they happen in the right places [1]. One of the tests looks at
>> what happens when an exception is thrown in the @Init operation. It
>> happens to use the domain node implementation and does the following
>> when starting the composite...
>>
>>        // start a composite
>>        try {
>>            node.startComposite("HelloworldContrib", "lifecycle.composite");
>>
>>            // stop a composite - it won't do this
>>            node.stopComposite("HelloworldContrib", "lifecycle.composite");
>>        } catch (Exception exception) {
>>            // it's thrown from the HelloworldClientImpl @Init method
>>        }
>>
>> I did run the test to see what happens if I try and stop the composite
>> after the error and the runtime reports.
>>
>> java.lang.IllegalStateException: not supportted for LocalOnly
>>        at org.apache.tuscany.sca.core.assembly.impl.DomainRegistryImpl.remoteCommand(DomainRegistryImpl.java:251)
>>        at org.apache.tuscany.sca.impl.NodeImpl.stopComposite(NodeImpl.java:270)
>>        at org.apache.tuscany.sca.itest.lifecycle.LifecycleTestCase.testInitExceptionShutdown(LifecycleTestCase.java:113)
>>
>> It looks like it tries to do remote things if it doesn't find a
>> started composite when it's asked to stop one. It would be good to be
>> able to call the stop operation regardless and have is just warn that
>> there isn't a composite to stop.
>>
>
> I've just changed it so that doesn't happen and now its throwing an
> IllegalStateException saying "composite not started:
> lifecycle.composite". Does that do more closely what you want?
>
>   ...ant
>

Sounds spot on. Let me give it a try.

Thanks

Simon


-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Exception on Init

Posted by ant elder <an...@gmail.com>.
On Thu, May 26, 2011 at 12:42 PM, Simon Laws <si...@googlemail.com> wrote:
> I'm working on a test to look at the lifecycle events to make sure
> that they happen in the right places [1]. One of the tests looks at
> what happens when an exception is thrown in the @Init operation. It
> happens to use the domain node implementation and does the following
> when starting the composite...
>
>        // start a composite
>        try {
>            node.startComposite("HelloworldContrib", "lifecycle.composite");
>
>            // stop a composite - it won't do this
>            node.stopComposite("HelloworldContrib", "lifecycle.composite");
>        } catch (Exception exception) {
>            // it's thrown from the HelloworldClientImpl @Init method
>        }
>
> I did run the test to see what happens if I try and stop the composite
> after the error and the runtime reports.
>
> java.lang.IllegalStateException: not supportted for LocalOnly
>        at org.apache.tuscany.sca.core.assembly.impl.DomainRegistryImpl.remoteCommand(DomainRegistryImpl.java:251)
>        at org.apache.tuscany.sca.impl.NodeImpl.stopComposite(NodeImpl.java:270)
>        at org.apache.tuscany.sca.itest.lifecycle.LifecycleTestCase.testInitExceptionShutdown(LifecycleTestCase.java:113)
>
> It looks like it tries to do remote things if it doesn't find a
> started composite when it's asked to stop one. It would be good to be
> able to call the stop operation regardless and have is just warn that
> there isn't a composite to stop.
>

I've just changed it so that doesn't happen and now its throwing an
IllegalStateException saying "composite not started:
lifecycle.composite". Does that do more closely what you want?

   ...ant