[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...

Gavin King gavin.king at jboss.com
Thu Dec 14 05:27:00 EST 2006


  User: gavin   
  Date: 06/12/14 05:27:00

  Modified:    src/main/org/jboss/seam/interceptors  
                        AsynchronousInterceptor.java
  Added:       src/main/org/jboss/seam/interceptors  
                        MethodContextInterceptor.java
  Log:
  introduce METHOD context, and solve   JBSEAM-564
  
  Revision  Changes    Path
  1.8       +1 -1      jboss-seam/src/main/org/jboss/seam/interceptors/AsynchronousInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AsynchronousInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/AsynchronousInterceptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- AsynchronousInterceptor.java	1 Nov 2006 02:54:02 -0000	1.7
  +++ AsynchronousInterceptor.java	14 Dec 2006 10:27:00 -0000	1.8
  @@ -26,7 +26,7 @@
            {
               throw new IllegalStateException("Dispatcher is not installed in components.xml");
            }
  -         Timer timer = dispatcher.scheduleInvocation(invocation, getComponent());
  +         Timer timer = dispatcher.scheduleInvocation( invocation, getComponent() );
            //if the method returns a Timer, return it to the client
            return invocation.getMethod().getReturnType().equals(Timer.class) ? timer : null;
         }
  
  
  
  1.1      date: 2006/12/14 10:27:00;  author: gavin;  state: Exp;jboss-seam/src/main/org/jboss/seam/interceptors/MethodContextInterceptor.java
  
  Index: MethodContextInterceptor.java
  ===================================================================
  package org.jboss.seam.interceptors;
  
  import org.jboss.seam.annotations.AroundInvoke;
  import org.jboss.seam.annotations.Interceptor;
  import org.jboss.seam.contexts.Context;
  import org.jboss.seam.contexts.Contexts;
  import org.jboss.seam.contexts.Lifecycle;
  import org.jboss.seam.intercept.InvocationContext;
  
  /**
   * Unproxies the SFSB for the length of the call.
   * 
   * @author Gavin King
   *
   */
  @Interceptor(stateless=true, around={BijectionInterceptor.class, EventInterceptor.class, SecurityInterceptor.class})
  public class MethodContextInterceptor extends AbstractInterceptor
  {
     @AroundInvoke
     public Object aroundInvoke(InvocationContext ctx) throws Exception
     {
        String name = getComponent().getName();
        Context outerMethodContext = Lifecycle.beginMethod();
        try
        {
           Contexts.getMethodContext().set( name, ctx.getTarget() );
           return ctx.proceed();
        }
        finally
        {
           Lifecycle.endMethod(outerMethodContext);
        }
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list