com.atlassian.confluence.util.profiling
Class DefaultActivityMonitor

java.lang.Object
  extended by com.atlassian.confluence.util.profiling.DefaultActivityMonitor
All Implemented Interfaces:
ActivityMonitor

@Internal
@ParametersAreNonnullByDefault
public class DefaultActivityMonitor
extends Object
implements ActivityMonitor

Since:
5.7

Constructor Summary
DefaultActivityMonitor()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultActivityMonitor

public DefaultActivityMonitor()
Method Detail

registerStart

@Nonnull
public Activity registerStart(String userId,
                                      String type,
                                      String summary)
Description copied from interface: ActivityMonitor
Starts tracking an activity using the current thread. The caller must call 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
 }
 

Specified by:
registerStart in interface ActivityMonitor
Parameters:
userId - the identifier of the user associated with the activity.
type - the type of activity being performed. E.g. web-request
summary - a textual summary of the activity. E.g. /some/url.action

snapshotCurrent

@Nonnull
public Collection<ActivitySnapshot> snapshotCurrent()
Description copied from interface: ActivityMonitor
Returns an immutable snapshot of the current activity in the system.

Specified by:
snapshotCurrent in interface ActivityMonitor
Returns:
an immutable snapshot of the current activity in the system.


Copyright © 2003–2015 Atlassian. All rights reserved.