Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQObjectMessageReader


    ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
    assertTrue(msg.getPacketType() == Packet.ACTIVEMQ_OBJECT_MESSAGE);
  }

  public void testReadPacket() {
    ActiveMQObjectMessageReader reader = new ActiveMQObjectMessageReader();
    ActiveMQObjectMessageWriter writer = new ActiveMQObjectMessageWriter();
    ActiveMQObjectMessage msg1 = new ActiveMQObjectMessage();
    try {
      msg1.setObject(this.table);
      super.initializeMessage(msg1);
      byte[] data = writer.writePacketToByteArray(msg1);
      ActiveMQObjectMessage msg2 = (ActiveMQObjectMessage) reader.readPacketFromByteArray(data);
      super.testEquals(msg1, msg2);
      assertTrue(msg1.getObject().equals(msg2.getObject()));
    }
    catch (IOException e) {
      e.printStackTrace();
View Full Code Here


    }
  }
 
  public void testTime(){

    ActiveMQObjectMessageReader reader = new ActiveMQObjectMessageReader();
    ActiveMQObjectMessageWriter writer = new ActiveMQObjectMessageWriter();
    ActiveMQObjectMessage msg1 = new ActiveMQObjectMessage();
   
    ActiveMQObjectMessage msg2 = null;
    try {
      int count = 10000;
      long startTime = System.currentTimeMillis();
   
      msg1.setObject(this.table);
      super.initializeMessage(msg1);
      for (int i = 0; i < count; i++){
        byte[] data = writer.writePacketToByteArray(msg1);
        msg2 = (ActiveMQObjectMessage) reader.readPacketFromByteArray(data);
      }
      long finishTime = System.currentTimeMillis();
      long totalTime = finishTime-startTime;
      long ps = (count * 1000)/totalTime;
      System.out.println("Time taken :" + totalTime + " for " + count + "iterations, = " + ps +" per sec.");
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQObjectMessageReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.