It's all about the answers!

Ask a question

IllegalStateException when calling TeamPlatform.shutdown()


0
1
Dan Rivett (1211115) | asked Sep 18 '09, 5:22 a.m.
I've written some ant tasks which use the RTC API to query and update RTC. Each task starts off by calling TeamPlatform.startup() then it does it's work, then it finishes by calling TeamPlatform.shutdown().

When I have more than one RTC task in an ant build script, the TeamPlatform is started and stopped more than once, however it's only ever restarted after shutdown() had been called before.

The problem I'm getting is that after the first RTC task has completed, even though TeamPlatform.isStarted() returns true (because I have restarted the platform in the 2nd ant task) when I call shutdown() I receive an IllegalStateException:


java.lang.IllegalStateException: Already stopped
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.shutdown(InternalTeamPlatform.java:112)
at com.ibm.team.repository.client.TeamPlatform.shutdown(TeamPlatform.java:60)


After having a look at the RTC source I can see that there is a 'stopped' variable which is checked and if it's true the exception above is thrown. The issue is that allthough it's set to true on the first shutdown() call, when startup() is called it is not set to false.

Normally you would only ever need to call startup() and shutdown() once per jvm lifetime, but in this case where I have independent RTC ant tasks, I may have more than one in my build file.

Therefore my request is would it be possible to have startup() and shutdown() perform so that we can round-trip the calls? ie once we've shutdown we have tidied up enough so we can call startup() again if needed?

In this case the stopped field needs reseting to false in the startup() method, but there might be other things that need tidying up in the shutdown() method to make calling startup() again ok.

If this seems an appropriate request (certainly help the ant scenario) I can raise an enhancement.

And as a workaround for this, this only happens if the two RTC tasks share the same loaderref, if not, individual environments are used so they don't share static variables. But since I had used the same loaderref for performance reasons I thought I'd raise this request to gather opinion.

Many thanks,
Dan

One answer



permanent link
Dan Rivett (1211115) | answered Sep 18 '09, 5:27 a.m.
Or if the code is ok with round-tripping already, and it's just the stopped field that needs setting to false in the startup() method, I can file a defect.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.