/** * Associates the specified value with default key {@code JK_CORR_SESSION_ID} with this map. * * @param value * value to be associated with default key {@code JK_CORR_SESSION_ID} * @return null if no previous value exists, previous value */ public static String set(String value) { return set(JK_CORR_SESSION_ID, value); }
/** * Get value associated with default key {@code JK_CORR_REQUEST_ID} * * @return value associated with default key {@code JK_CORR_REQUEST_ID} */ public static String getRequestId() { return get(JK_CORR_REQUEST_ID); }
/** * Create a default time tracker with specified capacity and life span. * * @param capacity * maximum capacity * @param lifeSpan * life span in milliseconds * @return a new time tracker instance */ public static TimeTracker newTracker(int capacity, long lifeSpan) { return new TimeTracker(capacity, lifeSpan, TimeUnit.MILLISECONDS); }
/** * Indicates that application activity has ended. * * @param ex * exception associated with the activity or null if none. * @see ActivityStatus */ public void stop(Throwable ex) { stop((ex != null ? ActivityStatus.EXCEPTION : ActivityStatus.END), (ex != null ? OpCompCode.WARNING : OpCompCode.SUCCESS), ex, 0); }
@Override public String format(TrackingEvent event) { return event.getMessage(); }
@Override public TrackingActivity newActivity(OpLevel level, String name) { return newActivity(level, name, null); }
/** * Create a context reference for a given object with * a given unique id. * * @param obj for which to create a reference * @param cid correlation to be associated with this context reference */ public ContextRef(Object obj, String cid) { this(getObjectRef(obj), cid); }
/** * Hit this entry, time stamp it and count the number of hits * * @return elapsed nanoseconds since the last hit */ public long hit() { return hit(+1); }
private boolean isTrackingEnabled(OpLevel level, Object... args) { if (filter == null) { return true; } return filter.isTrackingEnabled(this, level, args); }
@Override protected TimeStats initialValue() { return new TimeStats(); } };
/** Cannot instantiate. */ private TrackingLogger(Tracker trg) { logger = trg; selector = logger.getTrackingSelector(); }
@Override public String format(TrackingEvent event) { return event.toString(); }
protected NullActivity() { super(OpLevel.NONE, Operation.NOOP); super.setType(OpType.NOOP); }
@Override public String newUUID() { return newUUID(tConfig); }
/** * Miss this entry, time stamp it and count the number of miss * * @return elapsed nanoseconds since the last miss */ public long miss() { return miss(+1); }
/** * Indicates that application activity has ended normally without exception. * * @param elapsedUsec * elapsed time in microseconds */ @Override public void stop(long elapsedUsec) { stop(ActivityStatus.END, null, elapsedUsec); }
/** * Associates the specified value with default key {@code JK_CORR_REQUEST_ID} with this map. * * @param value * value to be associated with default key {@code JK_CORR_REQUEST_ID} * @return null if no previous value exists, previous value */ public static String setRequestId(String value) { return set(JK_CORR_REQUEST_ID, value); }
/** * Get value associated with default key {@code JK_CORR_SESSION_ID} * * @return value associated with default key {@code JK_CORR_SESSION_ID} */ public static String get() { return get(JK_CORR_SESSION_ID); }
@Override public TrackingActivity newActivity(OpLevel level) { return newActivity(level, Operation.NOOP); }