Message-ID: <236975563.687.1369187529885.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_686_1491126979.1369187529884" ------=_Part_686_1491126979.1369187529884 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The purpose of this aspect is to report arbitrary method execution respo=
nse time to a JMX server.
It is easily configurable to gather the metrics on a per class, package, ap= plication, etc basis and thus report averages metrics as well.
This aspect has been demonstrated during JavaOne 2004 in the "AOP i=
n J2EE environments with AspectWerkz" session.
Download the Java= One 2004 slides.
In order to be able to use this aspect, you need to declare it in your <= strong>META-INF/aop.xml file and bind the advice named &qu= ot;monitor" of type "around" to an= y method execution pointcuts (actually it can work for any pointcut type if= you want to).
One JMX mbean will be created per target method/constructor/field signat= ure by default. See the next section for more configuration about the aspec= t parameter "granularity".
The mbeans will be registered lazyly in the default (local) JMX= server. For use with BEA WebLogic Server 6, 7 and 8 and for other schemes,= see the next section about the aspect parameter "mbeanServer&= quot;.
Here is a sample META-INF/aop.xml file:
To change the granularity of the reported metrics, which defaults to one mbean per target method/constructor/field signature you need to u= se the aspect parameter "granularity".<= /p>
This parameter will specify a class that implements the org.codehaus= .aware.jmx.ResponseTimeAspect.IGranularity interface below:
AWare provides an implementation which is able to compute a global avera= ge. Here is how it has been written. You can refer to AspectWerkz documenta= tion about the org.codehaus.aspectwerkz.joinpoint.Signature interf= ace to write your own:
This class is provided in AWare as org.codehaus.aware.jmx.ResponseTimeAs= pect.AverageGranularity. Since it is a static inner class, we will have to = use it under the name "org.codehaus.aware.jmx.ResponseTimeAspect$Avera= geGranularity" (with a $ sign) :
To use your custom granularity the META-INF/aop.xml file will l= ook like the following. Note that we are using the ResponseTimeAspect twice= , once with default granularity and once with average granularity, and thus= we specify an aspect "name".
The default AWare implementation is using the default JMX API to retriev= e the local JMX server and register the mbeans:
This might not be convenient in your environment. For example in BEA Web= Logic, you have several JMX server available when you are running in a clus= ter or in a managed server environment.
AWare allows you to use the mbean server you like.
For such use the aspect parameter "mbeanServer" = and specify a class that implements the org.codehaus.aware.jmx.JMXHelpe= r.IMBeanServerDriver interface:
AWare provides a BEA Weblogic implementation of it thru org.code= haus.aware.jmx.JMXHelper.WebLogicMBeanServerDriver.
To use it, the META-INF/aop.xml will looks like:------=_Part_686_1491126979.1369187529884--