Actually, i m a newbie in jbpm so please comment/criticize any wrong thing u think i m doing.
In order to work on processes with human tasks nodes and use persistance, i had the choice between creating a session for each process or to create a session for many processes in the same time.
i choosed the first solution as i can free the memory by disposing the session(with ksession.dipose()) before creating another one and reload it with the JPAKnowledgeService.loadStatefulKnowledgeSession(idsession,kbase, config, env); method when i need it again.
if i was working with the second solution, i create a session and i start processes with ksession.startProcess(..) but i don't know how to stop/pause those process instances in order to free memory ( i m working with jbpm 5.0.0) ..
Another problem happened is that processes in loaded session (in the first solution) seems being not actives (i coudn't get tasks from loaded sessions) and i think maybe becose the session was disposed .. (it was my topic for my previous asked question in here https://community.jboss.org/thread/221356?tstart=0
i also want to know if there is a way to get the persisted sessions list from database without implementing my own logic to do that , i think jbpm already have this logic.
To stop a process instance, you need to stop the included human tasks as well.
The session information is stored by jbpm in the table SESSIONINFO. You can load the session using JPAKnowledgeService.loadSess......... But creating a new session each time is not a costly process. So you can do that instead but keep the knowledge base alive.
But creating a new session each time is not a costly process. So you can do that instead but keep the knowledge base alive.