You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by zouzounos <zo...@email.com> on 2007/09/24 12:22:24 UTC

VM Transport problem when closing connections

Hi,
I'm using activemq4.1.1 under tomcat 6. I am using the next entry in the
Context.xml:
 <Resource name="jms/ConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
Connection Factory"
factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
brokerURL="failover:vm://localhost?broker.persistent=false" 
brokerName="LocalActiveMQBroker"/>

As the d=ocumentation says, the broker is created upon creation of a
connection
The problem that i face is that after releasing the connection using
Connection.close() (and if no other connection is still active) the broker,
together with all its queues, go down. So when another connection (say a
Consumer connection) is established, the broker goes live again but there is
nothing inside the queues for the consumer to receive, since it seems that
the queues are recreated from scratch.

If the producer does not close the connection, then the broker is always
active, but the connection objects + all other backport objects created by
the connection are never garbage collected. This eventually, leads to Heap
Memory Error.

When the broker runs  in tcp mode tcp://localhost:port as a separate
process, everything works fine in all cases.

Does anyone has an idea why is this happening with the embedded broker?

Thanks
               
-- 
View this message in context: http://www.nabble.com/VM-Transport-problem-when-closing-connections-tf4508319s2354.html#a12857319
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: VM Transport problem when closing connections

Posted by zouzounos <zo...@email.com>.
No i am not using Spring and YES, I have also tried it without "failover".
The result is the same.



TOPPER_HARLEY wrote:
> 
> Hi, 
> Are you using Spring? Can you use an
> org.apache.activemq.xbean.BrokerFactoryBean?
> 
> This will create and start the broker and just leave it there in the VM.
> You can create a connection and then close it as you want but it will not
> shutdown the broker. (Broker stays alive until VM dies or until it is
> shutdown through JMX)
> 
> e.g. with Spring 
> 
>     <bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
>         <property name="config"
> value="classpath:com/xxx/yyy/zzz/activemq.xml"/>
>         <property name="start" value="true"/>
>     </bean>
> 
> /Tom
> 

-- 
View this message in context: http://www.nabble.com/VM-Transport-problem-when-closing-connections-tf4508319s2354.html#a12881423
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: VM Transport problem when closing connections

Posted by TOPPER_HARLEY <TR...@ERICSSON.COM>.
Hi, 
Are you using Spring? Can you use an
org.apache.activemq.xbean.BrokerFactoryBean?

This will create and start the broker and just leave it there in the VM. You
can create a connection and then close it as you want but it will not
shutdown the broker. (Broker stays alive until VM dies or until it is
shutdown through JMX)

e.g. with Spring 

    <bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
        <property name="config"
value="classpath:com/xxx/yyy/zzz/activemq.xml"/>
        <property name="start" value="true"/>
    </bean>

/Tom
-- 
View this message in context: http://www.nabble.com/VM-Transport-problem-when-closing-connections-tf4508319s2354.html#a12859002
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: VM Transport problem when closing connections

Posted by ttmdev <jo...@ttmsolutions.com>.
Since you're connecting to an embedded broker, there is no need to use the
'failover' transport. 

Are you reusing Connection objects?


zouzounos wrote:
> 
> Hi,
> I'm using activemq4.1.1 under tomcat 6. I am using the next entry in the
> Context.xml:
>  <Resource name="jms/ConnectionFactory" auth="Container"
> type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS
> Connection Factory"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
> brokerURL="failover:vm://localhost?broker.persistent=false" 
> brokerName="LocalActiveMQBroker"/>
> 
> As the d=ocumentation says, the broker is created upon creation of a
> connection
> The problem that i face is that after releasing the connection using
> Connection.close() (and if no other connection is still active) the
> broker, together with all its queues, go down. So when another connection
> (say a Consumer connection) is established, the broker goes live again but
> there is nothing inside the queues for the consumer to receive, since it
> seems that the queues are recreated from scratch.
> 
> If the producer does not close the connection, then the broker is always
> active, but the connection objects + all other backport objects created by
> the connection are never garbage collected. This eventually, leads to Heap
> Memory Error.
> 
> When the broker runs  in tcp mode tcp://localhost:port as a separate
> process, everything works fine in all cases.
> 
> Does anyone has an idea why is this happening with the embedded broker?
> 
> Thanks
>                
> 

-- 
View this message in context: http://www.nabble.com/VM-Transport-problem-when-closing-connections-tf4508319s2354.html#a12859302
Sent from the ActiveMQ - User mailing list archive at Nabble.com.