@Internal @ParametersAreNonnullByDefault public class DefaultActivityMonitor extends Object implements ActivityMonitor
Constructor and Description |
---|
DefaultActivityMonitor() |
Modifier and Type | Method and Description |
---|---|
Activity |
registerStart(String userId,
String type,
String summary)
Starts tracking an activity using the current thread.
|
Collection<ActivitySnapshot> |
snapshotCurrent()
Returns an immutable snapshot of the current activity in the system.
|
@Nonnull public Activity registerStart(String userId, String type, String summary)
ActivityMonitor
Activity.close()
on the returned Activity
after 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 }
registerStart
in interface ActivityMonitor
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@Nonnull public Collection<ActivitySnapshot> snapshotCurrent()
ActivityMonitor
snapshotCurrent
in interface ActivityMonitor
Copyright © 2003–2015 Atlassian. All rights reserved.