5 Replies Latest reply on May 15, 2007 4:18 AM by Ronald van Kuijk

    Blocked signal call

    Danny Shaul Newbie

      Hi
      I wrote a simple flow that use web events as trigger to continue the flow.

      I use the following code to start the flow:

      public Long startFlow(long id,String problem, long sid) {
      
       Long processDefId = null;
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       try {
      
       GraphSession graphSession = jbpmContext.getGraphSession();
      
       ProcessDefinition processDefinition =
       graphSession.findLatestProcessDefinition("start");
      
       ProcessInstance processInstance =
       new ProcessInstance(processDefinition);
      
       ContextInstance contextInstance = processInstance.getContextInstance();
       contextInstance.setVariable("id", id);
       contextInstance.setVariable("problem", problem);
       contextInstance.setVariable("sid" , sid);
       contextInstance.setVariable("processDefId" , processDefinition.getId());
      
       Token token = processInstance.getRootToken();
      
       token.signal();
       jbpmContext.save(processInstance);
      
       } finally {
       return processDefId;
       }
       }
      


      And I also wrote second method which continue to other states in the flow.
      As I understand each call to signal() moves one step in the flow in non-blocking mode,
      Is it possible that the token.signal() will be blocked until the ActionHandler defined for that state ended?
      I want to response the caller of that method (startFlow) with variable returned in the ContextVariable of the ActionHandler, is it possible?