Hi all,I am testing the activemq to learn how to use it. I write a simple
single thread jms client to send 10000 messages, but it is blocked at the
5083rd message. I use:

activemq 5.2
jvm  1.5
ubuntu 8.10

and the program is simple :


public class Sender {
    public static void main(String[] args) {
         ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://
10.1.94.237:6000");
         Connection conn = null;
         Session s = null;
         try {
             conn = cf.createConnection();

             s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
             s.run();
             MessageProducer sender =
s.createProducer(s.createQueue("jms_test"));
             for (int i = 0; i < 10000; i++) {
                TextMessage tm = s.createTextMessage();
                tm.setText(String.valueOf(i));
                sender.send(tm);
             }

             System.out.println("Done.");
         }catch (JMSException e) {
             e.printStackTrace();
         } finally {
             if (conn != null) {
                 try {
                     conn.close();
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
             }

             if (s != null) {
                 try {
                     s.close();
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
             }
         }
    }
}

anyone knows why it is blocked? Thanks

Reply via email to