Occasional Invalid Thread Access [message #1743438] |
Thu, 15 September 2016 13:09 |
|
Hi al,,
We're developing a small standalone RAP application.
We often encountered Invalid Thread Access that severely degrades our user experience. The error is still happening eventhough we wrap the ui updates to Display#sync/async like below:
Display.getDefault().syncExec
(
new Runnable()
{
@Override
public void run()
{
String message = "No record available";
if (pagination != null)
{
if (pagination.getTotalRecordCount() > 0)
message = MessageFormat.format("Page {0} of {1}", new Object[] { Integer.valueOf(pagination.getCurrentPage()), Integer.valueOf(pagination.getTotalPageCount()) });
}
AbstractTabularForm.this.lblPageNumber.setText(message);
}
}
);
The error seems to be spreaded all over in our code, but above part is the most often.
Is there any other way we should do to prevent this error ?
Any help would be greatly appreciated.
Thanks & Regards,
Setya
|
|
|
|
|
|
Re: Occasional Invalid Thread Access [message #1744031 is a reply to message #1743642] |
Wed, 21 September 2016 14:34 |
|
Hi Ivan,
The problem still happens and easily reproduced when user opens the same URL on 2nd browser tab or the 2nd instance of the same browser.
The error occurs at editor#dispose of the following code:
RWT.getUISession().exec
(
new Runnable()
{
@Override
public void run()
{
for (TableEditor tableEditor : DefaultColumnLabelProvider.this.TABLE_EDITORS)
{
final Control editor = tableEditor.getEditor();
if (editor == null) continue;
if (!editor.isDisposed())
editor.dispose();
}
}
}
);
I've also tried Display#syncExec w/ display instance from outside background thread. Nothing worked.
But the problem did not occur when user opens the 2nd same URL on different browser brand.
Thanks & Regards,
Setya
|
|
|
|
|
Re: Occasional Invalid Thread Access [message #1744146 is a reply to message #1744087] |
Thu, 22 September 2016 17:28 |
|
Hi Ivan,
DefaultColumnLabelProvider extends ColumnLabelProvider and I instantiate this class for each table column that I use. TABLE_EDITORS is a final non-static field in DefaultColumnLabelProvider.
I use TABLE_EDITORS to contain all table editors created so that I can dispose them later when I rebuild the table items.
Finally I configure the form that contains this table in Spring using session scope.
Thanks & Regards,
Setya
|
|
|
Re: Occasional Invalid Thread Access [message #1744149 is a reply to message #1744105] |
Thu, 22 September 2016 17:55 |
|
Hi Dmitry,
Thank you for your suggestion.
The error indeed gone, but new problem arises, where app in the 1st tab does not get updated properly every time there's UI updates.
Should I block user from opening the same app on the same session ?
Thanks & Regards,
Setya
|
|
|
|
Re: Occasional Invalid Thread Access [message #1744301 is a reply to message #1744151] |
Sat, 24 September 2016 11:33 |
|
Hi Dmitry,
Quote:Should I block user from opening the same app on the same session ?
Why?
Since I configure the application in Spring bean using 'session' scope and it seems that all this problem occurs when application is shared with the same session.
I was wondering how other RAP applications handle this situation.
Thanks & Regards,
Setya
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07962 seconds