Interface ActivityMonitor
-
- All Known Implementing Classes:
DefaultActivityMonitor,NopActivityMonitor
@Internal @ParametersAreNonnullByDefault public interface ActivityMonitorRepresents the ability to record current activity in the system. It is expected that activities to be monitored are registered as starting usingregisterStart(String, String, String)and finishing usingActivity.close().- Since:
- 5.7
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull ActivityregisterStart(String userId, String type, String summary)Starts tracking an activity using the current thread.@NonNull Collection<ActivitySnapshot>snapshotCurrent()Returns an immutable snapshot of the current activity in the system.
-
-
-
Method Detail
-
registerStart
@NonNull Activity registerStart(String userId, String type, String summary)
Starts tracking an activity using the current thread. The caller must callActivity.close()on the returnedActivityafter the activity has completed.The typical usage is:
final Activity activity = activityMonitor.registerStart(userId, type, summary); try { // code to execute } finally { activity.close(); }Under Java 7, the following is also possible:
try (Activity activity = activityMonitor.registerStart(userId, type, summary)) { // code to execute }- Parameters:
userId- the identifier of the user associated with the activity.type- the type of activity being performed. E.g. web-requestsummary- a textual summary of the activity. E.g. /some/url.action
-
snapshotCurrent
@NonNull Collection<ActivitySnapshot> snapshotCurrent()
Returns an immutable snapshot of the current activity in the system.- Returns:
- an immutable snapshot of the current activity in the system.
-
-