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 651123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:07:42+00:00 2026-05-13T22:07:42+00:00

I was wondering if the following is common for regular Java applications when receiving

  • 0

I was wondering if the following is common for “regular” Java applications when receiving callback/events. Those callbacks may be triggered by user input but also by other means so it is not only related to UI events:

public void handleEvent( @NotNull final SomeEvent e ) {
    final boolean process;
    synchronized ( this ) {
        process = !e.equals(filter);
        filter = e;
    }
    if ( process ) {
        ...   
    }
}

Basically under some complicated scheme (very complex UI involving several views of a same model and where the user can modify the model from different screens [like in complex 3D programs]) I’ve got lots of events firing and I’ve noticed that I could filter out duplicate events using the above snippet. If an event has been processed and the next event to come is exactly identical to the last processed event (saved in the filter reference), then the event/callback is simply ignored.

It works fine. I was wondering if filtering out duplicate events was a common technique?

  • 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-13T22:07:43+00:00Added an answer on May 13, 2026 at 10:07 pm

    Not always, but usually this can be a sign that some elements of the event cascade chain aren’t properly detecting that they don’t need to send an event. The classic illustration is a bean setter that generates a PropertyChangeEvent even when the value hasn’t changed.

    While what you’ve done will filter these events out, it doesn’t address what may be a fundamental underlying issue.

    The problem is that these “errors” can combine to form infinite loops. Extending the bean example above, say you have a UI that resets its editable value based on that bean field… and resetting the UI value will also call the bean setter because proper dupe checking wasn’t done there either. The first time the value is edited and endless loop will occur.

    These examples are obvious when they happen but as notification hierarchies get more complicated it becomes harder to track these things down and they potentially occur at more intermittent times.

    A good rule of thumb is to make every event generating component as conservative as possible. In the event (heh) you are receiving notifications from components that you can’t control, and will be forwarding your own events also then a filter like the one you’ve setup may be the only option to prevent the spread of a potentially larger problem than just performance.

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

Sidebar

Related Questions

I was wondering, whether the following style is a common practice to avoid key
I'm wondering what the common project/application structure is when the user model extended/sub-classed and
Wondering if following will work for google in robots.txt Disallow: /*.action I need to
I'm new to some of App Development and was wondering the following; How can
Just wondering if the following is considered to be good programming practice or not?
Just wondering how the following sql query would look in linq for Entity Framework...
Just wondering if the following expressions used for Value are equivalent (the column Contrib
I am wondering why the following two types struct { double re[2]; }; and
I'm wondering why the following code doesn't work: String test = new String(new byte[]
I was wondering if the following is possible. Create a class that accepts an

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.