[jboss-user] [JBoss Messaging] - Re: Problem with large strings

timfox do-not-reply at jboss.com
Thu Jul 27 12:07:14 EDT 2006


  | Connection conn = cf.createConnection();
  |       
  |       conn.start();
  | 
  |       Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
  | 
  |       MessageProducer prod = sess.createProducer(queue);
  |       
  |       prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
  |       
  |       StringBuffer sb = new StringBuffer();      
  |       for (int i = 0; i < 50 * 1024 * 1024; i++)
  |       {
  |          sb.append("X");
  |       }
  |       String s = sb.toString();
  |       
  |       TextMessage tm1 = sess.createTextMessage(s);
  |       
  |       long start = System.currentTimeMillis();
  |       log.info("Sending message");
  |       prod.send(tm1);
  |       log.info("Sent message");
  |       long end = System.currentTimeMillis();
  |       
  |       log.info("Send took " + (end-start) + " ms");
  |       
  |       MessageConsumer cons = sess.createConsumer(queue);
  |       
  |       start = System.currentTimeMillis();
  |       log.info("Receiving message");
  |       TextMessage tm2 = (TextMessage)cons.receive(1000);
  |       log.info("Received message");
  |       end  = System.currentTimeMillis();
  |       
  |       log.info("Receive took " + (end-start) + " ms");
  |             
  |       assertEquals(tm1.getText(), tm2.getText());
  |       
  |       conn.close();
  | 

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

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



More information about the jboss-user mailing list