@Internal @ParametersAreNonnullByDefault public class NopActivityMonitor extends Object implements ActivityMonitor
ActivityMonitor that does nothing.
Useful if you are in situations (legacy code) that does not have access to the real service.| Modifier and Type | Field and Description |
|---|---|
static NopActivityMonitor |
INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
@NonNull Activity |
registerStart(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.
|
public static final NopActivityMonitor INSTANCE
public @NonNull Activity registerStart(String userId, String type, String summary)
ActivityMonitorActivity.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 ActivityMonitoruserId - 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.actionpublic @NonNull Collection<ActivitySnapshot> snapshotCurrent()
ActivityMonitorsnapshotCurrent in interface ActivityMonitorCopyright © 2003–2022 Atlassian. All rights reserved.