/** * Ends a segment. * * @throws SegmentNotFoundException * if {@code contextMissingStrategy} throws exceptions and no segment is currently in progress */ public void endSegment() { SegmentContext context = getSegmentContext(); if (null != context) { context.endSegment(this); } Entity current; if ((current = getTraceEntity()) != null) { Segment segment = current.getParentSegment(); logger.debug("Ending segment named '" + segment.getName() + "'."); if(segment.end()) { sendSegment(segment); } else { logger.debug("Not emitting segment named '" + segment.getName() + "' as it parents in-progress subsegments."); } clearTraceEntity(); } else { getContextMissingStrategy().contextMissing("Failed to end segment: segment cannot be found.", SegmentNotFoundException.class); } }
/** * Ends a segment. * * @throws SegmentNotFoundException * if {@code contextMissingStrategy} throws exceptions and no segment is currently in progress */ public void endSegment() { SegmentContext context = getSegmentContext(); if (null != context) { context.endSegment(this); } Entity current; if ((current = getTraceEntity()) != null) { Segment segment = current.getParentSegment(); logger.debug("Ending segment named '" + segment.getName() + "'."); if(segment.end()) { sendSegment(segment); } else { logger.debug("Not emitting segment named '" + segment.getName() + "' as it parents in-progress subsegments."); } clearTraceEntity(); } else { getContextMissingStrategy().contextMissing("Failed to end segment: segment cannot be found.", SegmentNotFoundException.class); } }