Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Use of IObjectActionDelegate not Synchronized(Proper use of IObjectActionDelegate question)
icon5.gif  Use of IObjectActionDelegate not Synchronized [message #536511] Fri, 28 May 2010 14:26 Go to next message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
Hello,

In 1.3, I have discovered something startling, which I am positive is because of our false assumptions about how action delegates work.

I am surprised this never came up in our development before, but after doing some multi-user testing, we discovered that the use of any particular IObjectActionDelegate is shared among all users of the RAP application at any given time.

The startling part about this is that it implies that the action delegate cannot store any state including the selection that comes from selectionChanged(IAction,ISelection).

In our IObjectActionDelegates, we have been storing the selection for use when the run() method is called. But this obviously has implications in a multiuser environment when one action delegate is shared between users.

So our initial thought was to somehow store the selection in the target part that comes from setActivePart(), but that also would break in the multi-user case....

To reproduce the effect, just fire up 2 instances of your app... put a breakpoint in selectionChanged(), run() and setActivePart(). Then right click different elements that would use the same delegate (on in each app instance). You will find that the two threads are waiting on setActivePart()...which demonstrates the problem...

namely that two users that right click on different objects in different sessions can end up stepping on each other's selection if you store the selection in the delegate.

Does anyone else know how to deal with this issue? We are stumped. We use a lot of IObjectDelegates that worked fine in RCP.

Thanks!




[Updated on: Fri, 28 May 2010 21:21]

Report message to a moderator

Re: Use of IObjectActionDelegate not Synchronized [message #536604 is a reply to message #536511] Fri, 28 May 2010 20:53 Go to previous messageGo to next message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
I tested the same code and usecase in 1.2 and there are occasionally separate action delegates for each user but mainly shared instances....


Created bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=314959

[Updated on: Fri, 28 May 2010 21:18]

Report message to a moderator

Re: Use of IObjectActionDelegate not Synchronized [message #536614 is a reply to message #536604] Fri, 28 May 2010 22:12 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Maybe, you could create a proxy (java.lang.reflect.Proxy) that enables the session-awareness by re-creating the object action delegate once per thread (java.lang.ThreadLocal).
Though, this would have to be implemented on the RAP side.
Re: Use of IObjectActionDelegate not Synchronized [message #536915 is a reply to message #536604] Mon, 31 May 2010 13:31 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Austin,

thanks pointing this out. I think that this is really a bug, one that
has been hiding well for years. Could you try out the patch I attached
to your bug?

Best, Ralf

Austin Riddle wrote:
> After more testing....it turns out that the problem is definitely a
> bug.... I tested the same code and usecase in 1.2 and there are separate
> action delegates for each user....
>
>
> Created bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=314959
Re: Use of IObjectActionDelegate not Synchronized [message #537308 is a reply to message #536915] Tue, 01 June 2010 21:32 Go to previous message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
Patch works great Ralf! Thanks!
Previous Topic:StatusLineManager
Next Topic:a custom widget that make ajax call to communicate with the rap server
Goto Forum:
  


Current Time: Fri Apr 19 09:41:57 GMT 2024

Powered by FUDForum. Page generated in 0.01950 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top