diff options
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> |