Bug 374534 - IEventBroker instances are not actually allocated and destroyed on a per-context basis
Summary: IEventBroker instances are not actually allocated and destroyed on a per-cont...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.2 M7   Edit
Assignee: Brian de Alwis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-16 13:05 EDT by Brian de Alwis CLA
Modified: 2012-05-01 17:01 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian de Alwis CLA 2012-03-16 13:05:10 EDT
We have several view parts that subscribe to events using the IEventBroker.  I wondered why a part's subscriptions on its IEventBroker weren't being removed on part close.

It turns out that the EventBrokerFactory context function does a get() rather than getLocal().  So if an event broker has been allocated in a parent, that broker will be used for all children.  

Since a broker is created on the workbench context on startup as a result of configuring the EModelService, and so this instance effectively becomes a singleton instance for the application.

I think is a bug.  Or at least having a part's subscriptions be automatically expired on close seems to be a big benefit that we're not getting.
Comment 1 Paul Webster CLA 2012-03-16 13:22:35 EDT
When we started we were using the mediator pattern here (which provides cleanup on context dispose).

We might have changed our tact but not considered the cleanup pattern.

PW
Comment 2 Remy Suen CLA 2012-03-16 13:29:00 EDT
Shocked and appalled that this is broken.
Comment 4 Brian de Alwis CLA 2012-05-01 17:01:08 EDT
Verified in I20120430-1800