Race condition in establishing client connection 
-------------------------------------------------

                 Key: QPID-294
                 URL: https://issues.apache.org/jira/browse/QPID-294
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
            Reporter: Rob Godfrey


Recent changes have created a race condition when establishing a client 
connection.

In AMQConnection we do:

    private void makeBrokerConnection(BrokerDetails brokerDetail) throws 
IOException, AMQException
    {
        try
        {
            
TransportConnection.getInstance(brokerDetail).connect(_protocolHandler, 
brokerDetail);

            // this blocks until the connection has been set up or when an error
            // has prevented the connection being set up
            _protocolHandler.attainState(AMQState.CONNECTION_OPEN);
            _failoverPolicy.attainedConnection();

            //Again this should be changed to a suitable notify
            _connected = true;
        }

Where the AMQProtocolHandler.attainState( ) method looks like


    public void attainState(AMQState s) throws AMQException
    {
        _protocolSession.getStateManager().attainState(s);
    }

However, _protocolSession may not yet have been set, as it is only created when 
the MINA thread calls AMQProtocolHandler.sessionCreated( ... )


To fix this issue, we must create the StateManager in ProtocolHandler, and then 
pass this StateManager to the ProtocolSession

Patch to be attached shortly

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

        

Reply via email to