Package de.hybris.platform.aop
Class AbstractProfilingAspect
- java.lang.Object
-
- de.hybris.platform.aop.AbstractProfilingAspect
-
- All Implemented Interfaces:
Profiler
- Direct Known Subclasses:
ProfilingAspect
public abstract class AbstractProfilingAspect extends java.lang.Object implements Profiler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractProfilingAspect.Accuracy
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Enumaccuracyprotected java.lang.StringaspectNodeNameprotected java.lang.Stringdomainprotected longlimitprotected java.lang.Class<?>template
-
Constructor Summary
Constructors Constructor Description AbstractProfilingAspect()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected longcalculateExecutionTime(long startTime)protected org.springframework.jmx.export.assembler.MBeanInfoAssemblergetAssembler()protected javax.management.ObjectInstancegetOrCreateMBean(java.lang.Object resource, java.lang.String method)Creates or returns a MBean instance for the specified methodprotected javax.management.ObjectInstancegetOrCreateResource(java.lang.Class template, java.lang.String profiledMethod)Wrapper method for getOrCreateMBean method.protected abstract TenantgetOwnTenant()protected longgetTime()Returns the current time in the specified time unitsetAccuracy(String)voidlogException(javax.management.ObjectInstance bean)This method will be used for incrementing an internal "failed execution counter"voidlogExecutionTime(javax.management.ObjectInstance bean, long executionTime, long calledAt)Logs the execution time of the currently profiled methodvoidsetAccuracy(java.lang.String accuracy)Setter of the time measure accuracy (use 'ns' for nano seconds , 'ms' for milliseconds [default])voidsetAspectNodeName(java.lang.String aspectNodeName)Setter of the JMX node name (this node will appear below 'hybris/{Tenant ID}')voidsetAssembler(org.springframework.jmx.export.assembler.MBeanInfoAssembler assembler)assembler for gathering required MBeanInfo object for a beanvoidsetDomain(java.lang.String domain)Setter of the JMX domain.voidsetLimit(long limit)Sets the minimum method execution time.voidsetTemplate(java.lang.Class<? extends ProfilingReportBean> template)Setter for theProfilingReportBeaninstance.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.aop.Profiler
logExecutionTime
-
-
-
-
Method Detail
-
getAssembler
protected org.springframework.jmx.export.assembler.MBeanInfoAssembler getAssembler()
-
setAssembler
public void setAssembler(org.springframework.jmx.export.assembler.MBeanInfoAssembler assembler)
assembler for gathering required MBeanInfo object for a bean
-
setTemplate
public void setTemplate(java.lang.Class<? extends ProfilingReportBean> template)
Setter for theProfilingReportBeaninstance.- Parameters:
template- the template
-
setAspectNodeName
public void setAspectNodeName(java.lang.String aspectNodeName)
Setter of the JMX node name (this node will appear below 'hybris/{Tenant ID}')- Parameters:
aspectNodeName- the JMX node name (default is the class name of the aspect)
-
setAccuracy
public void setAccuracy(java.lang.String accuracy)
Setter of the time measure accuracy (use 'ns' for nano seconds , 'ms' for milliseconds [default])- Parameters:
accuracy- the time unit
-
setDomain
public void setDomain(java.lang.String domain)
Setter of the JMX domain. Default isJmxUtils.DEFAULT_JMX_DOMAIN
-
setLimit
public void setLimit(long limit)
Sets the minimum method execution time. If the execution time of the currently analyzed method is lesser than that value, the method will be ignored.
-
getTime
protected long getTime()
Returns the current time in the specified time unitsetAccuracy(String)- Returns:
- current time
-
calculateExecutionTime
protected long calculateExecutionTime(long startTime)
-
getOrCreateMBean
protected javax.management.ObjectInstance getOrCreateMBean(java.lang.Object resource, java.lang.String method) throws javax.management.JMException, javax.management.modelmbean.InvalidTargetObjectTypeException, java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetExceptionCreates or returns a MBean instance for the specified method- Parameters:
resource- an implementation ofProfilingReportBeanmethod- the profiled method- Returns:
- mbean instance
- Throws:
javax.management.JMExceptionjavax.management.modelmbean.InvalidTargetObjectTypeExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionjava.lang.IllegalArgumentException
-
getOwnTenant
protected abstract Tenant getOwnTenant()
-
getOrCreateResource
protected javax.management.ObjectInstance getOrCreateResource(java.lang.Class template, java.lang.String profiledMethod) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, javax.management.JMException, javax.management.modelmbean.InvalidTargetObjectTypeException, java.lang.reflect.InvocationTargetExceptionWrapper method for getOrCreateMBean method. Checks if given template instance exists in cache and calls getOrCreateMBean with template instance as a parameter.- Parameters:
template- an implementation ofProfilingReportBeanprofiledMethod- the profiled method- Returns:
- mbean instance
- Throws:
javax.management.JMExceptionjavax.management.modelmbean.InvalidTargetObjectTypeExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionjava.lang.IllegalArgumentException
-
logExecutionTime
public void logExecutionTime(javax.management.ObjectInstance bean, long executionTime, long calledAt) throws javax.management.JMException, javax.management.modelmbean.InvalidTargetObjectTypeExceptionLogs the execution time of the currently profiled method- Parameters:
bean- the used bean for "displaying" the profiled data via JMXexecutionTime- the execution timecalledAt- the start time- Throws:
javax.management.JMExceptionjavax.management.modelmbean.InvalidTargetObjectTypeException
-
logException
public void logException(javax.management.ObjectInstance bean) throws javax.management.JMException, javax.management.modelmbean.InvalidTargetObjectTypeExceptionThis method will be used for incrementing an internal "failed execution counter"- Parameters:
bean- the JMX bean which will be notified about the notified execution of its corresponding method- Throws:
javax.management.JMExceptionjavax.management.modelmbean.InvalidTargetObjectTypeException
-
-