[
https://issues.apache.org/jira/browse/AMQ-2326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Timothy Bish resolved AMQ-2326.
-------------------------------
Resolution: Fixed
This issue was fixed by AMQ-2677
> Using connection pool, ActiveMQConnection is not started if an error occur
> during first attempt to start the connection.
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: AMQ-2326
> URL: https://issues.apache.org/jira/browse/AMQ-2326
> Project: ActiveMQ
> Issue Type: Bug
> Affects Versions: 5.2.0
> Reporter: Mathieu Baril
> Fix For: 5.x
>
>
> calling start() on org.apache.activemq.pool.PooledConnection do the following:
>
> public void start() throws JMSException {
> if (started.compareAndSet(false, true)) {
> connection.start();
> }
> }
> If an error occurs during call on the underlying connection, the value of
> started is equal to true. This means that the next call to the start method
> of the pooled connection will not call start on the underlying connection
> even if in reality the connection is not started...
> In my case, I use FailoverTransport but I want that my call to start returns
> after a certain delay so I interrupt the Thread that is starting the
> ActiveMQConnection. Doing that, the method returns but the isStarted method
> on the ActiveMQConnection returns false. The result is that all
> MessageDispatchChannel created on that connection are not started and don't
> dispatch message received.
> ActiveMQConnection:
> public void start() throws JMSException {
> checkClosedOrFailed();
> ensureConnectionInfoSent(); => The thread is interrupted
> here....
> if (started.compareAndSet(false, true)) {
> for (Iterator<ActiveMQSession> i = sessions.iterator();
> i.hasNext();) {
> ActiveMQSession session = i.next();
> session.start();
> }
> }
> }
> This is the solution that I propose and that seems to work for me:
> In PooledConnection, replace:
> public void start() throws JMSException {
> if (started.compareAndSet(false, true)) {
> connection.start();
> }
> }
> by
> public void start() throws JMSException {
> started.compareAndSet(false, true);
> if (!connection.isStarted()) {
> connection.start();
> }
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira