[jboss-jira] [JBoss JIRA] Commented: (JGRP-291) PullPushAdapter starts thread in constructor before listeners are registered

Bela Ban (JIRA) jira-events at jboss.com
Thu Aug 31 07:14:18 EDT 2006


    [ http://jira.jboss.com/jira/browse/JGRP-291?page=comments#action_12342460 ] 
            
Bela Ban commented on JGRP-291:
-------------------------------

Okay, I've added another constructor which takes a boolean 'start':
   public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml, boolean start) {
        this.transport=transport;
        setListener(l);
        addMembershipListener(ml);
        if(start)
            start();
    }

- Set this to false
- Add additional listeners
- Call start() yourself

Note that you can now also use the Multiplexer rather than this mechanism, which is somewhat deprecated

> PullPushAdapter starts thread in constructor before listeners are registered
> ----------------------------------------------------------------------------
>
>                 Key: JGRP-291
>                 URL: http://jira.jboss.com/jira/browse/JGRP-291
>             Project: JGroups
>          Issue Type: Feature Request
>    Affects Versions: 2.3
>         Environment: All
>            Reporter: Steve Nicolai
>         Assigned To: Bela Ban
>             Fix For: 2.4
>
>
> The PullPushAdapter has the ability to multiplex based on a Serializable identifier.  Unfortunately, all the constructors start the adaptor.  This makes it very difficult to register listeners via registerListener(Serializable identifier, MessageListener l) before the adaptor is started.  When a new node is joining an existing cluster that is actively sending messages, there is a race between getting the listeners registered and a message arriving.
> Suggested fix:
> Remove the call to start() from the constructors, allowing the PullPushAdaptor to be constructed, the listeners to be registered, then start() the adaptor.  For example:
>     a = new PullPushAdaptor(.....)
>     a.registerListener("id1", ....)
>     a.registerListener("id2", ....)
>     a.start();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list