Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6327535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:17:52+00:00 2026-05-24T17:17:52+00:00

I’m using an Eclipse RCP based framework that suffers from an inefficient event model.

  • 0

I’m using an Eclipse RCP based framework that suffers from an inefficient event model. Specifically, events emitted by controls often ‘cascade’. For example, a control will emit a COLOR_CHANGED event causing the parent composite to propagate the event to sibling controls, which in turn, decide to emit their own COLOR_CHANGED events (in response to the original event), leading to a chain reaction of sorts. I’ve profiled the app raising over 100,000 events to render a simple form. Frankly, I don’t understand how it’s not overflowing the stack.

So, I’m looking for a technique or design pattern that prevents or reduces this kind of cascade behaviour. I’ve had a few ideas but this can’t be a new problem; there’s got to be a ‘best practice’ out there already for event-oriented design.

My ideas:

  • Events operate like a stack-trace, so new events are chained to their cause. This enables listeners to ignore events that originated from themselves. However, this greatly complicates my event model (and it would be tedious to wrap standard SWT events). Not to mention there are valid use-cases where you might actually want this behaviour.
  • A central ‘event pump’ is used to raise events. If an event has the same source and payload as a previously raised event within the last n milliseconds, it is discarded. This would hopefully have a doping effect and prevent the events from cascading. Obviously, I can’t control how SWT/RCP events are raised but these aren’t my main concern.
  • Events should be typed. This seems like a step backwards but I think finer grained events would help performance. For example, ValidationFailedEvent rather than generic Event that everybody handles (and then has to interrogate it’s state to determine the event type).

Thanks for taking the time to read about my problem. All advice/suggestions welcome.

EDIT: Thanks to pablosaraiva, I read about Chain-of-responsibility and now have the following idea:

  • Events expose an isHandled property which, if set to true, will prevent the event from propagating. This should work when the event’s scope is understood but won’t help if the event can not be ‘handled’ by a single control.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:17:53+00:00Added an answer on May 24, 2026 at 5:17 pm

    I’ve played around with lots of different approaches to this over the years. The fundamental thing you can do to fix this is to have models only emit events if they actually change. This makes models slightly more complicated for each class in the model, but it is the only way I’ve managed to make this paradigm work.

    For example

    public void setColor(Color c)
    {
       setBackground(c);
       notify(new ColorChangedEvent(this, c));
    }
    

    would become

    public void setColour(Color c)
    {
        if (!getBackground().equals(c))
        {
           setBackground(c);
           notify(new ColorChangedEvent(this, c));
        }
    }
    

    The standard Observable classes in java support this with the ‘setChanged()’ method.

    A slightly easier way of implementing this (but IMHO not as good) is to make ‘notify’ turn off listening until it has finished notifying. That is, notify looks like

    private iAmNotifying;
    public void notify(Event e) 
    { 
        if (!iAmNotifying)
        {
            iAmNotifying = true;
            doTheActualNotification(e);
            iAmNotifying = false;
        }
    }
    

    But this has some significant drawbacks in terms of granularity, and I’ve had better success with the first approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.