Art,
 thanks for your prompt response. Finally I have found a workaround but I
had to implement a wrapper of the ActiveMQConnectionFactory to handle
Transport by my self.
Looking at the
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(String,
String)
in the 5.10-SNAPSHOT and previous versions that method instantiates a
Transaction and pass it to the connection (I'm on the 5.9.0).
The connection (probably this is intentional) will not take care of the
Transaction close() since it is passed externally (and this make sense).
Anyhow creating a connection in this way the transaction will never be
closed.
Now Using my implementation Tomcat can complete the shutdown.

One question is this intentional or this is an issue? In this case how do I
need to proceed to contribute? (I can easily provide a pull req if needed)

Here is the implementation:
------------------------------------
package it.geosolutions.geoserver.jms.impl;

import javax.jms.JMSException;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.management.JMSStatsImpl;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.util.IdGenerator;

/**
 * This class was implemented as workaround to a possible ActiveMQ issue
with
 * the Trasport handling. Here we create a simple wrapper which will take
care
 * of transaction close using the connection.
 *
 * @author carlo cancellieri
 *
 */
public class TransactionHandlerConnectionFactory extends
ActiveMQConnectionFactory {

public TransactionHandlerConnectionFactory(String brokerURL) {
super(brokerURL);
}

protected ActiveMQConnection createActiveMQConnection(Transport transport,
JMSStatsImpl stats) throws Exception {
 return new TransactionHandlingConnection(transport,
getClientIdGenerator(), getConnectionIdGenerator(), stats);
 }

/**
 * This implementation will take care of the transport stop
 *
 * @author carlo cancellieri
 *
 */
 class TransactionHandlingConnection extends ActiveMQConnection {
protected TransactionHandlingConnection(Transport transport,
 IdGenerator clientIdGenerator,
IdGenerator connectionIdGenerator, JMSStatsImpl factoryStats)
throws Exception {
 super(transport, clientIdGenerator, connectionIdGenerator,
factoryStats);
}

@Override
public void close() throws JMSException {
try {
 this.getTransport().stop();
} catch (Exception e) {
final JMSException ex = new JMSException(
 e.getLocalizedMessage());
ex.initCause(e.getCause());
throw ex;
 }
super.close();
}

}
}
------------------------------------
Cheers,
Carlo

-- 
==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for
more information.
==

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:   +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Reply via email to