Package com.dianping.cat.broker.api.app

Examples of com.dianping.cat.broker.api.app.AppData


  private void processOneRecord(int cityId, int operatorId, String record) {
    String items[] = record.split("\t");

    if (items.length == 10) {
      AppData appData = new AppData();

      try {
        String url = URLDecoder.decode(items[4], "utf-8").toLowerCase();
        Integer command = m_appConfigManager.getCommands().get(url);

        if (command != null) {
          // appData.setTimestamp(Long.parseLong(items[0]));
          appData.setTimestamp(System.currentTimeMillis());
          appData.setCommand(command);
          appData.setNetwork(Integer.parseInt(items[1]));
          appData.setVersion(Integer.parseInt(items[2]));
          appData.setConnectType(Integer.parseInt(items[3]));
          appData.setCode(Integer.parseInt(items[5]));
          appData.setPlatform(Integer.parseInt(items[6]));
          appData.setRequestByte(Integer.parseInt(items[7]));
          appData.setResponseByte(Integer.parseInt(items[8]));
          appData.setResponseTime(Integer.parseInt(items[9]));
          appData.setCity(cityId);
          appData.setOperator(operatorId);
          appData.setCount(1);

          int responseTime = appData.getResponseTime();

          if (responseTime < 60 * 1000 && responseTime >= 0) {
            offerQueue(appData);

            Cat.logEvent("Command", url, Event.SUCCESS, null);
          } else if (responseTime > 0) {
            Integer tooLong = m_appConfigManager.getCommands().get(TOO_LONG);

            if (tooLong != null) {
              appData.setCommand(tooLong);
              offerQueue(appData);
            }
            Cat.logEvent("ResponseTooLong", url, Event.SUCCESS, String.valueOf(responseTime));
          } else {
            Cat.logEvent("ResponseTimeError", url, Event.SUCCESS, String.valueOf(responseTime));
View Full Code Here


    HashMap<String, AppData> data = new HashMap<String, AppData>();

    datas.put(1, data);

    for (int i = 0; i < 10; i++) {
      AppData createAppData = createAppData(i);
      data.put(createAppData.toString(), createAppData);
    }

    handler.save(file);

    datas.clear();

    handler.load(file);
    AppDataQueue<AppData> queue = handler.getAppDataQueue();

    while (true) {
      AppData appdata = queue.poll();
      if (appdata != null) {

        handler.processEntity(appdata);
      } else {
        break;
View Full Code Here

    HashMap<String, AppData> temp = handler.getDatas().get(1);
    Assert.assertEquals(10, temp.size());
  }

  public AppData createAppData(int i) {
    AppData appdata = new AppData();

    appdata.setCommand(1);
    appdata.setVersion(i);
    appdata.setCity(i);
    appdata.setCode(i);
    appdata.setConnectType(1);
    appdata.setPlatform(i);
    appdata.setOperator(1);
    appdata.setCount(1);
    appdata.setPlatform(1);
    appdata.setRequestByte(10);
    appdata.setResponseByte(10);

    return appdata;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.broker.api.app.AppData

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.