diff options
author | ramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-21 12:33:11 +0000 |
---|---|---|
committer | ramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-21 12:33:11 +0000 |
commit | 43761be4a8284ff4361d320066d0acb313fa0eed (patch) | |
tree | 187f246ccfdbaaa5c286259c3e9f57040059bb87 /sca-java-2.x/trunk | |
parent | c68a459bbfe86865bd68bc9e55187d7646cf42d2 (diff) |
Added UserTimingAspect class to make the timing aspect work
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901680 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
6 files changed, 29 insertions, 16 deletions
diff --git a/sca-java-2.x/trunk/modules/tracing-aspectj/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/tracing-aspectj/META-INF/MANIFEST.MF index c812e3580d..1e066b9a43 100644 --- a/sca-java-2.x/trunk/modules/tracing-aspectj/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/modules/tracing-aspectj/META-INF/MANIFEST.MF @@ -6,8 +6,8 @@ Bundle-Version: 2.0 Bundle-ManifestVersion: 2
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: Apache Tuscany SCA AOP-based Logging and Tracing
-Import-Package: org.aspectj.lang;version="1.6.2",
- org.aspectj.lang.annotation;version="1.6.2"
+Import-Package: org.aspectj.lang.*;version="1.6.2",
+ org.aspectj.lang.annotation.*;version="1.6.2"
Bundle-SymbolicName: org.apache.tuscany.sca.aspectj
Bundle-DocURL: http://www.apache.org/
Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
diff --git a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java index 630bcb285b..2836e90e19 100644 --- a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java +++ b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java @@ -22,11 +22,8 @@ package org.apache.tuscany.sca.aspectj; import java.util.Arrays; import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterThrowing; -import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; diff --git a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java index 965cfa5b5d..83a06a771e 100644 --- a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java +++ b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java @@ -19,8 +19,6 @@ package org.apache.tuscany.sca.aspectj; -import java.util.Arrays; - import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; diff --git a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java index 262742e867..8bde1d4f91 100644 --- a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java +++ b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java @@ -19,16 +19,9 @@ package org.apache.tuscany.sca.aspectj; -import java.util.Arrays; - -import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.After; -import org.aspectj.lang.annotation.AfterReturning; -import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; /** diff --git a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/UserTimingAspect.java b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/UserTimingAspect.java new file mode 100644 index 0000000000..6bad09093d --- /dev/null +++ b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/UserTimingAspect.java @@ -0,0 +1,26 @@ +package org.apache.tuscany.sca.aspectj; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +public class UserTimingAspect { + @Pointcut + public void timedCall() { + + } + + @Around("timedCall()") + public Object timedSection(ProceedingJoinPoint jp) throws Throwable { + System.out.println("Timing Around timedSection jp=" + jp); + long start = System.currentTimeMillis(); + try { + return jp.proceed(); + } finally { + long end = System.currentTimeMillis(); + System.out.println("Timing Around timedSection Roundtrip is " + (end - start) + "ms for jp.getSignature=" + jp.getSignature()); + } + } +} diff --git a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml index c5b623d27f..8bbbf52121 100644 --- a/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml +++ b/sca-java-2.x/trunk/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml @@ -28,8 +28,7 @@ <!-- the TimingAspect. Which ever calls you define in this pointcut --> <!-- will be timed and displayed in the logs. --> <concrete-aspect name="org.apache.tuscany.sca.aspectj.UserTimingAspect" - extends="org.apache.tuscany.sca.aspectj.TimingAspect" - precedence="org.apache.tuscany.sca.aspectj.UserTimingAspect, *"> + extends="org.apache.tuscany.sca.aspectj.TimingAspect"> <pointcut name="timedCall" expression="call(* java.util.logging.Logger.info(..))"/> </concrete-aspect> |