Hi all,

I got the same problem with you guys if i just close only the Session. But 
after i do the close for all include the Sender and Connection it looks OK. I 
was ran out of Memory after 1000 message post to the queue. Here is what i do 
with my sendObject:

public static void sendObject(Serializable object, String jvmURL, String 
queueName)
                throws NamingException, JMSException {
                PSServiceLocator locator = new PSServiceLocator(jvmURL);
                //lookup the resources
                QueueConnectionFactory connectionFactory = 
                        
(QueueConnectionFactory)locator.lookupObject(CONNECTION_FACTORY);
                Queue queue = (Queue)locator.lookupObject(queueName);
                //safe jms resources
                QueueConnection queueConnection = null;
                QueueSession queueSession = null;
                QueueSender queueSender = null;
                try {
                        //create the session connection
                        queueConnection = 
connectionFactory.createQueueConnection();
                        //instance the queue session
                        queueSession = queueConnection.createQueueSession(false,
                                        Session.AUTO_ACKNOWLEDGE);
                
                        //create queue and send the message
                        queueSender = queueSession.createSender(queue);
                        Message message = 
queueSession.createObjectMessage(object);
                        queueSender.send(message);
                }finally {
                        //free all created objects
                        if(queueSender != null) {
                                queueSender.close();
                        }
                        if(queueSession != null) {
                                queueSession.close();
                        }
                        if(queueConnection != null) {
                                queueConnection.close();
                        }
                }
        }


Hope it helps you all,


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3901248#3901248

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3901248


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to