Collection<StatefulKnowledgeSession> c = new ArrayList<StatefulKnowledgeSession>();
StatefulSession[] sss = this.ruleBase.getStatefulSessions();
if (sss != null) {
for (StatefulSession ss : sss) {
if (ss instanceof AbstractWorkingMemory) {
InternalKnowledgeRuntime kruntime = ((AbstractWorkingMemory) ss).getKnowledgeRuntime();
if( kruntime instanceof StatefulKnowledgeSession ) {
c.add((StatefulKnowledgeSessionImpl) kruntime);
}
}
}