Package de.hybris.platform.aop
Class AbstractProfilingAspect
java.lang.Object
de.hybris.platform.aop.AbstractProfilingAspect
- All Implemented Interfaces:
Profiler
- Direct Known Subclasses:
ProfilingAspect
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longcalculateExecutionTime(long startTime) protected org.springframework.jmx.export.assembler.MBeanInfoAssemblerprotected ObjectInstancegetOrCreateMBean(Object resource, String method) Creates or returns a MBean instance for the specified methodprotected ObjectInstancegetOrCreateResource(Class template, String profiledMethod) Wrapper method for getOrCreateMBean method.protected abstract Tenantprotected longgetTime()Returns the current time in the specified time unitsetAccuracy(String)voidlogException(ObjectInstance bean) This method will be used for incrementing an internal "failed execution counter"voidlogExecutionTime(ObjectInstance bean, long executionTime, long calledAt) Logs the execution time of the currently profiled methodvoidsetAccuracy(String accuracy) Setter of the time measure accuracy (use 'ns' for nano seconds , 'ms' for milliseconds [default])voidsetAspectNodeName(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 beanvoidSetter of the JMX domain.voidsetLimit(long limit) Sets the minimum method execution time.voidsetTemplate(Class<? extends ProfilingReportBean> template) Setter for theProfilingReportBeaninstance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.aop.Profiler
logExecutionTime
-
Field Details
-
template
-
domain
-
aspectNodeName
-
accuracy
-
limit
protected long limit
-
-
Constructor Details
-
AbstractProfilingAspect
public AbstractProfilingAspect()
-
-
Method Details
-
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
Setter for theProfilingReportBeaninstance.- Parameters:
template- the template
-
setAspectNodeName
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
Setter of the time measure accuracy (use 'ns' for nano seconds , 'ms' for milliseconds [default])- Parameters:
accuracy- the time unit
-
setDomain
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 ObjectInstance getOrCreateMBean(Object resource, String method) throws JMException, InvalidTargetObjectTypeException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException Creates or returns a MBean instance for the specified method- Parameters:
resource- an implementation ofProfilingReportBeanmethod- the profiled method- Returns:
- mbean instance
- Throws:
JMExceptionInvalidTargetObjectTypeExceptionInvocationTargetExceptionIllegalAccessExceptionInstantiationExceptionIllegalArgumentException
-
getOwnTenant
-
getOrCreateResource
protected ObjectInstance getOrCreateResource(Class template, String profiledMethod) throws InstantiationException, IllegalAccessException, IllegalArgumentException, JMException, InvalidTargetObjectTypeException, InvocationTargetException Wrapper 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:
JMExceptionInvalidTargetObjectTypeExceptionInvocationTargetExceptionIllegalAccessExceptionInstantiationExceptionIllegalArgumentException
-
logExecutionTime
public void logExecutionTime(ObjectInstance bean, long executionTime, long calledAt) throws JMException, InvalidTargetObjectTypeException Logs 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:
JMExceptionInvalidTargetObjectTypeException
-
logException
This 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:
JMExceptionInvalidTargetObjectTypeException
-