It's all about the answers!

Ask a question

Long running operation and performance


raga r (111) | asked Mar 18 '10, 5:37 a.m.
We have an Eclipse plug-in which extends RTC to create/update custom work items programmatically. Predictably,few operations from our UI end up throwing 'Long-running operations prohibited on this thread'. The solution of putting those operations in a seperate thread/job works fine but with a penalty of performance.

1) If the intention of throwing this exception is just not to leave the UI frozen during the operation, is there
any way of offsetting it to possibly shorter operations such as getting an attribute from a work item?

2) Invoking a 'Long-running operation' in a UI thread is going to do any harm other than freezing the UI? If not,
can we suppress the IllegalState exception and live without a non-UI thread for shorter operations?

In short, is there any better way of handling this problem without performance penalty of going for a separate thread/job.

Thanks in advance.

One answer



permanent link
Jared Burns (4.5k29) | answered Mar 18 '10, 2:34 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Thu, 18 Mar 2010 09:38:04 +0000, raga wrote:

We have an Eclipse plug-in which extends RTC to create/update custom
work items programmatically. Predictably,few operations from our UI end
up throwing 'Long-running operations prohibited on this thread'. The
solution of putting those operations in a seperate thread/job works fine
but with a penalty of performance.

1) If the intention of throwing this exception is just not to leave the
UI frozen during the operation, is there any way of offsetting it to
possibly shorter operations such as getting an attribute from a work
item?

2) Invoking a 'Long-running operation' in a UI thread is going to do any
harm other than freezing the UI? If not, can we suppress the
IllegalState exception and live without a non-UI thread for shorter
operations?

In short, is there any better way of handling this problem without
performance penalty of going for a separate thread/job.

Thanks in advance.

I personally have strong feelings about this one. Others may disagree.
But in my opinion, it is a cardinal sin to run a long op in the UI
thread. It's equivalent in my mind to a GPF because once you have the UI
thread blocked the only way for the user to exit the application is to
kill it - complete with the loss of unsaved data that that implies.

The overhead of spawning a background thread is totally insignificant,
but the gain in responsiveness for your application is massive.

In short, do it in a background thread.

--
Jared Burns
Jazz Process Team

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.