Class NopActivityMonitor
- java.lang.Object
-
- com.atlassian.confluence.util.profiling.NopActivityMonitor
-
- All Implemented Interfaces:
ActivityMonitor
@Internal @ParametersAreNonnullByDefault public class NopActivityMonitor extends Object implements ActivityMonitor
Provides an implementation of theActivityMonitorthat does nothing. Useful if you are in situations (legacy code) that does not have access to the real service.- Since:
- 5.7
-
-
Field Summary
Fields Modifier and Type Field Description static NopActivityMonitorINSTANCE
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Field Detail
-
INSTANCE
public static final NopActivityMonitor INSTANCE
-
-
Method Detail
-
registerStart
public @NonNull Activity registerStart(String userId, String type, String summary)
Description copied from interface:ActivityMonitorStarts 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 }- Specified by:
registerStartin interfaceActivityMonitor- 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
public @NonNull Collection<ActivitySnapshot> snapshotCurrent()
Description copied from interface:ActivityMonitorReturns an immutable snapshot of the current activity in the system.- Specified by:
snapshotCurrentin interfaceActivityMonitor- Returns:
- an immutable snapshot of the current activity in the system.
-
-