6 Replies Latest reply on Oct 15, 2009 4:56 PM by iecisa

    Problem inserting in JBPM_JOB

      Hi all,
      we are developing a system, using jbpm. This developemt is under aix, oracle 10g and glassfish 2.1. Connection pool is configured in glassfish using oracleXADatasource because we are using several schemas in the same transaction.
      We have developed workflows with tasks insert jobs in jbpm_job, however this insert using jbpm hibernate. if a task insert 2 jobs, the first one takes too much time (over 10 seconds) but the second one takes only 3 miliseconds. And the call method is the same for both, as you can see below:

      public void AlarmCreate(ExecutionContext executionContext,Date date,String className,String actionName,String timerName){
      Delegation delegation = new Delegation();
      delegation.setClassName(className);
      delegation.setProcessDefinition(executionContext.getProcessDefinition());
      Action moveAction = new Action();
      moveAction.setName(actionName);
      moveAction.setActionDelegation(delegation);
      executionContext.getProcessDefinition().addAction(moveAction);

      Timer timer = new Timer(executionContext.getToken());
      timer.setName(timerName+"_"+executionContext.getProcessInstance().getId());

      timer.setDueDate(date);
      timer.setGraphElement(executionContext.getEventSource());
      timer.setTaskInstance(executionContext.getTaskInstance());
      timer.setAction(moveAction);

      timer.setLockOwner(executionContext.getProcessDefinition().getName());
      DbSchedulerService schservice = new DbSchedulerService();
      schservice.createTimer(timer);
      }

      any help would be really appreciated.

      regards

        • 1. Re: Problem inserting in JBPM_JOB

          hi again,
          we've found that most of the 10 seconds is going in this block:

          Action moveAction = new Action();
          moveAction.setName(actionName);
          moveAction.setActionDelegation(delegation);
          executionContext.getProcessDefinition().addAction(moveAction);

          we know it has no sense, but is in this point

          • 2. Re: Problem inserting in JBPM_JOB
            kukeltje

            Please turn the loglevel up to see what is going on and post that here.

            • 3. Re: Problem inserting in JBPM_JOB

              well, actually, debugging, we found the problem is exactly here:

              actions.put(action.getName(), action);

              in class ProcessDefinition in the method: addAction(Action action)

              at the moment we fix it, replacing the line above by:

              if (! actions.containsKey(action.getName()))
              actions.put(action.getName(), action);

              we don't understand why is necesary to insert each time the action into the Map.

              • 4. Re: Problem inserting in JBPM_JOB

                Also we don't understand why doing a put method it takes 10 seconds.

                • 5. Re: Problem inserting in JBPM_JOB
                  kukeltje

                  we do not get that either.... if you debug further and see what happens we both can learn from it I think.

                  • 6. Re: Problem inserting in JBPM_JOB

                    Well, first we saw is that actions Map contains the actions that are defined in the workflow, and taking into account that actions are always the same class isn't necessary to put(mapping) the action each time. So we put the code line:

                    if (! actions.containsKey(action.getName()))

                    Why put instruction takes 10 second, we still don't undestand, but we think is an Hibernate issue.