Package com.dianping.cat.message

Examples of com.dianping.cat.message.Transaction.addData()


      String ip = NetworkInterfaceManager.INSTANCE.getLocalHostAddress();
      Transaction root = cat.newTransaction("System", "Dump-" + ip);

      Collections.sort(paths);

      root.addData("files", paths);
      root.setStatus(Message.SUCCESS);

      for (int i = 0; i < len; i++) {
        String path = paths.get(i);
        Transaction t = cat.newTransaction("System", "UploadDump");
View Full Code Here


      for (int i = 0; i < len; i++) {
        String path = paths.get(i);
        Transaction t = cat.newTransaction("System", "UploadDump");
        File file = new File(baseDir, path);

        t.addData("file", path);

        FSDataOutputStream fdos = null;
        FileInputStream fis = null;
        try {
          fdos = makeHdfsOutputStream(path);
View Full Code Here

          double sec = (System.currentTimeMillis() - start) / 1000d;
          String size = Formats.forNumber().format(file.length(), "0.#", "B");
          String speed = sec <= 0 ? "N/A" : Formats.forNumber().format(file.length() / sec, "0.0", "B/s");

          t.addData("size", size);
          t.addData("speed", speed);
          t.setStatus(Message.SUCCESS);

          if (!file.delete()) {
            m_logger.warn("Can't delete file: " + file);
View Full Code Here

          double sec = (System.currentTimeMillis() - start) / 1000d;
          String size = Formats.forNumber().format(file.length(), "0.#", "B");
          String speed = sec <= 0 ? "N/A" : Formats.forNumber().format(file.length() / sec, "0.0", "B/s");

          t.addData("size", size);
          t.addData("speed", speed);
          t.setStatus(Message.SUCCESS);

          if (!file.delete()) {
            m_logger.warn("Can't delete file: " + file);
          }
View Full Code Here

          }
          return false;
        }
      });

      t.addData(paths.toString());
      for (String dataFile : paths) {
        try {
          Cat.getProducer().logEvent("HDFSBucket", dataFile);
          HdfsMessageBucket bucket = m_buckets.get(dataFile);
View Full Code Here

          }
          if (bucket != null) {
            MessageTree tree = bucket.findById(messageId);

            if (tree != null && tree.getMessageId().equals(messageId)) {
              t.addData("path", dataFile);
              return tree;
            }
          }
        } catch (Exception e) {
          t.setStatus(e);
View Full Code Here

  @Test
  public void testWithoutInitialize() throws InterruptedException {
    MessageProducer cat = Cat.getProducer();
    Transaction t = cat.newTransaction("TestType", "TestName");

    t.addData("data here");
    t.setStatus("TestStatus");
    t.complete();

    Thread.sleep(100);
    Assert.assertEquals(true, Cat.isInitialized());
View Full Code Here

  public void testWithInitialize() throws InterruptedException {
    Cat.initialize(new File("/data/appdatas/cat/client.xml"));
    MessageProducer cat = Cat.getProducer();
    Transaction t = cat.newTransaction("TestType", "TestName");

    t.addData("data here");
    t.setStatus("TestStatus");
    t.complete();

    Thread.sleep(100);
View Full Code Here

  public void testWithNoExistGlobalConfigInitialize() throws InterruptedException {
    Cat.initialize(new File("/data/appdatas/cat/clientNoExist.xml"));
    MessageProducer cat = Cat.getProducer();
    Transaction t = cat.newTransaction("TestType", "TestName");

    t.addData("data here");
    t.setStatus("TestStatus");
    t.complete();

    Thread.sleep(100);
View Full Code Here

  @Test
  public void testJobTest() throws Exception{
    Cat.initialize("192.168.7.70","192.168.7.71");
    Transaction t = Cat.newTransaction("TestType", "TestName");

    t.addData("data here");
    t.setStatus("TestStatus");
    t.complete();

    Thread.sleep(10000);
  }
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.