Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dtp-dev] syncExec or asyncExec when refreshing?


Hi,
        I have a question about ServerExplorerContentProviderNav.notifyChanged. Currently it's using syncExec to refresh DSE. Are there any specific reasons to do so? Is it possible to use asynExec?

    public void notifyChanged(final ICatalogObject dmElement, int eventType) {
        if (eventType == ICatalogObjectListener.EventTypeEnumeration.ELEMENT_REFRESH && viewer != null)
        {
            viewer.getControl().getDisplay().syncExec(new Runnable() {
                public void run() {
                    viewer.refresh(dmElement, true);
                }
            });
        }
        }

        I ask this question because I encountered a UI thread contention problem in one of our enablement project (ASE). The symptom is: in DSE, expand the columns node, refresh the table node, then expand the table again, Eclipse UI is freezed. I can't reproduce this problem for Derby, and I found out the difference is in the way the content provider is written, which results in Derby constraints are loaded during refresh, while ASE constraints are not. Then, when I expand the table node again, deadlock occurs. If I change the above code from syncExec to asyncExec, the problem is solved. Of course, I can also change ASE content provider in the same ways as Derby content provider, but I feel async refresh would be more safe.

        Thanks in advance!

Best Regards!

Max (Hui) Cao
Sybase Shanghai RD

Back to the top