[jboss-svn-commits] JBL Code SVN: r36561 - in labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools: reteoo and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jan 20 01:47:16 EST 2011
Author: tsurdilovic
Date: 2011-01-20 01:47:15 -0500 (Thu, 20 Jan 2011)
New Revision: 36561
Modified:
labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/impl/StatelessKnowledgeSessionImpl.java
labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
Log:
SOA-2771 : Ruleflow broken inside BusinessRulesProcessor
Modified: labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/impl/StatelessKnowledgeSessionImpl.java
===================================================================
--- labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/impl/StatelessKnowledgeSessionImpl.java 2011-01-20 04:28:42 UTC (rev 36560)
+++ labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/impl/StatelessKnowledgeSessionImpl.java 2011-01-20 06:47:15 UTC (rev 36561)
@@ -19,6 +19,8 @@
import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.drools.SessionConfiguration;
@@ -33,6 +35,7 @@
import org.drools.common.InternalFactHandle;
import org.drools.common.InternalRuleBase;
import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleFlowEventListener;
import org.drools.event.RuleFlowEventSupport;
import org.drools.event.WorkingMemoryEventSupport;
import org.drools.event.process.ProcessEventListener;
@@ -119,11 +122,26 @@
}
this.ruleBase.readLock();
try {
- ReteooWorkingMemory wm = new ReteooWorkingMemory( this.ruleBase.nextWorkingMemoryCounter(),
- this.ruleBase,
- (SessionConfiguration) this.conf,
- this.environment );
-
+ ReteooWorkingMemory wm;
+ if(this.ruleFlowEventSupport.getEventListeners().size() > 0) {
+ wm = new ReteooWorkingMemory( this.ruleBase.nextWorkingMemoryCounter(),
+ this.ruleBase,
+ (SessionConfiguration) this.conf,
+ this.environment,
+ this.ruleFlowEventSupport);
+ } else {
+ wm = new ReteooWorkingMemory( this.ruleBase.nextWorkingMemoryCounter(),
+ this.ruleBase,
+ (SessionConfiguration) this.conf,
+ this.environment );
+
+ // copy the wm event listeners
+ Iterator<RuleFlowEventListener> wmFlowListenerIter = wm.getRuleFlowEventListeners().iterator();
+ while ( wmFlowListenerIter.hasNext() ) {
+ this.ruleFlowEventSupport.addEventListener(wmFlowListenerIter.next());
+ }
+ wm.setRuleFlowEventSupport( this.ruleFlowEventSupport );
+ }
// we don't pass the mapped listener wrappers to the session constructor anymore,
// because they would be ignored anyway, since the wm already contains those listeners
StatefulKnowledgeSessionImpl ksession = new StatefulKnowledgeSessionImpl( wm,
@@ -133,7 +151,6 @@
wm.setKnowledgeRuntime( ksession );
wm.setWorkingMemoryEventSupport( this.workingMemoryEventSupport );
wm.setAgendaEventSupport( this.agendaEventSupport );
- wm.setRuleFlowEventSupport( this.ruleFlowEventSupport );
final InternalFactHandle handle = wm.getFactHandleFactory().newFactHandle( InitialFactImpl.getInstance(),
wm.getObjectTypeConfigurationRegistry().getObjectTypeConf( EntryPoint.DEFAULT,
Modified: labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
===================================================================
--- labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java 2011-01-20 04:28:42 UTC (rev 36560)
+++ labs/jbossrules/soa_branches/BRMS-5.1-GA_SOA-2771/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java 2011-01-20 06:47:15 UTC (rev 36561)
@@ -101,6 +101,28 @@
this.agenda = new DefaultAgenda( ruleBase );
this.agenda.setWorkingMemory( this );
}
+
+ /**
+ * TODO - CHECK!!
+ * @param id
+ * @param ruleBase
+ * @param config
+ * @param environment
+ * @param ruleFlowEventSupport
+ */
+ public ReteooWorkingMemory(final int id,
+ final InternalRuleBase ruleBase,
+ final SessionConfiguration config,
+ final Environment environment,
+ final RuleFlowEventSupport ruleFlowEventSupport) {
+ this( id,
+ ruleBase,
+ config,
+ environment,
+ new WorkingMemoryEventSupport(),
+ new AgendaEventSupport(),
+ ruleFlowEventSupport);
+ }
public ReteooWorkingMemory(final int id,
final InternalRuleBase ruleBase,
More information about the jboss-svn-commits
mailing list