public static void endSegment() { globalRecorder.endSegment(); }
public static void endSegment() { globalRecorder.endSegment(); }
public void close() { getCreator().endSegment(); }
public void close() { getCreator().endSegment(); }
/** * Begins a segment and passes it to the supplied consumer. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param name * the name to use for the created segment * @param consumer * the function to invoke */ public void createSegment(String name, Consumer<Segment> consumer) { Segment segment = beginSegment(name); try { consumer.accept(segment); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment, invokes the provided supplier, and ends the segment before returning the supplier's result. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param <R> * the type of the value returned by {@code supplier} * @param name * the name to use for the created segment * @param supplier * the supplier to invoke * @return the value returned by the provided supplier */ public <R> R createSegment(String name, Supplier<R> supplier) { Segment segment = beginSegment(name); try { return supplier.get(); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment, runs the provided runnable, and ends the segment before returning the supplier's result. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param name * the name to use for the created segment * @param runnable * the runnable to run */ public void createSegment(String name, Runnable runnable) { Segment segment = beginSegment(name); try { runnable.run(); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment, runs the provided runnable, and ends the segment before returning the supplier's result. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param name * the name to use for the created segment * @param runnable * the runnable to run */ public void createSegment(String name, Runnable runnable) { Segment segment = beginSegment(name); try { runnable.run(); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment and passes it to the supplied consumer. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param name * the name to use for the created segment * @param consumer * the function to invoke */ public void createSegment(String name, Consumer<Segment> consumer) { Segment segment = beginSegment(name); try { consumer.accept(segment); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment, invokes the provided supplier, and ends the segment before returning the supplier's result. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param <R> * the type of the value returned by {@code supplier} * @param name * the name to use for the created segment * @param supplier * the supplier to invoke * @return the value returned by the provided supplier */ public <R> R createSegment(String name, Supplier<R> supplier) { Segment segment = beginSegment(name); try { return supplier.get(); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment, passes it to the supplied function, and ends the segment before returning the supplied function's result. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param <R> * the type of the value returned by {@code function} * @param name * the name to use for the created segment * @param function * the function to invoke * @return the value returned by the supplied function */ public <R> R createSegment(String name, Function<Segment, R> function) { Segment segment = beginSegment(name); try { return function.apply(segment); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
/** * Begins a segment, passes it to the supplied function, and ends the segment before returning the supplied function's result. Intercepts exceptions, adds them to the segment, and re-throws them. * * @param <R> * the type of the value returned by {@code function} * @param name * the name to use for the created segment * @param function * the function to invoke * @return the value returned by the supplied function */ public <R> R createSegment(String name, Function<Segment, R> function) { Segment segment = beginSegment(name); try { return function.apply(segment); } catch (Exception e) { segment.addException(e); throw e; } finally { endSegment(); } }
recorder.endSegment();