How can I make my thread to allow Long-running operations?
Please help.
I was getting the following exception. What should I do to make my thread acceptable by ThreadCheck's checkLongOpsAllowed method. Thanks, Weiping ========================================================== java.lang.IllegalStateException: Long-running operations prohibited on this thread at com.ibm.team.repository.client.util.ThreadCheck.checkLongOpsAllowed(ThreadCheck.java:115) at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:78) at $Proxy9.save(Unknown Source) at com.ibm.rmc.jazz.uma.convert.impl.UmaAdaptorMgrImpl03$1.visit(UmaAdaptorMgrImpl03.java:338) at com.ibm.rmc.jazz.uma.convert.impl.RmcJazzObjectMgr.visitedBy(RmcJazzObjectMgr.java:69) at com.ibm.rmc.jazz.uma.convert.impl.UmaAdaptorMgrImpl03$2.run(UmaAdaptorMgrImpl03.java:353) at java.lang.Thread.run(Thread.java:801) at com.ibm.rmc.jazz.uma.convert.impl.UmaAdaptorMgrImpl03.saveMethodLibrary(UmaAdaptorMgrImpl03.java:361) at com.ibm.rmc.jazz.uma.library.JazzResourceSetImpl.save(JazzResourceSetImpl.java:53) at |
Accepted answer
Typically this exception indicates that you are on the UI thread. It is
trying to warn you that calling a long running operation (like making a network call) on the UI thread will lock up the UI. Try using a org.eclipse.core.runtime.jobs.Job to put your network call on a non-UI thread. It would look something like this: Job job = new Job("my job") { protected abstract IStatus run(IProgressMonitor monitor) { // your longop call here } }; job.schedule(); // start the job wlu wrote: Please help. Ralph Schoon selected this answer as the correct answer
|
5 other answers
You may also want to take a look at
com.ibm.team.jface.util.UIUpdaterJob which allows you to easily split your work in a long-running background part and a short-running UI part. --Patrick |
Thank both of you. I tried using the Job scheduling approach, and it worked fine.
Comments
Kamal Suruguchi
commented Jun 21 '12, 11:06 a.m.
I ran into the same problem and then used the Job scheduling approach. But what I have noticed is that this approach avoids the exception only for the first time. But if I try to do the same thing again (my op was actually to update the work item status), then I get the same illegal state exception "Long-running operations prohibited on this thread" for the Job thread. What can I do here? |
For using com.ibm.team.jface.util.UIUpdaterJob, where the com.ibm.team.jface.util package is located? I could not find it under the 1.0Beta2 client/source codes.
|
wlu schrieb:
For using com.ibm.team.jface.util.UIUpdaterJob, where the It's plugin com.ibm.team.jface. Cheers, Toby |
What are the differences between "com.ibm.team.jface.util.UIUpdaterJob" and "com.ibm.team.foundation.client.util.FoundationJob"?
|
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.