I'd say you run out of memory on the broker due to a memory leak in
the connection handling, every closed connection leaves a thread open
and still hogs some memory. You can check that with jConsole.
Can you try reusing or pooling the connections? There's a
PooledConnectionFactory that does this. It's advisable to do this
anyway as the constant open/close of connection uses a lot of system
resources and slows down your producer quite a bit.

--Mario

On Sat, Aug 30, 2008 at 11:15 AM, Jigar Naik <[EMAIL PROTECTED]> wrote:
>
> hi
>
> i am facing problem with producer,
>
> My producer stops producing messages after producing 1542 messages on active
> mq
>
> bellow is my output after running producer thread
>
> OUTPUT
> Message Sent : Hello This is a text message on active MQ : 1542
> Exception in thread "ActiveMQ Transport: tcp://localhost/127.0.0.1:61616"
> java.lang.OutOfMemoryError: Java heap space
> Exception in thread "InactivityMonitor ReadCheck"
> java.lang.OutOfMemoryError: Java heap space
>
> What could be the possible reason for this error..
>
> bellow is my producer code...
> Producer.java
> ---------------------
> package org.icrm;
>
> import javax.jms.Connection;
> import javax.jms.DeliveryMode;
> import javax.jms.Destination;
> import javax.jms.JMSException;
> import javax.jms.MessageProducer;
> import javax.jms.Session;
> import javax.jms.TextMessage;
>
> import org.apache.activemq.ActiveMQConnectionFactory;
>
>
> public class Producer {
>        private MessageProducer         producer;
>        ActiveMQConnectionFactory       connectionFactory;
>        Connection                                      connection;
>        Session                                         session;
>        Destination                             destination;
>
>        public static void main(String[] args) {
>                Producer p = new Producer();
>
>                for(int i=0;i<100000;i++){
>                        p.sendMessageToActiveMQ("Hello This is a text message 
> on active MQ : " +
> i, "TestQueue");
>                }
>
>        }
>        /**
>         * Send Message to ActiveMQ
>         * @param message
>         * @param queueName
>         */
>        public void sendMessageToActiveMQ(String message,String queueName){
>                try {
>                        connectionFactory       = new
> ActiveMQConnectionFactory("tcp://localhost:61616");
>                        connection                      = 
> connectionFactory.createConnection();
>                        connection.start();
>                        session                         = 
> connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>                        destination             = 
> session.createQueue(queueName);
>                        this.producer           = 
> session.createProducer(destination);
>                        this.producer.setDeliveryMode(DeliveryMode.PERSISTENT);
>                        TextMessage textMessage = session.createTextMessage();
>                        textMessage.setText(message);
>                        this.producer.send(textMessage);
>                        System.out.println("Message Sent : " + message);
>                } catch (JMSException e) {
>                        e.printStackTrace();
>                } catch (Exception e){
>                        e.printStackTrace();
>                }finally{
>                        producer                        = null;
>                        connectionFactory       = null;
>                        connection                      = null;
>                        session                         = null;
>                        destination                     = null;
>                }
>
>        }
> }
>
> --
> View this message in context: 
> http://www.nabble.com/Producer-stops-producing-messages-after-producing-1542-messages.-tp19231685p19231685.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Reply via email to