Search code examples
eclipse-rap

Thread safety in RAP event handlers


I have an RAP (2.3.1) application where the user can click on a button and the panel updates itself. However, if the user clicks multiple times on the button too quickly (or the network/update takes longer on the server), the application sometimes crashes or errors out with "wrong thread access", which I guess is that the button's selection handler is run on multiple threads due to the multiple clicks. The update itself is a serial process of updating GUI elements (i.e., no asyncExec or other stuff).

I'd expect RAP to serialize access to a user's session but apparently it doesn't. Is there a setting that I need to change or do I have to manually synchronize the event handler (or all event handlers) in my application?


Solution

  • UI Requests in RAP are synchronized (see here) and guaranteed to be executed in the same UI thread.

    Illegal thread access is nothing you could provoke just by clicking on Button too quickly. The problem must be in the code triggered by the selection listener. Could you post a minimal snippet to reproduce the problem?