[jboss-user] [JBoss AOP] - Re: Accessing call stack from invocation object

flavia.rainone@jboss.com do-not-reply at jboss.com
Mon Oct 20 16:29:24 EDT 2008


Unfortunately, no. However, the code should be pretty simple, something along the lines:

public class MyAspect
  | {
  |    ThreadLocal<Collection<yourstuff> previousInvocations = new ThreadLocal()
  |    {
  |        public Collection<yourstuff> initialValue()
  |        {
  |             return new ArrayList<yourstuff>();
  |         }
  |     };
  | 
  |    public Object advice(Invocation invocation)
  |    {
  |          Collection<yourstuff> previousThreadInvocations = previousInvocations.get();
  |          // put the stack stuff that you need in the collection
  |          previousThreadInvocations.add(invocation...);
  |          return invocation.invokeNext();
  |     }
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4183346#4183346

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4183346



More information about the jboss-user mailing list