4 Replies Latest reply on Jan 27, 2012 9:02 AM by gardellajp

    Mina Human Task Server and close connections - don't refresh the session

    gardellajp Newbie

      Hi folks,


      I have a problem and I don't found a good solution to this. The problem is that I complete a task and the session didn't refresh becouse the handler and the session is dispose. See the next code:


      << CODE>>>

      TaskClient client = obtainATaskClient();



      Task task = handler.getTask();


      //obtain the session

      int sessionId = task.getTaskData().getProcessSessionId();

      StatefulKnowledgeSession session = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId,knowledgeBase, null, envoriment);

      CommandBasedWSHumanTaskHandler handler = new CommandBasedWSHumanTaskHandler(session);

      session.getWorkItemManager().registerWorkItemHandler("Human Task",handler);



      //complete the task

      client.complete(taskId, userId, outputData, responseHandler);


      isDone = responseHandler.waitTillDone(time);


      // -- Close resources --




      <<< END CODE >>>>


      I can fix with if I put this line after the comment // -- Close resources --:




      When I put this, Mina server communicate with the handler and refresh the session. Is a very poor workaround.


      I try cache the session and close after some time, but if I use this approach have problems that said WorkItemInfo doesn't exists, becouse the handler delete complete human task.


      So my question is:


      How can I close the session only after the handler refresh it?