com.jamonapi.Monitor.getMonKey()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中com.jamonapi.Monitor.getMonKey()方法的一些代码示例,展示了Monitor.getMonKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Monitor.getMonKey()方法的具体详情如下:
包路径:com.jamonapi.Monitor
类名称:Monitor
方法名:getMonKey

Monitor.getMonKey介绍

暂无

代码示例

代码示例来源:origin: net.sf.patterntesting/patterntesting-rt

/**
 * Gets the mon key.
 *
 * @return monitor key
 *
 * @see com.jamonapi.Monitor#getMonKey()
 */
public MonKey getMonKey() {
  return monitor.getMonKey();
}

代码示例来源:origin: org.patterntesting/patterntesting-rt

/**
 * Gets the mon key.
 *
 * @return monitor key
 *
 * @see com.jamonapi.Monitor#getMonKey()
 */
public MonKey getMonKey() {
  return monitor.getMonKey();
}

代码示例来源:origin: stevensouza/jamonapi

private void initializeForLookUps() {
  map = new HashMap<MonKey, Monitor>();
  if (monitors!=null) {
    for (Monitor mon : monitors) {
      map.put(mon.getMonKey(), mon);
    }
  }
}

代码示例来源:origin: com.jamonapi/com.springsource.com.jamonapi

/** Returns the label for the monitor */
public String getLabel() {
  return (String) getMonKey().getValue(MonKey.LABEL_HEADER);
}

代码示例来源:origin: com.jamonapi/com.springsource.com.jamonapi

/** Returns the units for the monitor */
public String getUnits() {
  return (String) getMonKey().getValue(MonKey.UNITS_HEADER);
}

代码示例来源:origin: stevensouza/jamonapi

/** Returns the label for the monitor */
public String getLabel() {
  return (String) getMonKey().getValue(MonKey.LABEL_HEADER);
}

代码示例来源:origin: stevensouza/jamonapi

/** Returns the units for the monitor */
public String getUnits() {
  return (String) getMonKey().getValue(MonKey.UNITS_HEADER);
}

代码示例来源:origin: stevensouza/jamonapi

/**
 *
 * @return A collection of all the unit types that are currently in this object (i.e. ms., ns., Exception,...)
 * @since  2.81
 */
public Collection<String> getDistinctUnits() {
  Set<String> units = new TreeSet<String>();
  int size=monitors.length;
  for (int i=0;i<size;i++) {
    units.add(monitors[i].getMonKey().getRangeKey());
  }
  return units;
}

代码示例来源:origin: stevensouza/jamonapi

private SQLDeArgMon appendDetails(String stackTrace) {
  if ("".equalsIgnoreCase(stackTrace))
    return this;
  Monitor[] monArr=monitors.getMonitors();
  StringBuilder sb=new StringBuilder();
  sb.append(monArr[0].getMonKey().getDetails()).append("\n").append(stackTrace);
  for (int i=0;i<monArr.length;i++) {
    Monitor mon=monArr[i];
    mon.getMonKey().setDetails(sb.toString());
  }
  return this;
}

代码示例来源:origin: stevensouza/jamonapi

private Monitor[] getMonitorsWithUnits(String units) {
  if (monitors==null || units==null) {
    return null;
  } else if ("AllMonitors".equalsIgnoreCase(units)) {
    return monitors;
  }
  int size=monitors.length;
  List rows=new ArrayList(monitors.length);
  for (int i=0;i<size;i++) {
    // if units of range match units of this monitor then
    if (units.equalsIgnoreCase(monitors[i].getMonKey().getRangeKey())) {
      rows.add(monitors[i]);
    }
  }
  if (rows.size()==0) {
    return null;
  } else {
    return (MonitorImp[]) rows.toArray(new MonitorImp[0]);
  }
}

代码示例来源:origin: stevensouza/jamonapi

public JAMonDetailValue getJAMonDetailRow() {
  if (monData.enabled) {
    synchronized (monData) {
      return new JAMonDetailValue(getMonKey(),
          monData.lastValue, monData.getThisActiveCount(),  monData.lastAccess);
    }
  } else
    return JAMonDetailValue.NULL_VALUE;
}

代码示例来源:origin: stevensouza/jamonapi

private void changeDetails() {
  int len=(timeMons==null) ? 0 : timeMons.length;
  for (int i=0;i<len;i++)
    timeMons[i].getMonKey().setDetails( getDetailLabel());
}

代码示例来源:origin: stevensouza/jamonapi

/** Note this creates 2 exception monitors and the more specific one is returned */
@Override
public Monitor addException(Monitor mon, Throwable throwable) {
 String stackTtrace = new StringBuffer("stackTrace=")
   .append(Misc.getExceptionTrace(throwable))
   .toString();
 if (mon!=null) {
   MonKey key = mon.getMonKey();
   key.setDetails(stackTtrace);
 }
 MonitorFactory.add(new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, stackTtrace, "Exception"), 1);
 return MonitorFactory.add(new MonKeyImp(throwable.getClass().getName(), stackTtrace, "Exception"), 1);
}

代码示例来源:origin: com.jamonapi/com.springsource.com.jamonapi

public JAMonDetailRow getJAMonDetailRow() {
  if (monData.enabled) {
    synchronized (monData) {
      return new JAMonDetailValue(getMonKey().getDetailLabel(),
          monData.lastValue, monData.activityStats.thisActive.getCount(),  monData.lastAccess);
    }
  } else
    return JAMonDetailValue.NULL_VALUE;
}

代码示例来源:origin: stevensouza/jamonapi

/** @return Return all the MonitorComposites passed into the constructor as one List */
  public List<Monitor> toList() {
    List<Monitor> list = new ArrayList<Monitor>();
    while (hasNext()) {
      Monitor mon = next();
      if (!currentMonitorComposite.isLocalInstance()) {
       // done so monitors can be identified by instance when viewed in jamonadmin.jsp
       // Don't want to do this for the local instance as it is not needed as it is the default and
       // it is the only one that is not a copy/clone of the original.
       mon.getMonKey().setInstanceName(currentMonitorComposite.getInstanceName());
      }

      list.add(mon);
    }

    return list;
  }
}

代码示例来源:origin: stevensouza/automon

@Override
public void stop(Monitor mon, Throwable throwable) {
  mon.stop();
  put(throwable);
  // note the following 'get' always succeeds because of the above 'put'
  mon.getMonKey().setDetails(get(throwable));
}

代码示例来源:origin: org.automon/automon

@Override
public void stop(Monitor mon, Throwable throwable) {
  mon.stop();
  put(throwable);
  // note the following 'get' always succeeds because of the above 'put'
  mon.getMonKey().setDetails(get(throwable));
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

public FinalizedMonitor(Monitor m){
  header = (String)m.getMonKey().getValue(MonKey.LABEL_HEADER);
  units = (String)m.getMonKey().getValue(MonKey.UNITS_HEADER);
  avg = m.getAvg();
  hits = m.getHits();
  stdDev = m.getStdDev();
  lastValue = m.getLastValue();
  max = m.getMax();
  min = m.getMin();
  total = m.getTotal();
  
  
}

代码示例来源:origin: stevensouza/jamonapi

/**
 * When this event is fired the monitor will be added to the rolling buffer.
 * If it is a log4j monitor the buffer will be specific to log4j fields
 * (i.e.LoggingEvent info such as threadname, formattedmessage, exception
 * stack trace and a few others. If it is not then the super class's
 * processEvent is called.
 * 
 */
@Override
public void processEvent(Monitor mon) {
  MonKey monKey = mon.getMonKey();
  // If the key is a log4j key it has the LoggingEvent in it and we can
  // put that data into the buffer. If the first record is passed and it is a Log4JMonKey then use
  // more specific log4j detail buffer array.  Note this variable is also used in the header method.
  if (monKey instanceof Log4jMonKey && !isLog4jMonKey)
    isLog4jMonKey = true;
  if (isLog4jMonKey) {
    Log4jMonKey key = (Log4jMonKey) monKey;
    getBufferList().addRow(toArray(key.getLoggingEvent(), mon));
  } else
    super.processEvent(mon);
}

代码示例来源:origin: stevensouza/jamonapi

/**
 * method that returns an array to use in the Buffer. It can return any
 * sortable objects as long as they match what is returned in the
 * getHeader() method.
 * 
 * @param event
 * @param mon
 * @return Object[]
 */
protected Object[] toArray(LoggingEvent event, Monitor mon) {
  // populate header with standard monitor data first and after the fact by log4j data
  Object[] data=log4jHeader.getData(mon);
  data[0]=mon.getMonKey().getDetails();
  data[1]=event.getLoggerName();
  data[2]=event.getLevel().toString();
  data[3]=event.getThreadName();
  data[4]=(event.getThrowableInformation() == null || event.getThrowableInformation().getThrowable() == null) ?
      "" : Misc.getExceptionTrace(event.getThrowableInformation().getThrowable());
  return data;
}

相关文章