It's all about the answers!

Ask a question

How to call service at logout without getting an exception?

Samantha Chan (11) | asked Jun 06 '08, 6:28 p.m.

I have registered login participant to get notified when the user has logged out. Upon logout, I need to call into my service on the server to do cleanup. This has worked great until M6a. After migrating to RC4, I found that the login participant is being called on the UI thread. When I made the call to the service to do clean up, I got the following exception:

java.lang.IllegalStateException: Long-running operations prohibited on this thread

Since the user is logging out, I am not able to schedule a background job to do my task. By the time my job is run, the user may have already logged out, and I am no longer able to call my service.

Is there a reason why the login participant is called on the UI thread? Is there a way to do this clean up without getting into this exception? Can I get notified that a user is logged out on the server side?


One answer

permanent link
Rafik Jaouani (5.0k16) | answered Jun 07 '08, 8:34 a.m.
Samantha, I would avoid using the login participant for the purpose of UI and server clean up. The API was there before we introduced eventing on the client and should have been deprecated. I recommend using a listener on the ITeamRepository.STATE property.
Doing clean up on the server as a result of a logout, won't be helpful as it would not take care of cases where someone exits eclipse without logout or when the client machine crashes. Having used Team Concert for the past 2 years, I rarely logout.
Do you mind if I ask what kind of clean up are you doing on the server?

Your answer

Register or to post your answer.