activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlo cancellieri <carlo.cancelli...@geo-solutions.it>
Subject Re: 5.8.0 Unable to shutdown embedded broker
Date Sun, 16 Mar 2014 20:42:29 GMT
Errata corridge:
Sorry, substitute 'Transaction' with 'Transport' in the previous mail.
Il 16/mar/2014 21:20 "carlo cancellieri" <carlo.cancellieri@geo-solutions.it>
ha scritto:

> 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
>
> -------------------------------------------------------
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message