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

Peter Muir peter at bleepbleep.org.uk
Wed Sep 26 13:31:01 EDT 2007


  User: pmuir   
  Date: 07/09/26 13:31:01

  Modified:    src/main/org/jboss/seam/async  AsynchronousInterceptor.java
  Log:
  JBSEAM-1918
  
  Revision  Changes    Path
  1.2       +23 -2     jboss-seam/src/main/org/jboss/seam/async/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/async/AsynchronousInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- AsynchronousInterceptor.java	25 Jun 2007 23:59:30 -0000	1.1
  +++ AsynchronousInterceptor.java	26 Sep 2007 17:31:01 -0000	1.2
  @@ -21,11 +21,13 @@
   {
      private static final long serialVersionUID = 9194177339867853303L;
      
  +   private static final String REENTRANT = "org.jboss.seam.async.AsynchronousIntercepter.REENTRANT";
  +   
      @AroundInvoke
      public Object aroundInvoke(InvocationContext invocation) throws Exception
      {
         boolean scheduleAsync = invocation.getMethod().isAnnotationPresent(Asynchronous.class) && 
  -            !Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL);
  +            (!isExecutingAsynchronousCall() || Contexts.getEventContext().isSet(REENTRANT));
         if (scheduleAsync)
         {
            Dispatcher dispatcher = AbstractDispatcher.instance();
  @@ -39,7 +41,26 @@
         }
         else
         {
  +         if (isExecutingAsynchronousCall())
  +         {
  +            Contexts.getEventContext().set(REENTRANT, true);
  +         }
  +         try
  +         {
            return invocation.proceed();
         }
  +         finally
  +         {
  +             if (isExecutingAsynchronousCall())
  +             {
  +                 Contexts.getEventContext().remove(REENTRANT);
  +             }
  +         }
  +      }
  +   }
  +   
  +   private boolean isExecutingAsynchronousCall()
  +   {
  +       return Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL);
      }
   }
  
  
  



More information about the jboss-cvs-commits mailing list