Quoting Pardeep.Ruhil(a)lntinfotech.com:
When we are reloading the StatefulKnowledgeSession from the database
using the below line
StatefulKnowledgeSession loadSession= JPAKnowledgeService.
loadStatefulKnowledgeSession(id, kbase, null, env);
This session object is different from the one that is created when we
first created StatefulknowledgeSession object using
StatefulKnowledgeSession initialSession= JPAKnowledgeService.
newStatefulKnowledgeSession(kbase, null, env);
Yes, you are restoring your session from the database. Of course this
isn't the exact same object (set of objects really), but a copy that
resembles exactly the same state. Note that you shouldn't have multiple
instances of the same session active, you usually only do this if the
previous session has crashed or if you have disposed that one.
Now In my case I have a HumanWorkItemHandler class for handling the
humantask and there is ActionWorkITemHandler for my customAction
workItem, which both are initailsed with the initialSession object.
Now when I load the session from the database to complete the
HumanWorkItemHandler task I got a different session object i.e.
loadSession.
You should re-register your work item handlers when recreating the
session (they are not stored as part of the runtime state). If your
work item handler needs a reference to the session, you should pass this
when initializing your work item handler.
Kris
Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm