statelessSession.getRuleBase().addEventListener( this );
} else if (session instanceof CommandBasedStatefulKnowledgeSession) {
StatefulKnowledgeSessionImpl statefulSession =
((StatefulKnowledgeSessionImpl)((KnowledgeCommandContext)((CommandBasedStatefulKnowledgeSession) session).getCommandService().getContext()).getKieSession());
isPhreak = ((ReteooRuleBase)statefulSession.getRuleBase()).getConfig().isPhreakEnabled();
ReteooWorkingMemoryInterface eventManager = statefulSession.session;
eventManager.addEventListener( (WorkingMemoryEventListener) this );
eventManager.addEventListener( (AgendaEventListener) this );
InternalProcessRuntime processRuntime = eventManager.getProcessRuntime();
eventManager.addEventListener( (RuleBaseEventListener) this );
if (processRuntime != null) {
processRuntime.addEventListener( this );
}
} else {
throw new IllegalArgumentException("Not supported session in logger: " + session.getClass());