activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Orner (JIRA)" <>
Subject [jira] Created: (AMQ-1511) Slave starts connectors before master fails
Date Mon, 03 Dec 2007 21:37:26 GMT
Slave starts connectors before master fails

                 Key: AMQ-1511
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 4.1.1
            Reporter: Howard Orner

A broker configured as a slave starts its connectors before the the master fails.  This is
bad because a) The documentation states that this is not the case.  b) it shouldn't be the
case because you don't want clients to be able to connect to the slave until it takes over
as master.

In looking at source, it would appear that the MasterConnector of BrokerService is not started
until after all the connections are started in startAllConnection().  Unfortunately, to determine
if connections should be started, isSlave() is called which relies on the MasterConnector.start()
method being called.  

The MasterConnector service start() method needs to be called first before isSlave will work.

See broken code snippet from BrokerService below:

protected void startAllConnectors() throws Exception{
  if (!isSlave()){   // OOPS!!! isSlave asks the MasterConnector if the master is active,
but can't until its started 
       if (services != null) {
                for (int i = 0; i < services.length; i++) {
                    Service service = services[i];   //OOPS, MasterConnector is in this list
and the surrounding if relies on it to be started
                    service.start();   //OOPS!!!!   this should have been called for isSlave()
to return the right answer.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message