It's all about the answers!

Ask a question

How can I make my thread to allow Long-running operations?


Weiping Lu (452910) | asked Jan 14 '08, 9:26 p.m.
JAZZ DEVELOPER
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


permanent link
Chris Daly (61651) | answered Jan 15 '08, 12:38 a.m.
JAZZ DEVELOPER
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.

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)
Ralph Schoon selected this answer as the correct answer

5 other answers



permanent link
Patrick Streule (4.9k21) | answered Jan 15 '08, 4:08 a.m.
JAZZ DEVELOPER
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

permanent link
Weiping Lu (452910) | answered Jan 15 '08, 8:32 p.m.
JAZZ DEVELOPER
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?


permanent link
Weiping Lu (452910) | answered Jan 15 '08, 8:40 p.m.
JAZZ DEVELOPER
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.

permanent link
Tobias Widmer (3211) | answered Jan 18 '08, 4:58 a.m.
wlu schrieb:
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.


It's plugin com.ibm.team.jface.

Cheers,
Toby

permanent link
Albert Yao (5411322) | answered Jan 29 '15, 11:59 a.m.
 What are the differences between "com.ibm.team.jface.util.UIUpdaterJob" and "com.ibm.team.foundation.client.util.FoundationJob"?

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.