Пример #1
0
  public Map<String, Object> getData() throws JMException {
    Map<String, Object> map = new HashMap<String, Object>();

    // 0 - 4
    map.put("ID", id);
    map.put("DataSource", dataSource);
    map.put("SQL", sql);
    map.put("ExecuteCount", getExecuteCount());
    map.put("ErrorCount", getErrorCount());

    // 5 - 9
    map.put("TotalTime", getExecuteMillisTotal());
    map.put("LastTime", getExecuteLastStartTime());
    map.put("MaxTimespan", getExecuteMillisMax());
    map.put("LastError", JMXUtils.getErrorCompositeData(this.getExecuteErrorLast()));
    map.put("EffectedRowCount", getUpdateCount());

    // 10 - 14
    map.put("FetchRowCount", getFetchRowCount());
    map.put("MaxTimespanOccurTime", getExecuteNanoSpanMaxOccurTime());
    map.put("BatchSizeMax", getExecuteBatchSizeMax());
    map.put("BatchSizeTotal", getExecuteBatchSizeTotal());
    map.put("ConcurrentMax", getConcurrentMax());

    // 15 -
    map.put("RunningCount", getRunningCount()); // 15
    map.put("Name", getName()); // 16
    map.put("File", getFile()); // 17

    Throwable lastError = this.executeErrorLast;
    if (lastError != null) {
      map.put("LastErrorMessage", lastError.getMessage()); // 18
      map.put("LastErrorClass", lastError.getClass().getName()); // 19

      map.put("LastErrorStackTrace", IOUtils.getStackTrace(lastError)); // 20
      map.put("LastErrorTime", new Date(executeErrorLastTime)); // 21
    } else {
      map.put("LastErrorMessage", null);
      map.put("LastErrorClass", null);
      map.put("LastErrorStackTrace", null);
      map.put("LastErrorTime", null);
    }

    map.put("DbType", dbType); // 22
    map.put("URL", null); // 23
    map.put("InTransactionCount", getInTransactionCount()); // 24

    map.put("Histogram", this.getHistogramValues()); // 25
    map.put("LastSlowParameters", lastSlowParameters); // 26
    map.put("ResultSetHoldTime", getResultSetHoldTimeMilis()); // 27
    map.put("ExecuteAndResultSetHoldTime", this.getExecuteAndResultSetHoldTimeMilis()); // 28
    map.put("FetchRowCountHistogram", this.getFetchRowCountHistogramValues()); // 29

    map.put("EffectedRowCountHistogram", this.getUpdateCountHistogramValues()); // 30
    map.put(
        "ExecuteAndResultHoldTimeHistogram",
        this.getExecuteAndResultHoldTimeHistogramValues()); // 31
    map.put("EffectedRowCountMax", getUpdateCountMax()); // 32
    map.put("FetchRowCountMax", getFetchRowCountMax()); // 33
    map.put("ClobOpenCount", getClobOpenCount()); // 34

    map.put("BlobOpenCount", getBlobOpenCount()); // 35
    map.put("ReadStringLength", getReadStringLength()); // 36
    map.put("ReadBytesLength", getReadBytesLength()); // 37
    map.put("InputStreamOpenCount", getInputStreamOpenCount()); // 38
    map.put("ReaderOpenCount", getReaderOpenCount()); // 39

    return map;
  }