sandeepsuvit / jspf

Automatically exported from code.google.com/p/jspf
0 stars 0 forks source link

ValueListener / InformationListener fires several times per one broker.publish() call #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello there
I met some issues with InformationBroker:

1. I register listener in my plugin 
    @Init
    public void init() {
        InformationBrokerUtil ibu = new InformationBrokerUtil(broker);

        ibu.onValue(new ObjectID("action:startup"), new
ValueListener<Object>() {
            public void newValue(Object value) {...}
        });
    }

2. Then I load plugins in core application:
PluginManager pm = PluginManagerFactory.createPluginManager();
pm.addPluginsFrom(new File(cbadminProps.getPluginFolder()+"/").toURI());
InformationBroker broker = pm.getPlugin(InformationBroker.class);

        try {
            if (broker != null) {
                Thread.sleep(100);
                broker.publish(new ObjectItem("action:startup", ""));
                Thread.sleep(100);
            }
        } catch (InterruptedException interruptedException) {
        }

3. If I remove "Thread.sleep(100);" strings, then listener fired up several
(2 to 3) times upon one broker.publish() method.

I suppose such issue should not be solved by 'sleep' statements because
timing is very tender thing, especially on old machines. Anyway, end user
should not bother with threads in this case.

Using latest (0.8?) version of code.

Any ideas?
Thanks,
Maxim

Original issue reported on code.google.com by McSe...@gmail.com on 13 May 2010 at 3:46

GoogleCodeExporter commented 9 years ago
Haven't verified that one, but sounds like a bug. I'll put in on my list. 
Thanks for the report.

Original comment by 200712@xeoh.net on 27 May 2010 at 3:22

GoogleCodeExporter commented 9 years ago
InformationBroker has been completely revamped. The interface differs, it also 
replaces the Bus, and has a convenience InformationBrokerUtils helper class.

Original comment by r.biedert on 28 Sep 2010 at 1:19