/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.aop.joinpoint;

import org.jboss.aop.util.ThreadLocalStack;

/**
 * This class should only be used from within a typed advice!
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.1.8.2 $
 */
public class CurrentInvocation
{
   private static ThreadLocalStack stack = new ThreadLocalStack();

   public static void push(Invocation invocation)
   {
      stack.push(invocation);
   }

   public static void pop()
   {
      stack.pop();
   }

   public static Invocation get()
   {
      return (Invocation) stack.get();
   }

   public static Object proceed() throws Throwable
   {
      return get().invokeNext();
   }
}
