[jboss-svn-commits] JBL Code SVN: r18622 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Feb 28 14:21:42 EST 2008
Author: mark.proctor at jboss.com
Date: 2008-02-28 14:21:42 -0500 (Thu, 28 Feb 2008)
New Revision: 18622
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
Log:
JBRULES-1488 Serialisation TidyUps
-Moved serialisation tests to MarshallingTest
-Removed unneeded byte[] stream wrapper from AbstractRuleBase
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2008-02-28 19:21:36 UTC (rev 18621)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2008-02-28 19:21:42 UTC (rev 18622)
@@ -179,19 +179,20 @@
// Rules must be restored by an ObjectInputStream that can resolve using a given ClassLoader to handle seaprately by storing as
// a byte[]
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final ObjectOutput out = new ObjectOutputStream( bos );
- out.writeObject( this.id );
- out.writeObject( this.processes );
- out.writeObject( this.agendaGroupRuleTotals );
- out.writeObject( this.factHandleFactory );
- out.writeObject( this.globals );
- out.writeObject( this.config );
+ //final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ //final ObjectOutput out = new ObjectOutputStream( bos );
+
+ stream.writeObject( this.id );
+ stream.writeObject( this.processes );
+ stream.writeObject( this.agendaGroupRuleTotals );
+ stream.writeObject( this.factHandleFactory );
+ stream.writeObject( this.globals );
+ stream.writeObject( this.config );
this.eventSupport.removeEventListener( RuleBaseEventListener.class );
- out.writeObject( this.eventSupport );
+ stream.writeObject( this.eventSupport );
- stream.writeObject( bos.toByteArray() );
+ //stream.writeObject( bos.toByteArray() );
}
/**
@@ -222,23 +223,17 @@
this.packageClassLoader.addClassLoader( ((Package) it.next()).getDialectDatas().getClassLoader() );
}
- // Return the rules stored as a byte[]
- final byte[] bytes = (byte[]) stream.readObject();
+ this.id = (String) stream.readObject();
+ this.processes = (Map) stream.readObject();
+ this.agendaGroupRuleTotals = (Map) stream.readObject();
+ this.factHandleFactory = (FactHandleFactory) stream.readObject();
+ this.globals = (Map) stream.readObject();
- // Use a custom ObjectInputStream that can resolve against a given classLoader
- final DroolsObjectInputStream childStream = new DroolsObjectInputStream( new ByteArrayInputStream( bytes ),
- this.packageClassLoader );
- childStream.setRuleBase( this );
-
- this.id = (String) childStream.readObject();
- this.processes = (Map) childStream.readObject();
- this.agendaGroupRuleTotals = (Map) childStream.readObject();
- this.factHandleFactory = (FactHandleFactory) childStream.readObject();
- this.globals = (Map) childStream.readObject();
-
- this.config = (RuleBaseConfiguration) childStream.readObject();
- this.config.setClassLoader( childStream.getClassLoader() );
- this.eventSupport = (RuleBaseEventSupport) childStream.readObject();
+ this.config = (RuleBaseConfiguration) stream.readObject();
+
+ this.config.setClassLoader( this.packageClassLoader );
+
+ this.eventSupport = (RuleBaseEventSupport) stream.readObject();
this.eventSupport.setRuleBase( this );
this.statefulSessions = new ObjectHashSet();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2008-02-28 19:21:36 UTC (rev 18621)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2008-02-28 19:21:42 UTC (rev 18622)
@@ -63,6 +63,7 @@
import org.drools.process.instance.ProcessInstanceFactory;
import org.drools.process.instance.WorkItemManager;
import org.drools.reteoo.ClassObjectTypeConf;
+import org.drools.reteoo.EntryPointNode;
import org.drools.reteoo.FactTemplateTypeConf;
import org.drools.reteoo.LIANodePropagation;
import org.drools.reteoo.ObjectTypeConf;
@@ -117,10 +118,6 @@
/** Global values which are associated with this memory. */
protected GlobalResolver globalResolver;
- protected static final Object NULL = new Serializable() {
- private static final long serialVersionUID = 400L;
- };
-
/** The eventSupport */
protected WorkingMemoryEventSupport workingMemoryEventSupport = new WorkingMemoryEventSupport();
@@ -172,9 +169,10 @@
private TimeMachine timeMachine = new TimeMachine();
private Map<EntryPoint, Map<Object, ObjectTypeConf>> typeConfMap;
+
+ private EntryPoint entryPoint;
+ private EntryPointNode entryPointNode;
- private SessionClock sessionClock;
-
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
@@ -187,6 +185,7 @@
*/
public AbstractWorkingMemory(final int id,
final InternalRuleBase ruleBase,
+ //final EntryPoint entryPoint,
final FactHandleFactory handleFactory) {
this.id = id;
this.ruleBase = ruleBase;
@@ -220,6 +219,9 @@
new RuleFlowProcessInstanceFactory() );
this.typeConfMap = new ConcurrentHashMap<EntryPoint, Map<Object, ObjectTypeConf>>();
+
+// this.entryPoint = entryPoint;
+// this.entryPointNode = this.ruleBase.getRete().getEntryPointNode( this.entryPoint );
}
// ------------------------------------------------------------
More information about the jboss-svn-commits
mailing list