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 Thread t = 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.toString());
27 }
28 }
29 }
30 );
31
32
33
34 t.setPriority(Thread.MAX_PRIORITY);
35 t.start();
36 return null;
37 }
38
39 public Object advice2(final JoinPoint jp) throws Throwable {
40 ProceedTest.LOG += "advice2Pre ";
41 jp.proceed();
42 ProceedTest.LOG += "advice2Post ";
43 return null;
44 }
45
46 public Object advice3(final JoinPoint jp) throws Throwable {
47 ProceedTest.LOG += "advice3Pre ";
48 jp.proceed();
49 ProceedTest.LOG += "advice3Post ";
50 return null;
51 }
52 }