/** * Marks this transaction as having succeeded. */ public void succeeded() { set(Attribute.FAILED, false); }
/** * Marks this transaction as having failed. */ public void failed() { set(Attribute.FAILED, true); }
public void process(Monitor monitor) { if (enabled && TransactionMonitor.class.isAssignableFrom(monitor.getClass())) { TransactionMonitor transactionMonitor = (TransactionMonitor) monitor; ThreadMXBean tmxbean = ManagementFactory.getThreadMXBean(); long id = Thread.currentThread().getId(); ThreadInfo threadInfo = tmxbean.getThreadInfo(id); transactionMonitor.set("blockedCount", threadInfo.getBlockedCount()-transactionMonitor.getAsLong("startBlockedCount")); transactionMonitor.set("blockedTime", threadInfo.getBlockedTime()-transactionMonitor.getAsLong("startBlockedTime")); transactionMonitor.set("waitedCount", threadInfo.getWaitedCount()-transactionMonitor.getAsLong("startWaitedCount")); transactionMonitor.set("waitedTime", threadInfo.getWaitedTime()-transactionMonitor.getAsLong("startWaitedTime")); } }
/** * Marks this transaction as having failed due to the supplied Throwable. * * @param e the Throwable that caused the failure */ public void failedDueTo(Throwable e) { set(Attribute.FAILURE_THROWABLE, e).serializable(); failed(); }
/** * Stops the stop watch for this monitor. Delegates to AbstractMonitor.process(). */ public void done() { Date endTime = new Date(); set(Attribute.END_TIME, endTime).serializable().lock(); Date startTime = (Date) get(Attribute.START_TIME); set(Attribute.LATENCY, endTime.getTime() - startTime.getTime()).serializable().lock(); process(); }