com.atlassian.confluence.util.profiling
Class JavaSimonConfluenceMonitoring

java.lang.Object
  extended by com.atlassian.confluence.util.profiling.JavaSimonConfluenceMonitoring
All Implemented Interfaces:
ConfluenceMonitoring, ConfluenceMonitoringControl, org.springframework.beans.factory.InitializingBean

public class JavaSimonConfluenceMonitoring
extends java.lang.Object
implements ConfluenceMonitoring, ConfluenceMonitoringControl, org.springframework.beans.factory.InitializingBean

Implementation of ConfluenceMonitoring that uses Java Simon. It is also responsible for enabling and disabling the monitoring based on events.


Constructor Summary
JavaSimonConfluenceMonitoring(org.javasimon.Manager manager, int maxEntries)
           
 
Method Summary
 void afterPropertiesSet()
           
 java.lang.String createName(java.lang.String name, java.lang.String... optional)
          Creates a legal name from the supplied mandatory suggestion, and optional extra parts.
 void disableCpuTiming()
          Disable capturing CPU timing.
 void disableMonitoring()
          Disable monitoring.
 void enableCpuTiming()
          Enable capturing CPU timing.
 void enableMonitoring()
          Enables monitoring.
 Counter fetchCounter(java.lang.String name, java.lang.String... optional)
          Fetches the counter associated with the supplied name details.
 boolean isCpuTimingEnabled()
           
 boolean isMonitoringEnabled()
           
 Split startSplit(java.lang.String name, java.lang.String... optional)
          Creates and starts a split timer associated with the supplied name details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSimonConfluenceMonitoring

public JavaSimonConfluenceMonitoring(org.javasimon.Manager manager,
                                     int maxEntries)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

fetchCounter

public Counter fetchCounter(java.lang.String name,
                            java.lang.String... optional)
Description copied from interface: ConfluenceMonitoring
Fetches the counter associated with the supplied name details. The name is constructed calling ConfluenceMonitoring.createName(String, String...).

Specified by:
fetchCounter in interface ConfluenceMonitoring
Parameters:
name - the mandatory suggested name
optional - the optional parts to concatenate with the mandatory suggestion
Returns:
the counter associated with the name.

startSplit

public Split startSplit(java.lang.String name,
                        java.lang.String... optional)
Description copied from interface: ConfluenceMonitoring
Creates and starts a split timer associated with the supplied name details. The name is constructed calling ConfluenceMonitoring.createName(String, String...).

The typical usage is:

 final Split split = instance.startSplit("name");
 try {
     // code to execute
 }
 finally {
     split.close();
 }
 

Under Java 7, the following is also possible:

 try (Split split = instance.startSplit("name")) {
     // code to execute
 }
 

Specified by:
startSplit in interface ConfluenceMonitoring
Parameters:
name - the mandatory suggested name
optional - the optional parts to concatenate with the mandatory suggestion
Returns:
the running split timer

createName

public java.lang.String createName(java.lang.String name,
                                   java.lang.String... optional)
Description copied from interface: ConfluenceMonitoring
Creates a legal name from the supplied mandatory suggestion, and optional extra parts.

The method is provided for the case where the caller wants to pre-compute the name. For example, it maybe more efficient to generate the name once, to be re-used many times. Typically, this method will not be used.

The algorithm used is very simple:


isMonitoringEnabled

public boolean isMonitoringEnabled()
Specified by:
isMonitoringEnabled in interface ConfluenceMonitoringControl
Returns:
whether monitoring is enabled.

enableMonitoring

public void enableMonitoring()
Description copied from interface: ConfluenceMonitoringControl
Enables monitoring. It does not effect whether CPU timing is enabled.

Specified by:
enableMonitoring in interface ConfluenceMonitoringControl

disableMonitoring

public void disableMonitoring()
Description copied from interface: ConfluenceMonitoringControl
Disable monitoring. It does not effect whether CPU timing is enabled.

Specified by:
disableMonitoring in interface ConfluenceMonitoringControl

isCpuTimingEnabled

public boolean isCpuTimingEnabled()
Specified by:
isCpuTimingEnabled in interface ConfluenceMonitoringControl
Returns:
whether CPU timing is enabled.

enableCpuTiming

public void enableCpuTiming()
Description copied from interface: ConfluenceMonitoringControl
Enable capturing CPU timing. It does not effect whether monitoring is enabled.

Specified by:
enableCpuTiming in interface ConfluenceMonitoringControl

disableCpuTiming

public void disableCpuTiming()
Description copied from interface: ConfluenceMonitoringControl
Disable capturing CPU timing. It does not effect whether monitoring is enabled.

Specified by:
disableCpuTiming in interface ConfluenceMonitoringControl


Copyright © 2003-2014 Atlassian. All Rights Reserved.