Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 66197 invoked from network); 27 Sep 2006 10:02:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Sep 2006 10:02:23 -0000 Received: (qmail 86310 invoked by uid 500); 27 Sep 2006 10:02:23 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 86119 invoked by uid 500); 27 Sep 2006 10:02:22 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 86109 invoked by uid 99); 27 Sep 2006 10:02:22 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Sep 2006 03:02:22 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=lists@nabble.com; spf=pass X-ASF-Spam-Status: No, hits=0.5 required=5.0 tests=FORGED_HOTMAIL_RCVD2 Received-SPF: pass (idunn.apache.osuosl.org: domain nabble.com designates 72.21.53.35 as permitted sender) Received: from [72.21.53.35] ([72.21.53.35:34776] helo=talk.nabble.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id F3/31-24472-A2C4A154 for ; Wed, 27 Sep 2006 03:02:19 -0700 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1GSWF6-0004b5-Ar for activemq-users@geronimo.apache.org; Wed, 27 Sep 2006 03:02:16 -0700 Message-ID: <6523894.post@talk.nabble.com> Date: Wed, 27 Sep 2006 03:02:16 -0700 (PDT) From: HU To: activemq-users@geronimo.apache.org Subject: Re: Broker used up the memory In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: gong_pu@hotmail.com References: <6444443.post@talk.nabble.com> <6482630.post@talk.nabble.com> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, James. Thanks, I have had the broker run with Mysql DB. Then I run the broker and a sender on a PC and run a consumer on another PC, Send a message to a queue by the sender thread and receve the messsage by the consumer thread then reply a message to sender thread by the consumer, repeat the actions. I found the heap was used creep up and did not found the used memory be released by the consumer thread. I used GC to get tracing for the test. Following are the codes of my test, could you please help me to fix the issue. public class Newconsumer extends Thread{ private Session session; private Connection connection; private MessageConsumer consumer; private Destination destinetionQueue; public Newconsumer(Connection con) { this.connection = con; try { session = this.connection.createSession(true, Session.AUTO_ACKNOWLEDGE); destinetionQueue = session.createQueue("RequestQueue"); consumer = session.createConsumer(destinetionQueue); } catch (JMSException e) { } } public void close() { try { if( consumer != null ) consumer.close(); if (session != null) session.close(); } catch (JMSException e) { e.printStackTrace(); } } public void run() { while(true){ try { Message msg = consumer.receive(10000); if ( msg == null ) continue; Destination destResp = ((MapMessage) msg).getJMSReplyTo() ; String sCorrelationID = ((MapMessage) msg).getJMSCorrelationID(); String sAnkenID = ((MapMessage) msg).getString("ID"); Session sessSend = this.connection.createSession( false, Session.AUTO_ACKNOWLEDGE); MapMessage msgTime = sessSend.createMapMessage(); msgTime.setJMSCorrelationID( sCorrelationID); msgTime.setString( "ID",sAnkenID); msgTime.setLong("TIMEOUT",35000 ); MessageProducer producer = sessSend.createProducer(destResp); producer.send(msgTime); MapMessage msgRes = session.createMapMessage(); msgRes.setJMSCorrelationID( sCorrelationID); msgRes.setString( "ID",sAnkenID); msgRes.setString( "RESULT","SUCCESS"); producer.send(msgRes); this.session.commit(); producer.close(); producer=null; sessSend.close(); sessSend=null; } catch (JMSException e) { e.printStackTrace(); } break; } this.close(); } } public class ConsumerController { public static Newconsumer consumer; public static void main(String[] args) throws NamingException { ActiveMQConnectionFactory factory; Connection connAnken; factory = new ActiveMQConnectionFactory("tcp://localhost:61616"); try { connAnken = factory.createQueueConnection(); connAnken.start(); consumer = new Newconsumer(connAnken); consumer.start() ; try { while(true) { consumer.join(); consumer =null; consumer = new Newconsumer(connAnken); consumer.start(); } } catch (Throwable e) { e.printStackTrace(); } finally{ connAnken.close() ; connAnken=null; } } catch (Throwable e) { e.printStackTrace(); } } } activemq.xml ------------------------------------------------------------------------------------------ eclipse.ini ------------------------------------------------------------------------------------------ -vmargs -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=128M Thanks, Hu -- View this message in context: http://www.nabble.com/Broker-used-up-the-memory-tf2316972.html#a6523894 Sent from the ActiveMQ - User mailing list archive at Nabble.com.