activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dejan Bosanac (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (AMQ-2677) org.apache.activemq.pool.ConnectionPool should not set "started" flag if start() throws an exception
Date Wed, 31 Mar 2010 11:53:08 GMT

     [ https://issues.apache.org/activemq/browse/AMQ-2677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dejan Bosanac resolved AMQ-2677.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 5.4.0

This should be fixed with svn revision 929488. I also added modified test to system tests.
Thanks

> org.apache.activemq.pool.ConnectionPool should not set "started" flag if start() throws
an exception
> ----------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-2677
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2677
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.3.1
>         Environment: Ubuntu Linux 9.10, Sun JDK 1.6.0_15
>            Reporter: Aaron Riekenberg
>            Assignee: Dejan Bosanac
>             Fix For: 5.4.0
>
>         Attachments: connection_pool_start.patch, jmstest.zip
>
>
> If org.apache.activemq.pool.ConnectionPool.start throws a JMSException, the "started"
flag in ConnectionPool should not be set to true.  If start() throws an exception, the underlying
ActiveMQConnection object will not be started.  Since started=true, any subsequent calls to
ConnectionPool.start will do nothing, and a non-started connection may be used by the pool.
> I ran into this problem when using Camel to consume messages - see the attached test
program for an example.  This test program does the following:
> 1. Starts a bean consuming from queue test.queue using Camel.  The URL used by Camel
to connect to ActiveMQ is:
> failover:(tcp://127.0.0.1:61616)?timeout=1000&initialReconnectDelay=1000&maxReconnectDelay=1000&useExponentialBackOff=false
> The test program uses the default behavior of Camel's ActiveMQComponent which creates
a PooledConnectionFactory.
> 2. Waits 10 seconds, then starts an ActiveMQ broker on port 61616.  During this wait
time, Camel's connection to the broker fails every second and it is continually retrying.
> 3. Sends 10 messages to the queue "test.queue".
> The call to ConnectionPool.start by camel throws an exception after blocking for 1 second
since timeout=1000 is set in the URL.  However the "started" flag is set to true, so subsequent
calls to ConnectionPool.start by Camel on connection retries do not restart the ActiveMQConnection.
> So, after step 3 in the test the Camel consumer appears to be connected to the broker,
but it does not receive any messages and I get the following warning:
> 2010-03-27 09:47:02,994 [ActiveMQ Transport: tcp:///127.0.0.1:61616] WARN  org.apache.activemq.ActiveMQSessionExecutor
- Received a message on a connection which is not yet started. Have you forgotten to call
Connection.start()?
> I am attaching a patch to org.apache.activemq.pool.ConnectionPool that does not set started=true
if start throws an exception.  This fixes my test program - now each connection retry by camel
actually attempts to start the ActiveMQConnection.

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


Mime
View raw message