kSession = kieObjectsResolver.resolveKSession(name, releaseId);
if (kSession instanceof StatelessKieSession) {
helper = new StatelessKSessionFactoryBeanHelper(this, (StatelessKieSession) kSession);
} else if (kSession instanceof KieSession) {
helper = new StatefulKSessionFactoryBeanHelper(this, (KieSession) kSession);
}
helper.internalAfterPropertiesSet();
// get ksession from helper as it might change the ksession when persistence is configured
kSession = helper.internalGetObject();
attachLoggers((KieRuntimeEventManager) kSession);
attachListeners((KieRuntimeEventManager) kSession);
} else {
if ("stateless".equalsIgnoreCase(type)) {
helper = new StatelessKSessionFactoryBeanHelper(this, null);
} else {
helper = new StatefulKSessionFactoryBeanHelper(this, null);
}
}
}