1 /***************************************************************************************
2 * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3 * http://aspectwerkz.codehaus.org *
4 * ---------------------------------------------------------------------------------- *
5 * The software in this package is published under the terms of the LGPL license *
6 * a copy of which has been included with this distribution in the license.txt file. *
7 **************************************************************************************/
8 package test.proceedinnewthread;
9
10 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
11
12 /***
13 * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
14 */
15 public class TestAspect {
16
17 public Object advice1(final JoinPoint jp) throws Throwable {
18 new Thread(
19 new Runnable() {
20 public void run() {
21 try {
22 ProceedTest.LOG += "advice1Pre ";
23 jp.proceed();
24 ProceedTest.LOG += "advice1Post ";
25 } catch (Throwable e) {
26 throw new RuntimeException(e);
27 }
28 }
29 }
30 ).start();
31 return null;
32 }
33
34 public Object advice2(final JoinPoint jp) throws Throwable {
35 ProceedTest.LOG += "advice2Pre ";
36 jp.proceed();
37 ProceedTest.LOG += "advice2Post ";
38 return null;
39 }
40
41 public Object advice3(final JoinPoint jp) throws Throwable {
42 ProceedTest.LOG += "advice3Pre ";
43 jp.proceed();
44 ProceedTest.LOG += "advice3Post ";
45 return null;
46 }
47 }