It's all about the answers!

Ask a question

TeamPlatform.shutdown(): cannot shutdown


1
1
Lin Ye (30632611) | asked Mar 24 '10, 4:11 p.m.
Hi,

I got a problem with TeamPlatform.shutdown(). I have a widget with a button "Show Available Project Areas". The button has a listener that calls the following method

public List<String> getProjectAreas(){
List<String> projectAreas = null;

TeamPlatform.startup();
try {
// code for login and retrieving active project areas

} catch (Exception x) {
x.printStackTrace();
} finally {
if (TeamPlatform.isStarted()) {
TeamPlatform.shutdown();
}

}
return projectAreas;
}

The button event listener that calls the method is:
availableProjectAreas.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event){

List<String> projectAreas = getProjectAreas();

}
});


The problem is: I click the button for the first time, everything is ok. Then I click it for a second time, I got exceptions as:
Exception in thread "main" 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)
at com.ibm.team.workitem.ide.ui.example.widgets.GroupRTC.getProjectAreas(GroupRTC.java:144)

GroupRTC.java:144 is the line TeamPlatform.shutdown() in the finally block.

Can I ask here that if TeamPlatform.isStarted() returns true, why TeamPlatform.shutdown() throws an exception as "Already stopped"?

thank you very much
Lin

8 answers



permanent link
Alberto Ceravolo (1698) | answered Apr 14 '10, 6:44 a.m.
I have the same problem. Maybe a defect (e.g. some field isn't correctly setted when are called startup() and/or shutdown() methods)?

permanent link
Patrick Streule (4.9k21) | answered Apr 15 '10, 4:14 a.m.
JAZZ DEVELOPER
public List<String> getProjectAreas(){
List<String> projectAreas = null;

TeamPlatform.startup();
try {
// code for login and retrieving active project areas

} catch (Exception x) {
x.printStackTrace();
} finally {
if (TeamPlatform.isStarted()) {
TeamPlatform.shutdown();
}

}
return projectAreas;
}

You should start the TeamPlatform when your application starts and shut
it down when your application ends.

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Luk Stephenson (51111) | answered Apr 29 '10, 10:11 a.m.

You should start the TeamPlatform when your application starts and shut
it down when your application ends.


I'm also seeing the same problem. I don't think the previous response answers the question / issue.

permanent link
Patrick Streule (4.9k21) | answered Apr 30 '10, 1:15 p.m.
JAZZ DEVELOPER
I'm also seeing the same problem. I don't think the previous response
answers the question / issue.

It doesn't make sense to start and stop the platform within a method.

The TeamPlatform lifecycle should correspond to the application's
lifecycle in most cases. If this is not possible in your case, please
create a defect for this issue on jazz.net.

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Ravindranath Manjusha (16) | answered Jul 22 '11, 2:14 p.m.
I am using RTC 3.0.1 server and client,and we we first call TeamPlatform.startup() method before we process our xml artfacts in a method in our JAVA business logic.When we are done processing artifacts we call TeamPlatform.shutdown() method after checking if TeamPlatform.isStarted() or not ,(but in the same method)

processArtifact{
TeamPlatform.startup();
try{
//logic to process artfacts in a for loop
}
catch(){}
finally {
if (TeamPlatform.isStarted())
TeamPlatform.shutdown();
}
}
Its fine for the first artifact,but for others it throws this error
Throwable occurred: java.lang.IllegalStateException: Already stopped
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.shutdown(InternalTeamPlatform.java:113)
at com.ibm.team.repository.client.TeamPlatform.shutdown(TeamPlatform.java:61)

Can this TeamPlatform.shutdown(); method in the finally clause
be commented out totally or do we still need this at the end of the application but maybe in a different method?

permanent link
Andy Berner (61127) | answered Jul 26 '11, 4:54 p.m.
Hi,

I got a problem with TeamPlatform.shutdown(). I have a widget with a button "Show Available Project Areas". The button has a listener that calls the following method ]

Jazz team, please check this answer, since it may have changed in recent releases: You should skip the call to shutdown() altogether.

This has been a bug in TeamPlatform.shutdown() since the first release of RTC. I haven't checked the recent source code, but in earlier versions, there weere two private boolean variables "isStarted" and "isStopped"; both were initialized to false. Starting the team platform changes "isStarted" to true, but doesn't change isStopped. TeamPlatform.shutdown() checks whether the internal boolean "isStopped" is true or false. If it's false, it sets it to true, but doesn't really do anything else (which is why you can skip calling it during your program, and at the end of the program, garbage collection and other shutdown code takes care of releasing resources). If it's true, it throws the exception you're getting. But after that first time, it will always be true because TeamPlatform.startup() doesn't reset "isStopped" to false.

This is significant if, for example, you're calling the code from a servlet. You need to start the platform the first time the servlet executes, but if you stop it in your servlet code, you'll get the exception when another user calls the servlet.

permanent link
Geoff Alexander (19623948) | answered Aug 10 '11, 5:51 p.m.
We are also encountering this problem. I searched for an existing RTC Defect, but didn't find one. So I created RTC Defect 173878.

permanent link
Bilal Ahmed (5611) | answered Jul 11 '13, 7:49 p.m.
Hi,

I had the same problem when trying to execute TeamPlatform.startup() the second time via a servlet.
java.lang.IllegalStateException: Already stopped    
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.shutdown(InternalTeamPlatform.java:113)    
at com.ibm.team.repository.client.TeamPlatform.shutdown(TeamPlatform.java:61)
Surprisingly it works fine if you implement it as a standalone java program .i.e. called in the main (method) thread.

For my servlet I basically just commented out the following line:
if(TeamPlatform.isStarted())TeamPlatform.shutdown();
	

Not sure what the actual problem is though.


Comments
Albert Yao commented Jul 05 '21, 6:27 a.m.
I found these:

But I still encountered the same problem, though my RTC version is 6.0.3 :
java.lang.IllegalStateException: Already stopped
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.shutdown(InternalTeamPlatform.java:120)
at com.ibm.team.repository.client.TeamPlatform.shutdown(TeamPlatform.java:63)



Ralph Schoon commented Jul 05 '21, 6:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Why would you want to comment on an 8 year old answer?

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.