示例#1
0
 @RequestHandler(RequestCmd.LIST_CONFIGURE_WAS)
 public Pack listConfigure(Pack param) {
   MapValue m = Configure.getInstance().getKeyValueInfo();
   MapPack pack = new MapPack();
   pack.put("key", m.getList("key"));
   pack.put("value", m.getList("value"));
   pack.put("default", m.getList("default"));
   return pack;
 }
示例#2
0
 public MapValue getKeyValueInfo() {
   StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
   StringKeyLinkedMap<Object> curMap = ConfigValueUtil.getConfigDefault(this);
   MapValue m = new MapValue();
   ListValue nameList = m.newList("key");
   ListValue valueList = m.newList("value");
   ListValue defList = m.newList("default");
   StringEnumer enu = defMap.keys();
   while (enu.hasMoreElements()) {
     String key = enu.nextString();
     if (ignoreSet.contains(key)) continue;
     nameList.add(key);
     valueList.add(ConfigValueUtil.toValue(curMap.get(key)));
     defList.add(ConfigValueUtil.toValue(defMap.get(key)));
   }
   return m;
 }
  public void refresh() {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    Value v = null;
    try {
      MapPack param = new MapPack();
      ListValue objHashLv =
          AgentModelThread.getInstance().getLiveObjHashLV(serverId, CounterConstants.MARIA_PLUGIN);
      if (objHashLv.size() > 0) {
        param.put("objHash", objHashLv);
        v = tcp.getSingleValue(RequestCmd.DB_REALTIME_ACTIVITY, param);
      }
    } catch (Exception e) {
      ConsoleProxy.errorSafe(e.toString());
    } finally {
      TcpProxy.putTcpProxy(tcp);
    }
    if (v == null) {
      ExUtil.exec(
          canvas,
          new Runnable() {
            public void run() {
              setTitleImage(Images.inactive);
              long now = TimeUtil.getCurrentTime(serverId);
              long stime = now - TIME_RANGE;
              xyGraph.primaryXAxis.setRange(stime, now + 1);
            }
          });
    } else {
      MapValue mv = (MapValue) v;
      final DecimalValue callValue = new DecimalValue(mv.getLong("call"));
      final DecimalValue selectValue = new DecimalValue(mv.getLong("select"));
      final DecimalValue insertValue = new DecimalValue(mv.getLong("insert"));
      final DecimalValue updateValue = new DecimalValue(mv.getLong("update"));
      final DecimalValue deleteValue = new DecimalValue(mv.getLong("delete"));

      ExUtil.exec(
          canvas,
          new Runnable() {
            public void run() {
              setTitleImage(Images.active);
              long now = TimeUtil.getCurrentTime(serverId) / REFRESH_INTERVAL * REFRESH_INTERVAL;
              long stime = now - TIME_RANGE;
              xyGraph.primaryXAxis.setRange(stime, now + 1);
              ValueLog valueLog = new ValueLog();
              valueLog.time = now;
              valueLog.delete = deleteValue.value;
              valueLog.update = updateValue.value;
              valueLog.insert = insertValue.value;
              valueLog.select = selectValue.value;
              valueLog.call = callValue.value;
              valueLogs.add(valueLog);
              if (valueLogs.size() > BUFFER_SIZE) {
                valueLogs.removeFirst();
              }
              if (isStackView) {
                updateValue.value += deleteValue.value;
                insertValue.value += updateValue.value;
                selectValue.value += insertValue.value;
                callValue.value += selectValue.value;
              }
              ((CircularBufferDataProvider) callTrace.getDataProvider())
                  .addSample(new Sample(now, callValue.value));
              ((CircularBufferDataProvider) selectTrace.getDataProvider())
                  .addSample(new Sample(now, selectValue.value));
              ((CircularBufferDataProvider) insertTrace.getDataProvider())
                  .addSample(new Sample(now, insertValue.value));
              ((CircularBufferDataProvider) updateTrace.getDataProvider())
                  .addSample(new Sample(now, updateValue.value));
              ((CircularBufferDataProvider) deleteTrace.getDataProvider())
                  .addSample(new Sample(now, deleteValue.value));
              xyGraph.primaryYAxis.setRange(0, getMaxYValue());
            }

            private double getMaxYValue() {
              if (isStackView) {
                return ChartUtil.getMax(
                    ((CircularBufferDataProvider) callTrace.getDataProvider()).iterator());
              }
              double value =
                  ChartUtil.getMax(
                      ((CircularBufferDataProvider) callTrace.getDataProvider()).iterator());
              value =
                  Math.max(
                      value,
                      ChartUtil.getMax(
                          ((CircularBufferDataProvider) selectTrace.getDataProvider()).iterator()));
              value =
                  Math.max(
                      value,
                      ChartUtil.getMax(
                          ((CircularBufferDataProvider) insertTrace.getDataProvider()).iterator()));
              value =
                  Math.max(
                      value,
                      ChartUtil.getMax(
                          ((CircularBufferDataProvider) updateTrace.getDataProvider()).iterator()));
              value =
                  Math.max(
                      value,
                      ChartUtil.getMax(
                          ((CircularBufferDataProvider) deleteTrace.getDataProvider()).iterator()));
              return value;
            }
          });
    }
  }