private void fireMonitoringGapEvent(TransactionMonitor tMon, TransactionMonitor leftChild, TransactionMonitor rightChild, long latency) { EventMonitor eventMonitor = new EventMonitor("MonitoringCoverageGap"); eventMonitor.set("monitorName", tMon.get(Attribute.NAME)); eventMonitor.set("leftChild", leftChild == null ? null : leftChild.get(Attribute.NAME)); eventMonitor.set("rightChild", rightChild == null ? null : rightChild.get(Attribute.NAME)); eventMonitor.set(Attribute.LATENCY, latency); eventMonitor.fire(); }
fireMonitoringGapEvent(parent, leftChild, rightChild, latency); } else { Date parentStartDate = (Date) parent.get(Attribute.START_TIME); Date parentEndDate = (Date) parent.get(Attribute.END_TIME); if (listSize == 1) { rightChild = (TransactionMonitor) list.get(0); leftChild = rightChild; Date rightChildStartDate = (Date) rightChild.get(Attribute.START_TIME); Date leftChildEndDate = (Date) leftChild.get(Attribute.END_TIME); latency = rightChildStartDate.getTime() - parentStartDate.getTime(); if (latency > threshold) { Date startDateB = (Date) rightChild.get(Attribute.START_TIME); if (startDateB.getTime() - parentStartDate.getTime() > threshold) { fireMonitoringGapEvent(parent, null, rightChild, latency); leftChild = (TransactionMonitor) list.get(aIdx); rightChild = (TransactionMonitor) list.get(bIdx); Date endDateA = (Date) leftChild.get(Attribute.END_TIME); startDateB = (Date) rightChild.get(Attribute.START_TIME); latency = startDateB.getTime() - endDateA.getTime(); if (latency > threshold) { bIdx++; Date endDateB = (Date) rightChild.get(Attribute.END_TIME); latency = parentEndDate.getTime() - endDateB.getTime(); if (latency > threshold) {
/** * 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(); }