Package com.dianping.cat.message.spi

Examples of com.dianping.cat.message.spi.MessageCodec.encode()


  @Test
  public void testCodePerformance() throws Exception {
    MessageCodec codec = lookup(MessageCodec.class, ID);
    MessageTree tree = buildMessage();
    ChannelBuffer buf = new DynamicChannelBuffer(10240);
    codec.encode(tree, buf);

    int count = 5000000;
    for (int i = 0; i < count; i++) {

      buf.markReaderIndex();
View Full Code Here


    MessageTree tree = m_queue.poll();

    MessageCodec codec = Cat.lookup(MessageCodec.class, "plain-text");
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer(4 * 1024);

    codec.encode(tree, buf);

    buf.readInt();
    MessageTree tree2 = codec.decode(buf);

    Assert.assertEquals(tree.toString(), tree2.toString());
View Full Code Here

  @Test
  public void testCodePerformance() throws Exception {
    MessageCodec codec = lookup(MessageCodec.class, ID);
    MessageTree tree = buildMessage();
    ChannelBuffer buf = new DynamicChannelBuffer(10240);
    codec.encode(tree, buf);
    MessageTree result = new DefaultMessageTree();
    codec.decode(buf, result);
    Assert.assertEquals(tree.toString(), result.toString());
  }
View Full Code Here

    while (true) {
      MessageTree tree = m_queue.poll();

      if (tree != null) {
        codec.encode(tree, null);
      } else {
        break;
      }
    }
   
View Full Code Here

    if (tree.getMessage() instanceof Transaction && request.getProperty("waterfall", "false").equals("true")) {
      // to work around a plexus injection bug
      MessageCodec codec = lookup(MessageCodec.class, "waterfall");

      codec.encode(tree, buf);
    } else {
      m_codec.encode(tree, buf);
    }

    try {
View Full Code Here

      if (tree.getMessage() instanceof Transaction && request.getProperty("waterfall", "false").equals("true")) {
        // to work around a plexus injection bug
        MessageCodec codec = lookup(MessageCodec.class, "waterfall");

        codec.encode(tree, buf);
      } else {
        m_codec.encode(tree, buf);
      }

      try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.