[jboss-user] [JBoss Seam] - Re: Call scheduled method from another scheduled method

motte79 do-not-reply at jboss.com
Mon Sep 24 11:12:44 EDT 2007


Hmmmm ..... 

There is a condition in the AsynchronousInterceptor which prevents @Asynchronous calls to be made from @Asynchronous methods ... 

Why ?
!Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL)


  | @AroundInvoke
  |    public Object aroundInvoke(InvocationContext invocation) throws Exception
  |    {
  |       boolean scheduleAsync = invocation.getMethod().isAnnotationPresent(Asynchronous.class) && 
  |             !Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL);
  |       if (scheduleAsync)
  |       {
  |          Dispatcher dispatcher = AbstractDispatcher.instance();
  |          if (dispatcher==null)
  |          {
  |             throw new IllegalStateException("org.jboss.seam.async.dispatcher is not installed in components.xml");
  |          }
  |          Object timer = dispatcher.scheduleInvocation( invocation, getComponent() );
  |          //if the method returns a Timer, return it to the client
  |          return timer!=null && invocation.getMethod().getReturnType().isAssignableFrom( timer.getClass() ) ? timer : null;
  |       }
  |       else
  |       {
  |          return invocation.proceed();
  |       }
  |    }
  | 

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

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



More information about the jboss-user mailing list