use of org.drools.kiesession.session.StatelessKnowledgeSessionImpl in project drools by kiegroup.
the class KieContainerImpl method newStatelessKieSession.
public StatelessKieSession newStatelessKieSession(String kSessionName, KieSessionConfiguration conf) {
KieSessionModelImpl kSessionModel = kSessionName != null ? (KieSessionModelImpl) getKieSessionModel(kSessionName) : (KieSessionModelImpl) findKieSessionModel(true);
if (kSessionModel == null) {
log.error("Unknown KieSession name: " + kSessionName);
return null;
}
if (kSessionModel.getType() == KieSessionModel.KieSessionType.STATEFUL) {
throw new RuntimeException("Trying to create a stateless KieSession from a stateful KieSessionModel: " + kSessionModel.getName());
}
KieBase kBase = getKieBase(kSessionModel.getKieBaseModel().getName());
if (kBase == null) {
log.error("Unknown KieBase name: " + kSessionModel.getKieBaseModel().getName());
return null;
}
StatelessKieSession statelessKieSession = kBase.newStatelessKieSession(conf != null ? conf : getKieSessionConfiguration(kSessionModel));
if (isJndiAvailable()) {
wireSessionComponents(kSessionModel, statelessKieSession);
}
registerLoggers(kSessionModel, statelessKieSession);
((StatelessKnowledgeSessionImpl) statelessKieSession).initMBeans(containerId, ((InternalKnowledgeBase) kBase).getId(), kSessionModel.getName());
statelessKSessions.put(kSessionModel.getName(), statelessKieSession);
return statelessKieSession;
}
Aggregations