Message-ID: <1325418038.92057.1397855665304.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_92056_1742393790.1397855665303" ------=_Part_92056_1742393790.1397855665303 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 met= rics on a per class, package, application, etc basis and thus report averag= es metrics as well.
This aspect has been demonstrated during JavaOne 2004 in the "AOP i=
n J2EE environments with AspectWerkz" session.
Download the JavaOne 2004 slides= a>.
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).=20
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".=20
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;.=20
Here is a sample META-INF/aop.xml file:=20 =20
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>=20
This parameter will specify a class that implements the org.codehaus= .aware.jmx.ResponseTimeAspect.IGranularity interface below:=20 =20
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:=20 =20
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) :=20
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".=20 =20
The default AWare implementation is using the default JMX API to retriev= e the local JMX server and register the mbeans:=20 =20
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.=20
AWare allows you to use the mbean server you like.
For such use th= e aspect parameter "mbeanServer" and specify a c= lass that implements the org.codehaus.aware.jmx.JMXHelper.IMBeanServerD= river interface:
AWare provides a BEA Weblogic implementation of it thru org.code= haus.aware.jmx.JMXHelper.WebLogicMBeanServerDriver.=20
To use it, the META-INF/aop.xml will looks like:=20