--- /dev/null
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclarePrecedence;
+
+@Aspect
+@DeclarePrecedence("MarkerAAspect, MarkerBAspect")
+public class MarkerAAspect {
+ public static int proceedTimes = 1;
+
+ @Around("@annotation(MarkerA) && execution(* *(..))")
+ public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable {
+ System.out.println(">> Outer intercept");
+ Object result = null;
+ for (int i = 0; i < proceedTimes; i++) {
+ System.out.println(" >> Outer proceed");
+ result = thisJoinPoint.proceed();
+ System.out.println(" << Outer proceed");
+ }
+ System.out.println("<< Outer intercept");
+ return result;
+ }
+}
--- /dev/null
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public class MarkerBAspect {
+ public static int proceedTimes = 1;
+
+ @Around("@annotation(MarkerB) && execution(* *(..))")
+ public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable {
+ System.out.println(" >> Inner intercept");
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ for (int i = 0; i < proceedTimes; i++) {
+ System.out.println(" >> Inner proceed");
+ thisJoinPoint.proceed();
+ System.out.println(" << Inner proceed");
+ }
+ }
+ catch (Throwable throwable) {
+ throwable.printStackTrace(System.out);
+ }
+ }
+ }).start();
+ System.out.println(" << Inner intercept");
+ return null;
+ }
+}
</run>
</ajc-test>
+ <ajc-test dir="bugs198/github_128" title="asynchronous proceed for nested around-advice chain">
+ <compile files="Application.java MarkerA.java MarkerAAspect.aj MarkerB.java MarkerBAspect.aj" options="-1.8" />
+ <run class="Application" options="1,1">
+ <stdout ordered="no">
+ <line text=">> Outer intercept"/>
+ <line text=" >> Outer proceed"/>
+ <line text=" >> Inner intercept"/>
+ <line text=" << Inner intercept"/>
+ <line text=" << Outer proceed"/>
+ <line text="<< Outer intercept"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ </stdout>
+ </run>
+ <run class="Application" options="2,1">
+ <stdout ordered="no">
+ <line text=">> Outer intercept"/>
+ <line text=" >> Outer proceed"/>
+ <line text=" >> Inner intercept"/>
+ <line text=" << Inner intercept"/>
+ <line text=" << Outer proceed"/>
+ <line text=" >> Outer proceed"/>
+ <line text=" >> Inner intercept"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text=" << Inner intercept"/>
+ <line text=" << Outer proceed"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text="<< Outer intercept"/>
+ </stdout>
+ </run>
+ <run class="Application" options="1,2">
+ <stdout ordered="no">
+ <line text=">> Outer intercept"/>
+ <line text=" >> Outer proceed"/>
+ <line text=" >> Inner intercept"/>
+ <line text=" << Inner intercept"/>
+ <line text=" << Outer proceed"/>
+ <line text="<< Outer intercept"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ </stdout>
+ </run>
+ <run class="Application" options="2,2">
+ <stdout ordered="no">
+ <line text=">> Outer intercept"/>
+ <line text=" >> Outer proceed"/>
+ <line text=" >> Inner intercept"/>
+ <line text=" << Inner intercept"/>
+ <line text=" << Outer proceed"/>
+ <line text=" >> Outer proceed"/>
+ <line text=" >> Inner intercept"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" << Inner intercept"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text=" << Outer proceed"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text=" >> Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text=" Doing something"/>
+ <line text=" << Inner proceed"/>
+ <line text="<< Outer intercept"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite>