/** * 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); }
* * @param locale the locale to apply for formatting. */ public static void setLocale(Locale locale) { getFormatters().setLocale(locale); } /**
public synchronized void addRow(Object obj) { if (!enabled || bufferSize<=0) return; // remove the oldest element if the buffer is to capacity. if (getRowCount()>=bufferSize && bufferHolder.shouldReplaceWith(obj)) { bufferHolder.remove(obj); } if (getRowCount()<bufferSize) { bufferHolder.add(obj); } }
private ArraySorterEntry[] getArraySorterEntries() { Object[] arrayToSort = getArrayToSort(); ArraySorterEntry[] arraySorterEntries=new ArraySorterEntry[getRows()]; for(int i=0; i<getRows(); i++) { arraySorterEntries[i] = new ArraySorterEntry(arrayToSort[i], (Comparable) array[i][sortCol]) ; } return arraySorterEntries; }
/** * @return the thread local storage for the number formatting decimal grouping separator * specific for the locale */ public static char getDecimalGroupSeparator() { return getFormatters().getDecimalGroupSeparator(); }
/** * Sets the locale to apply for formatting. * * @param locale the locale to apply for formatting. */ public static void setLocale(Locale locale) { getFormatters().setLocale(locale); }
/** @return the locale specific date time formatter */ public static DateFormat getDateFormatter() { return getFormatters().getDateFormatter(); }
/** @return the thread local storage for the currency formatting specific for the locale */ public static DecimalFormat getCurrencyFormatter() { return getFormatters().getCurrencyFormatter(); }
/** Iterate through an Enumeration passing the Command object each element in the Collection **/ public static void iterate(Enumeration enumer, Command command)throws Exception { iterate(new EnumIterator(enumer) , command); }
/** @return the thread local storage for the integral number formatting specific for the locale */ public static DecimalFormat getIntegerFormatter() { return getFormatters().getIntegerFormatter(); }
/** @return the thread local storage for the percent number formatting specific for the locale */ public static DecimalFormat getPercentFormatter() { return getFormatters().getPercentFormatter(); }
/** Sort a 2 dimensional array based on 1 columns data in either ascending or descending order. * array - Array to be sorted * sortCol - column to sort by * sortOrder - sort the column in ascending or descending order. Valid arguments are "asc" and "desc". **/ public static Object[][] sort(Object[][] array, int sortCol, String sortOrder) { ArraySorter sorter=new ArraySorter(array, sortCol, sortOrder); return sorter.sort(); }
public synchronized BufferList copy() { return new BufferList(header, bufferSize, enabled, bufferHolder.copy()); }
/** * Remove all Exceptions from the buffer. * */ public static void resetExceptionDetail() { params.exceptionBuffer.reset(); }
public static <T> T deserializeFromFile(String fileName) throws Throwable { InputStream inputStream = FileUtils.getInputStream(fileName); return deserialize(inputStream); }
public static void serializeToFile(Serializable object, String fileName) throws IOException { OutputStream outputStream = FileUtils.getOutputStream(fileName); serialize(object, outputStream); }
/** * Set the number of Exceptions that can be stored in the buffer before the oldest entries must * be removed. A value of 0 will disable collecting of Exceptions in the buffer. * */ public static void setExceptionBufferSize(int exceptionBufferSize) { params.exceptionBuffer.setBufferSize(exceptionBufferSize); }
private DecimalFormat currencyFormatter; void setLocale(Locale locale) { this.locale = locale; // now all formatters need to re-created when needed, to apply the new locale floatingPointFormatter = null; integerFormatter = null; decimalSeparator = 0; dateFormatter = null; percentFormatter = null; currencyFormatter = null; } Locale getLocale() {
/** @return the thread local storage for the fixed-point number formatting specific for the locale */ public static DecimalFormat getFloatingPointFormatter() { return getFormatters().getFloatingPointFormatter(); }
/** * Remove all SQL from the buffer. * */ public static void resetSQLDetail() { params.sqlBuffer.reset(); }