Long running operation and performance
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.
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
On Thu, 18 Mar 2010 09:38:04 +0000, raga wrote:
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
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