Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link
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

1 vote


5 other answers

Permanent link
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

2 votes


Permanent link
Thank both of you. I tried using the Job scheduling approach, and it worked fine.

0 votes

Comments

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
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.

0 votes


Permanent link
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

0 votes


Permanent link
 What are the differences between "com.ibm.team.jface.util.UIUpdaterJob" and "com.ibm.team.foundation.client.util.FoundationJob"?

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,953

Question asked: Jan 14 '08, 9:26 p.m.

Question was seen: 12,933 times

Last updated: Jan 29 '15, 11:59 a.m.

Confirmation Cancel Confirm