/** * Count the thrown exception and put the stack trace in the details portion of the key. * This will allow the stack trace to be viewed in the JAMon web application. */ protected void trackException(MonKey key, Throwable ex) { String stackTrace = "stackTrace=" + Misc.getExceptionTrace(ex); key.setDetails(stackTrace); // Specific exception counter. Example: java.lang.RuntimeException MonitorFactory.add(new MonKeyImp(ex.getClass().getName(), stackTrace, "Exception"), 1); // General exception counter which is a total for all exceptions thrown MonitorFactory.add(new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, stackTrace, "Exception"), 1); }
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; }
/** Returns the label for the monitor */ public String getLabel() { return (String) getMonKey().getValue(MonKey.LABEL_HEADER); }
/** * * @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; }
private MonitorImp createMon(MonKey key, boolean isPrimary, boolean isTimeMonitor) { ActivityStats activityStats=new ActivityStats(new Counter(), primaryActive, allActive); // get default range for this type and assign it to the monitor RangeImp range=rangeFactory.getRangeDefault(key.getRangeKey(), activityStats); MonitorImp mon=new MonitorImp(key, range, activityStats, isTimeMonitor); // activity tracking is off by default. if (isTotalKeySizeTrackingEnabled()) { incrementKeySize(key.getSize()); } if (activityTracking) { mon.setActivityTracking(activityTracking); } mon.setPrimary(isPrimary); return mon; }
public List getRowDisplayData(List rowData) { monData.key.getRowDisplayData(rowData); getThisRowData(rowData); if (monData.range!=null) monData.range.getRowDisplayData(rowData); return rowData; }
public List getDisplayHeader(List header) { monData.key.getDisplayHeader(header); getThisData(header); if (monData.range!=null) monData.range.getDisplayHeader(header); return header; }
public List getHeader(List header) { monData.key.getHeader(header); getThisData(header); if (monData.range!=null) monData.range.getHeader(header); return header; }
public List getBasicHeader(List header) { monData.key.getBasicHeader(header); getThisData(header); return header; }
public List getRowData(List rowData) { monData.key.getRowData(rowData); getThisRowData(rowData); if (monData.range!=null) monData.range.getRowData(rowData); return rowData; }
public List getBasicRowData(List rowData) { monData.key.getBasicRowData(rowData); return getThisRowData(rowData); }
/** Returns the units for the monitor */ public String getUnits() { return (String) getMonKey().getValue(MonKey.UNITS_HEADER); }
private MonitorImp[] getMonitors(String units) { MonitorImp[] monitors=getMonitors(); if (monitors==null || units==null) return null; else if ("AllMonitors".equalsIgnoreCase(units)) return monitors; List rows=new ArrayList(500); int size=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]); }
public List getRowDisplayData(List rowData) { monData.key.getRowDisplayData(rowData); getThisRowData(rowData); if (monData.range!=null) monData.range.getRowDisplayData(rowData); return rowData; }
public List getDisplayHeader(List header) { monData.key.getDisplayHeader(header); getThisData(header); if (monData.range!=null) monData.range.getDisplayHeader(header); return header; }
public List getHeader(List header) { monData.key.getHeader(header); getThisData(header); if (monData.range!=null) monData.range.getHeader(header); return header; }
public List getBasicHeader(List header) { monData.key.getBasicHeader(header); getThisData(header); return header; }
public List getRowData(List rowData) { monData.key.getRowData(rowData); getThisRowData(rowData); if (monData.range!=null) monData.range.getRowData(rowData); return rowData; }
public List getBasicRowData(List rowData) { monData.key.getBasicRowData(rowData); return getThisRowData(rowData); }
private void changeDetails() { int len=(timeMons==null) ? 0 : timeMons.length; for (int i=0;i<len;i++) timeMons[i].getMonKey().setDetails( getDetailLabel()); }