| public void testCodeInIsolation()
  |     throws Exception
  | {
  |   Context context = new InitialContext();
  |   QueueConnectionFactory qcf = (QueueConnectionFactory) 
context.lookup("ConnectionFactory");
  |   final QueueConnection qc = qcf.createQueueConnection();
  |   final QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
  |   final Queue sendQ = (Queue) context.lookup("queue/xx-MessageTest");
  |   final Queue replyQ = (Queue) context.lookup("queue/xx-ReturnMessageTest");
  | 
  |   final Map sentMessages = Collections.synchronizedMap(new HashMap());
  | 
  |   final MessageListener listener =
  |       new MessageListener()
  |       {
  |         public void onMessage(Message message)
  |         {
  |           try
  |           {
  |             TextMessage tmessage = (TextMessage) message;
  |             String msgcontent = tmessage.getText();
  |             String id = message.getJMSMessageID();
  |             String corr = message.getJMSCorrelationID();
  |             System.out.println("received "+id+" in reply to "+corr+" containing: 
"+ msgcontent);
  |             QueueReceiver receiver = (QueueReceiver) sentMessages.remove(corr);
  | //****            receiver.close();
  |           }
  |           catch (JMSException e)
  |           {
  |             e.printStackTrace();
  |           }
  |         }
  |       };
  | 
  |   Runnable run =
  |       new Runnable()
  |       {
  |         public void run()
  |         {
  |           try
  |           {
  |             for (int cntr = 0; cntr < 1000; cntr++)
  |             {
  |               String msgcontent = "test-" + cntr;
  |               TextMessage message = qs.createTextMessage(msgcontent);
  |               message.setJMSReplyTo(replyQ);
  | 
  |               QueueSender sender = qs.createSender(sendQ);
  |               sender.send(message);
  |               sender.close();
  |               String id = message.getJMSMessageID();
  | 
  |               QueueReceiver receiver = qs.createReceiver(replyQ, "JMSCorrelationID 
= '"+id+"'");
  |               receiver.setMessageListener(listener);
  |               qc.start(); // i understand this call is only necessary once but 
outside of this isolation test this is the way it is called
  | 
  |               sentMessages.put(id, receiver);
  |             }
  |           }
  |           catch (JMSException e)
  |           {
  |             e.printStackTrace();
  |           }
  |         }
  |       };
  | 
  |   Thread[] t = new Thread[3];
  |   t[0] = new Thread(run);
  |   t[1] = new Thread(run);
  |   t[2] = new Thread(run);
  |   t[0].start();
  |   t[1].start();
  |   t[2].start();
  |   while (t[0].isAlive() || t[1].isAlive() || t[2].isAlive())
  |     Thread.sleep(250);
  | 
  |   while (!sentMessages.isEmpty())
  |     Thread.sleep(250);
  | 
  |   qs.close();
  |   qc.close();
  | }
  | 

The above test reproduced what I am experiencing.   On there server side there is just 
a simple Message Driven Bean listening to xx-MessageTest and return responses 
containing the contents of the message to xx-ReturnMessageTest.

The line in question is the one commented out with "//****" -- if that line is left 
out then the server logs look normal but the client process eats up 3000 threads 
before finishing.   If that line is in place then the client process thread count 
stays within reason but the server throws the "javax.jms.JMSException: The provided 
subscription does not exist" exception ("WARN") frequently.

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

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


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to