title: AspectJ and calling another method in @AfterReturning method
body: <p>I'm starting to learn how to use AspectJ in Spring. I have the following class. I want to perform first method in new thread (long running task), so I thought this might be achieved using Aspect - when firstMethod is called, Aspect automatically delegate this calling into new Thread. After firstMethod is finished, secondMethod should be called with returned by firstMethod value as an argument.</p>
  
  <pre><code>public class SimpleClass{
      public Object firstMethod(){
          //some operations
          return object;
      }
      public void secondMethod(Object returnedObjectByFirstMethod){
      }
  }
  
  @Aspect
  public class SimpleAspect {
  
     @Around("execution(* SimpleClass.firstMethod(..))")
     public void doInNewThread(final ProceedingJoinPoint joinPoint) throws Throwable {
         Thread t = new Thread(new Runnable() {
             public void run() { 
                 joinPoint.proceed();
             }
         });
         t.start();
     }
  
     @AfterReturning(
        pointcut = "execution(* SimpleClass.firstMethod(..))",
        returning= "result")
     public void doAfter(JoinPoint joinPoint, Object result) {
         SimpleClass.secondMethod(result);
     }
  }
  </code></pre>
  
  <p>This is kind of prototype, I haven't implemeneted it yet, I'm pretty sure it cannot work that way, but I want to make sure about two trivial things:</p>
  
  <ol>
  <li><p>How can I call secondMethod() in doAfter(), if this method would not be static? Do I need kind of an instance of SimpleClass is SimpleAspect? How to supply such instance?</p></li>
  <li><p>Nearly the same as first question, but what if secondMethod() would not be in the same class as firstMethod()?</p></li>
  </ol>