I just debugged the application and I see the difference between the first and the second one.
I start my application like this:
pi = ksession.startProcess("com.sintecmedia.MediaAcquiring", parameters);
int i=5; //just for debugging.
The workflow executes the processes, reaches the first human task and since it has to wait for completing "it finishes the execusion" and continues to the next line. (int i=5;)
In the second one, I just call the human task to complete like this:
BlockingTaskOperationResponseHandler blockingTaskOperationResponseHandler = new BlockingTaskOperationResponseHandler();
taskClient.complete(taskId, nickName, null, blockingTaskOperationResponseHandler);
and I see that the task is not being saved after
client.addTask(task, content, null)) in the humantaskhandler, but later on in the process in one of the classes that implement PollingIoProcessor of Mina.
How can make it that it will all be executed after client.addTask(task, content, null))?
I don't handle the transactions myself since I understood that CommandBasedWSHumanTaskHandler handles it.