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

Gavin King gavin.king at jboss.com
Mon Oct 9 22:08:45 EDT 2006


  User: gavin   
  Date: 06/10/09 22:08:45

  Modified:    src/main/org/jboss/seam/core  Dispatcher.java
  Log:
  propagate the business process context in async calls
  make the timer available for injections
  
  Revision  Changes    Path
  1.2       +21 -2     jboss-seam/src/main/org/jboss/seam/core/Dispatcher.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Dispatcher.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Dispatcher.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- Dispatcher.java	9 Oct 2006 08:30:28 -0000	1.1
  +++ Dispatcher.java	10 Oct 2006 02:08:45 -0000	1.2
  @@ -41,10 +41,14 @@
      
      static class AsynchronousInvocation implements Serializable
      {
  +      static final long serialVersionUID = 7426196491669891310L;
  +      
         private String methodName;
         private Class[] argTypes;
         private Object[] args;
         private String componentName;
  +      private Long processId;
  +      private Long taskId;
         
         public AsynchronousInvocation(Method method, String componentName, Object[] args)
         {
  @@ -52,9 +56,14 @@
            this.argTypes = method.getParameterTypes();
            this.args = args==null ? new Object[0] : args;
            this.componentName = componentName;
  +         if ( Init.instance().isJbpmInstalled() )
  +         {
  +            processId = BusinessProcess.instance().getProcessId();
  +            taskId = BusinessProcess.instance().getTaskId();
  +         }
         }
         
  -      public void execute()
  +      public void execute(Timer timer)
         {
            
            //TODO: shouldn't this take place in a Seam context anyway??!? (bug in EJB3?)
  @@ -63,6 +72,16 @@
            Contexts.getEventContext().set(EXECUTING_ASYNCHRONOUS_CALL, true);
            try
            {
  +            if (taskId!=null)
  +            {
  +               BusinessProcess.instance().initTask(taskId);
  +            }
  +            else if (processId!=null)
  +            {
  +               BusinessProcess.instance().initProcess(processId);
  +            }
  +            
  +            Contexts.getEventContext().set("timer", timer);
            
               Object target = Component.getInstance(componentName);
               
  @@ -91,7 +110,7 @@
      @Timeout
      public void dispatch(Timer timer)
      {
  -      ( (AsynchronousInvocation) timer.getInfo() ).execute();
  +      ( (AsynchronousInvocation) timer.getInfo() ).execute(timer);
      }
      
      public Timer schedule(InvocationContext invocation, Component component)
  
  
  



More information about the jboss-cvs-commits mailing list