Bug 309868 - Single EventBus is a problem in multi-user/multi-instance scenario
Summary: Single EventBus is a problem in multi-user/multi-instance scenario
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P3 normal with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 392977 262787
  Show dependency tree
 
Reported: 2010-04-20 16:05 EDT by Thomas Schindl CLA
Modified: 2019-12-05 15:45 EST (History)
16 users (show)

See Also:


Attachments
Make EventBroker App-Instance aware (2.88 KB, patch)
2012-07-15 06:23 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2010-04-20 16:05:46 EDT
We currently have one event bus / OSGi-Instance which makes e4 unusable in a multi-user/multi-instance deployment (e.g. RAP comes to my mind). We should discuss if and how we can address this problem.
Comment 1 Oleg Besedin CLA 2010-04-21 13:06:59 EDT
The general answer to singleton problems in e4 is to put service in a context and then consume it from a context.

All event services use contextual information. The e4-level code finds event bus implementation from the context. Should you put a different implementation of EventAdmin in the child context, that one will be used by objects injected with the child context.

(This is the picture of how it should be; the whole area needs some attention and I would not be surpirsed if the statement above would not not 100% describe what the code is doing today).

So, at least conceptually, there is no restriction for the event bus to be a singleton.

If anything, the problem is the opposite: if you have multiple event buses, how do you organize event sharing between them.
Comment 2 Thomas Schindl CLA 2010-04-21 13:24:22 EDT
(In reply to comment #1)
> The general answer to singleton problems in e4 is to put service in a context
> and then consume it from a context.
> 
> All event services use contextual information. The e4-level code finds event
> bus implementation from the context. Should you put a different implementation
> of EventAdmin in the child context, that one will be used by objects injected
> with the child context.

I would have expected that the default e4 would bring up an EventBus / Workbench-instance but currently there's only one for the complete OSGi-Instance which != the number of Workbench-Instances if I read the code appropriately.

> 
> (This is the picture of how it should be; the whole area needs some attention
> and I would not be surpirsed if the statement above would not not 100% describe
> what the code is doing today).
> 
> So, at least conceptually, there is no restriction for the event bus to be a
> singleton.
> 
> If anything, the problem is the opposite: if you have multiple event buses, how
> do you organize event sharing between them.

I don't see a reason why workbench W1 should get events from W2. Leaving the performance impact aside (think about 100 Workbench Instance which is nothing strange for things like RAP) how would W1 know that the event is coming from W1 or W2?
Comment 3 Thomas Schindl CLA 2012-07-15 06:23:54 EDT
Created attachment 218732 [details]
Make EventBroker App-Instance aware

This is an idea that just came to my mind. If we publish an instance id in our E4Application we can isolate events in the evenbroker so it can be used directly in a multi-user event.
Comment 4 Ralf Sternberg CLA 2012-07-17 10:31:14 EDT
(In reply to comment #3)
> This is an idea that just came to my mind. If we publish an instance id in our
> E4Application we can isolate events in the evenbroker so it can be used
> directly in a multi-user event.

Great - this should solve the problem for RAP. As soon as I find the time, I will try your patch with RAP and give feedback.

I wonder if the String concatenation and filtering could have a performance impact, but I don't know how frequently events are being sent over the event broker... I guess it is used for things like selection service, part activation, etc, right?
Comment 5 Thomas Schindl CLA 2012-07-17 10:54:44 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > This is an idea that just came to my mind. If we publish an instance id in our
> > E4Application we can isolate events in the evenbroker so it can be used
> > directly in a multi-user event.
> 
> Great - this should solve the problem for RAP. As soon as I find the time, I
> will try your patch with RAP and give feedback.
> 
> I wonder if the String concatenation and filtering could have a performance
> impact, but I don't know how frequently events are being sent over the event
> broker... I guess it is used for things like selection service, part
> activation, etc, right?

My hope is that the EventAdmin does build an intelligent internal structure of the topics and so the overhead should not be noticeable. I'll try to do some peformance testing to see if this change impact performance

We are sending all model changes, ... through the event bus (e.g. part changes). Selection change in contrast are directly done through the IEclipseContext because they are isolated to a certain context (e.g. the perspective or window)
Comment 6 Thomas Schindl CLA 2012-10-16 13:24:30 EDT
I guess the patch only solves half of the problem and the same has to be done to the @EventTopic/@UIEventTopic stuff but before we need to solve #390346
Comment 7 Peter Kullmann CLA 2013-11-10 05:59:56 EST
What is the status here? Bug 390346 has been fixed in the meantime. I'm not sure if the problem still exists because of the fix of bug 374534 where IEventBroker instances are being created per context.
Comment 8 Lars Vogel CLA 2014-03-12 11:36:29 EDT
Tom, I saw your comment that M6 solved all RAP issues. Can this be marked as fixed?
Comment 9 Thomas Schindl CLA 2014-03-12 11:40:40 EDT
no i'd like to keep it open - we have a solution by overloading the EventBroker but in the ideal case I'd like the platform event-broker work appropriately by default
Comment 10 Lars Vogel CLA 2019-12-05 15:43:41 EST
Please reopen if you plan to provide a Gerrit.