[jboss-svn-commits] JBL Code SVN: r19866 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: persister and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue May 6 00:37:59 EDT 2008


Author: mark.proctor at jboss.com
Date: 2008-05-06 00:37:59 -0400 (Tue, 06 May 2008)
New Revision: 19866

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/InputPersister.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/OutputPersister.java
Log:
JBRULES-1598 Efficient WorkingMemory serialization with binary protocol
-tweaks to make first simple test work

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java	2008-05-06 04:37:52 UTC (rev 19865)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java	2008-05-06 04:37:59 UTC (rev 19866)
@@ -51,13 +51,13 @@
 
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        id  = (AtomicInteger) in.readObject();
-        counter = (AtomicLong) in.readObject();
+        this.id = new AtomicInteger( in.readInt() );
+        this.counter = new AtomicLong( in.readLong() );
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(id);
-        out.writeObject(counter);
+        out.writeInt(id.get());
+        out.writeLong(counter.get());
     }
 
     /* (non-Javadoc)

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/InputPersister.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/InputPersister.java	2008-05-06 04:37:52 UTC (rev 19865)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/InputPersister.java	2008-05-06 04:37:59 UTC (rev 19866)
@@ -8,8 +8,10 @@
 import org.drools.base.ClassObjectType;
 import org.drools.common.AgendaItem;
 import org.drools.common.BaseNode;
+import org.drools.common.BinaryHeapQueueAgendaGroup;
 import org.drools.common.DefaultAgenda;
 import org.drools.common.DefaultFactHandle;
+import org.drools.common.InternalAgendaGroup;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalRuleBase;
 import org.drools.common.InternalWorkingMemory;
@@ -36,6 +38,7 @@
 import org.drools.rule.Package;
 import org.drools.rule.Rule;
 import org.drools.spi.Activation;
+import org.drools.spi.AgendaGroup;
 import org.drools.spi.ObjectType;
 import org.drools.spi.PropagationContext;
 import org.drools.util.BinaryHeapQueue;
@@ -57,6 +60,7 @@
     public InternalWorkingMemory read() throws IOException,
                                        ClassNotFoundException {
         readFactHandles( context );
+        context.stream.close();
         return context.wm;
     }
 
@@ -64,7 +68,7 @@
                                                                         ClassNotFoundException {
         ObjectInputStream stream = context.stream;
         InternalRuleBase ruleBase = context.ruleBase;
-        
+
         PlaceholderResolverStrategyFactory resolverStrategyFactory = context.resolverStrategyFactory;
 
         ReteooFactHandleFactory factHandleFactory = new ReteooFactHandleFactory();
@@ -85,10 +89,10 @@
             int id = stream.readInt();
             long recency = stream.readLong();
             PlaceholderResolverStrategy strategy = resolverStrategyFactory.get( null );
-//            ObjectPlaceholder placeHolder = strategy.read( stream );
-//
-//            Object object = placeHolder.resolveObject();
-            Object object = null;
+            ObjectPlaceholder placeHolder = strategy.read( stream );
+
+            Object object = placeHolder.resolveObject();
+
             InternalFactHandle handle = new DefaultFactHandle( id,
                                                                object,
                                                                recency );
@@ -123,28 +127,15 @@
                      false );
         }
 
-        //        type = stream.readInt();
-        //        if ( type == PersisterEnums.LEFT_TUPLE ) {
-        //            type = PersisterEnums.REPEAT;
-        //            while ( type == PersisterEnums.REPEAT ) {
-        //                LeftTupleSink sink = (LeftTupleSink) sinks.get( stream.readInt() );
-        //                int factHandleId = stream.readInt();
-        //                LeftTuple leftTuple = new LeftTuple( context.handles[factHandleId],
-        //                                                     sink,
-        //                                                     true );
-        //                readLeftTuple( leftTuple,
-        //                               context );
-        //            }
-        //        }
-        //
-        //        readPropagationContexts( context );
+        readLeftTuples( context );
 
-        //        readActivations( context );        
+        readPropagationContexts( context );
+
+        readActivations( context );
     }
 
     public static void readRightTuple(WMSerialisationInContext context,
-                                      InternalFactHandle factHandle) throws IOException,
-                                                                    ClassNotFoundException {
+                                      InternalFactHandle factHandle) throws IOException {
         ObjectInputStream stream = context.stream;
 
         RightTupleSink sink = (RightTupleSink) context.sinks.get( stream.readInt() );
@@ -159,10 +150,23 @@
 
         memory.getRightTupleMemory().add( rightTuple );
     }
+    
+    public static void readLeftTuples(WMSerialisationInContext context)  throws IOException {
+        ObjectInputStream stream = context.stream;
+        
+        while ( stream.readInt() == PersisterEnums.LEFT_TUPLE ) {
+            LeftTupleSink sink = (LeftTupleSink) context.sinks.get( stream.readInt() );
+            int factHandleId = stream.readInt();
+            LeftTuple leftTuple = new LeftTuple( context.handles.get( factHandleId ),
+                                                 sink,
+                                                 true );
+            readLeftTuple( leftTuple,
+                           context );
+        }
+    }
 
     public static void readLeftTuple(LeftTuple parentLeftTuple,
-                                     WMSerialisationInContext context) throws IOException,
-                                                                      ClassNotFoundException {
+                                     WMSerialisationInContext context) throws IOException {
         ObjectInputStream stream = context.stream;
         InternalRuleBase ruleBase = context.ruleBase;
         InternalWorkingMemory wm = context.wm;
@@ -174,41 +178,35 @@
             BetaMemory memory = (BetaMemory) context.wm.getNodeMemory( (BetaNode) sink );
             memory.getLeftTupleMemory().add( parentLeftTuple );
 
+            while ( stream.readInt() == PersisterEnums.RIGHT_TUPLE ) {
+                LeftTupleSink childSink = (LeftTupleSink) sinks.get( stream.readInt() );
+                int factHandleId = stream.readInt();
+                RightTupleKey key = new RightTupleKey( factHandleId,
+                                                       sink );
+                RightTuple rightTuple = context.rightTuples.get( key );
+                LeftTuple childLeftTuple = new LeftTuple( parentLeftTuple,
+                                                          rightTuple,
+                                                          childSink,
+                                                          true );
+                readLeftTuple( childLeftTuple,
+                               context );
+            }
+
+        } else if ( sink instanceof NotNode ) {
+            BetaMemory memory = (BetaMemory) context.wm.getNodeMemory( (BetaNode) sink );
             int type = stream.readInt();
-            if ( type == PersisterEnums.RIGHT_TUPLE ) {
-                type = PersisterEnums.REPEAT;
-                while ( type == PersisterEnums.REPEAT ) {
+            if ( type == PersisterEnums.LEFT_TUPLE_NOT_BLOCKED ) {
+                memory.getLeftTupleMemory().add( parentLeftTuple );
+
+                while ( stream.readInt() == PersisterEnums.LEFT_TUPLE ) {
                     LeftTupleSink childSink = (LeftTupleSink) sinks.get( stream.readInt() );
-                    int factHandleId = stream.readInt();
-                    RightTupleKey key = new RightTupleKey( factHandleId,
-                                                           sink );
-                    RightTuple rightTuple = context.rightTuples.get( key );
                     LeftTuple childLeftTuple = new LeftTuple( parentLeftTuple,
-                                                              rightTuple,
                                                               childSink,
                                                               true );
                     readLeftTuple( childLeftTuple,
                                    context );
                 }
-            }
-        } else if ( sink instanceof NotNode ) {
-            BetaMemory memory = (BetaMemory) context.wm.getNodeMemory( (BetaNode) sink );
-            int type = stream.readInt();
-            if ( type == PersisterEnums.LEFT_TUPLE_NOT_BLOCKED ) {
-                memory.getLeftTupleMemory().add( parentLeftTuple );
 
-                type = stream.readInt();
-                if ( type == PersisterEnums.LEFT_TUPLE ) {
-                    type = PersisterEnums.REPEAT;
-                    while ( type == PersisterEnums.REPEAT ) {
-                        LeftTupleSink childSink = (LeftTupleSink) sinks.get( stream.readInt() );
-                        LeftTuple childLeftTuple = new LeftTuple( parentLeftTuple,
-                                                                  childSink,
-                                                                  true );
-                        readLeftTuple( childLeftTuple,
-                                       context );
-                    }
-                }
             } else {
                 int factHandleId = stream.readInt();
                 RightTupleKey key = new RightTupleKey( factHandleId,
@@ -233,21 +231,15 @@
         }
     }
 
-    public static void readActivations(WMSerialisationInContext context) throws IOException,
-                                                                        ClassNotFoundException {
+    public static void readActivations(WMSerialisationInContext context) throws IOException {
         ObjectInputStream stream = context.stream;
 
-        int type = stream.readInt();
-        if ( type == PersisterEnums.ACTIVATION ) {
-            type = PersisterEnums.REPEAT;
-            while ( type == PersisterEnums.REPEAT ) {
-                readActivation( context );
-            }
+        while ( stream.readInt() == PersisterEnums.ACTIVATION ) {
+            readActivation( context );
         }
     }
 
-    public static Activation readActivation(WMSerialisationInContext context) throws IOException,
-                                                                             ClassNotFoundException {
+    public static Activation readActivation(WMSerialisationInContext context) throws IOException {
         ObjectInputStream stream = context.stream;
         InternalRuleBase ruleBase = context.ruleBase;
         InternalWorkingMemory wm = context.wm;
@@ -259,12 +251,12 @@
         int salience = stream.readInt();
 
         //PropagationContext context,
-        String pkgName = (String) stream.readObject();
-        String ruleName = (String) stream.readObject();
+        String pkgName = stream.readUTF();
+        String ruleName = stream.readUTF();
         Package pkg = ruleBase.getPackage( pkgName );
         Rule rule = pkg.getRule( ruleName );
 
-        RuleTerminalNode ruleTerminalNode = (RuleTerminalNode) context.sinks.get( stream.readInt() );
+        RuleTerminalNode ruleTerminalNode = (RuleTerminalNode) leftTuple.getLeftTupleSink();
         GroupElement subRule = ruleTerminalNode.getSubRule();
 
         PropagationContext pc = context.propagationContexts.get( stream.readLong() );
@@ -279,29 +271,33 @@
         boolean activated = stream.readBoolean();
         activation.setActivated( activated );
         if ( activated ) {
-            String agendaGroupName = (String) stream.readObject();
-            BinaryHeapQueue agendaGroup = (BinaryHeapQueue) ((DefaultAgenda) wm.getAgenda()).getAgendaGroup( agendaGroupName );
-            agendaGroup.enqueue( activation );
+            InternalAgendaGroup agendaGroup;
+            if ( rule.getAgendaGroup() == null || rule.getAgendaGroup().equals( "" ) || rule.getAgendaGroup().equals( AgendaGroup.MAIN ) ) {
+                // Is the Rule AgendaGroup undefined? If it is use MAIN,
+                // which is added to the Agenda by default
+                agendaGroup = (InternalAgendaGroup) wm.getAgenda().getAgendaGroup( AgendaGroup.MAIN );
+            } else {
+                // AgendaGroup is defined, so try and get the AgendaGroup
+                // from the Agenda
+                agendaGroup = (InternalAgendaGroup) wm.getAgenda().getAgendaGroup( rule.getAgendaGroup() );
+            }
+
+            agendaGroup.add( activation );
         }
 
         return activation;
     }
 
-    public static void readPropagationContexts(WMSerialisationInContext context) throws IOException,
-                                                                                ClassNotFoundException {
+    public static void readPropagationContexts(WMSerialisationInContext context) throws IOException {
         ObjectInputStream stream = context.stream;
 
-        int type = stream.readInt();
-        if ( type == PersisterEnums.PROPAGATION_CONTEXT ) {
-            type = PersisterEnums.REPEAT;
-            while ( type == PersisterEnums.REPEAT ) {
-                readPropagationContext( context );
-            }
+        while ( stream.readInt() == PersisterEnums.PROPAGATION_CONTEXT ) {
+            readPropagationContext( context );
         }
+
     }
 
-    public static void readPropagationContext(WMSerialisationInContext context) throws IOException,
-                                                                               ClassNotFoundException {
+    public static void readPropagationContext(WMSerialisationInContext context) throws IOException {
         ObjectInputStream stream = context.stream;
         InternalRuleBase ruleBase = context.ruleBase;
         InternalWorkingMemory wm = context.wm;
@@ -348,22 +344,4 @@
         context.propagationContexts.put( propagationNumber,
                                          pc );
     }
-
-    //
-    //    public long getLastId() {
-    //        return lastId;
-    //    }
-    //
-    //    public long getLastRecency() {
-    //        return lastRecency;
-    //    }
-    //
-    //    public InternalFactHandle[] getHandles() {
-    //        return handles;
-    //    }
-    //
-    //    public int getSize() {
-    //        return this.size;
-    //    }
-
 }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/OutputPersister.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/OutputPersister.java	2008-05-06 04:37:52 UTC (rev 19865)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persister/OutputPersister.java	2008-05-06 04:37:59 UTC (rev 19866)
@@ -51,6 +51,7 @@
 
     public void write() throws IOException {
         writeFactHandles( context );
+        context.stream.close();
     }
 
     public static void writeFactHandles(WMSerialisationOutContext context) throws IOException {
@@ -91,32 +92,13 @@
                                      context );
                     i++;
                 }
-            }
-            stream.writeInt( PersisterEnums.END );
-        }
-
-        // Write out LeftTuples
-        for ( Iterator it = wm.getObjectStore().iterateFactHandles(); it.hasNext(); ) {
-            InternalFactHandle handle = (InternalFactHandle) it.next();
-
-            if ( handle.getLeftTuple() != null ) {
-                stream.writeInt( PersisterEnums.LEFT_TUPLE );
-                int i = 0;
-                for ( LeftTuple leftTuple = handle.getLeftTuple(); leftTuple != null; leftTuple = (LeftTuple) leftTuple.getLeftParentNext() ) {
-                    if ( i != 0 ) {
-                        stream.writeInt( PersisterEnums.REPEAT );
-                    }
-
-                    stream.writeInt( leftTuple.getLeftTupleSink().getId() );
-                    stream.writeInt( leftTuple.getLastHandle().getId() );
-
-                    writeLeftTuple( leftTuple,
-                                    context );
-                }
+            } else {
                 stream.writeInt( PersisterEnums.END );
             }
         }
 
+        writeLeftTuples( context );
+
         writePropagationContexts( context );
 
         writeActivations( context );
@@ -131,6 +113,27 @@
         stream.writeInt( rightTuple.getRightTupleSink().getId() );
     }
 
+    public static void writeLeftTuples(WMSerialisationOutContext context) throws IOException {
+        ObjectOutputStream stream = context.stream;
+        InternalWorkingMemory wm = context.wm;
+
+        // Write out LeftTuples
+        for ( Iterator it = wm.getObjectStore().iterateFactHandles(); it.hasNext(); ) {
+            InternalFactHandle handle = (InternalFactHandle) it.next();
+
+            for ( LeftTuple leftTuple = handle.getLeftTuple(); leftTuple != null; leftTuple = (LeftTuple) leftTuple.getLeftParentNext() ) {
+                stream.writeInt( PersisterEnums.LEFT_TUPLE );
+
+                stream.writeInt( leftTuple.getLeftTupleSink().getId() );
+                stream.writeInt( leftTuple.getLastHandle().getId() );
+
+                writeLeftTuple( leftTuple,
+                                context );
+            }
+        }
+        stream.writeInt( PersisterEnums.END );
+    }
+
     public static void writeLeftTuple(LeftTuple leftTuple,
                                       WMSerialisationOutContext context) throws IOException {
         ObjectOutputStream stream = context.stream;
@@ -138,17 +141,10 @@
         InternalWorkingMemory wm = context.wm;
 
         LeftTupleSink sink = leftTuple.getLeftTupleSink();
-        stream.writeInt( sink.getId() );
 
         if ( sink instanceof JoinNode ) {
-            if ( leftTuple.getBetaChildren() != null ) {
-                stream.writeInt( PersisterEnums.RIGHT_TUPLE );
-            }
-            int i = 0;
             for ( LeftTuple childLeftTuple = leftTuple.getBetaChildren(); leftTuple != null; childLeftTuple = (LeftTuple) leftTuple.getLeftParentNext() ) {
-                if ( i != 0 ) {
-                    stream.writeInt( PersisterEnums.REPEAT );
-                }
+                stream.writeInt( PersisterEnums.RIGHT_TUPLE );
                 stream.writeInt( childLeftTuple.getLeftTupleSink().getId() );
                 stream.writeInt( childLeftTuple.getRightParent().getFactHandle().getId() );
                 writeLeftTuple( childLeftTuple,
@@ -160,12 +156,8 @@
                 // is blocked so has children
                 stream.writeInt( PersisterEnums.LEFT_TUPLE_NOT_BLOCKED );
 
-                stream.writeInt( PersisterEnums.LEFT_TUPLE );
-                int i = 0;
                 for ( LeftTuple childLeftTuple = leftTuple.getBetaChildren(); leftTuple != null; childLeftTuple = (LeftTuple) leftTuple.getLeftParentNext() ) {
-                    if ( i != 0 ) {
-                        stream.writeInt( PersisterEnums.REPEAT );
-                    }
+                    stream.writeInt( PersisterEnums.LEFT_TUPLE );
                     stream.writeInt( childLeftTuple.getLeftTupleSink().getId() );
                     writeLeftTuple( childLeftTuple,
                                     context );
@@ -189,20 +181,15 @@
 
         Map<LeftTuple, Integer> tuples = context.terminalTupleMap;
         if ( !tuples.isEmpty() ) {
-            stream.writeInt( PersisterEnums.ACTIVATION );
-        }
-
-        int i = 0;
-        for ( LeftTuple leftTuple : tuples.keySet() ) {
-            if ( i != 0 ) {
-                stream.writeInt( PersisterEnums.REPEAT );
+            for ( LeftTuple leftTuple : tuples.keySet() ) {
+                stream.writeInt( PersisterEnums.ACTIVATION );
+                writeActivation( context,
+                                 leftTuple,
+                                 (AgendaItem) leftTuple.getActivation(),
+                                 (RuleTerminalNode) leftTuple.getLeftTupleSink() );
             }
-            writeActivation( context,
-                             leftTuple,
-                             (AgendaItem) leftTuple.getActivation(),
-                             (RuleTerminalNode) leftTuple.getLeftTupleSink() );
-            i++;
         }
+        stream.writeInt( PersisterEnums.END );
     }
 
     public static void writeActivation(WMSerialisationOutContext context,
@@ -218,13 +205,11 @@
         stream.writeInt( agendaItem.getSalience() );
 
         Rule rule = agendaItem.getRule();
-        stream.writeChars( rule.getPackage() );
-        stream.writeChars( rule.getName() );
+        stream.writeUTF( rule.getPackage() );
+        stream.writeUTF( rule.getName() );
 
         stream.writeLong( agendaItem.getPropagationContext().getPropagationNumber() );
 
-        stream.writeInt( ruleTerminalNode.getId() );
-
         stream.writeBoolean( agendaItem.isActivated() );
     }
 
@@ -233,24 +218,18 @@
 
         Map<LeftTuple, Integer> tuples = context.terminalTupleMap;
         if ( !tuples.isEmpty() ) {
-            stream.writeInt( PersisterEnums.PROPAGATION_CONTEXT );
-        }
+            Map<Long, PropagationContext> pcMap = new HashMap<Long, PropagationContext>();
 
-        Map<Long, PropagationContext> pcMap = new HashMap<Long, PropagationContext>();
-
-        int i = 0;
-        for ( LeftTuple leftTuple : tuples.keySet() ) {
-            if ( i != 0 ) {
-                stream.writeInt( PersisterEnums.REPEAT );
+            for ( LeftTuple leftTuple : tuples.keySet() ) {
+                PropagationContext pc = leftTuple.getActivation().getPropagationContext();
+                if ( !pcMap.containsKey( pc.getPropagationNumber() ) ) {
+                    stream.writeInt( PersisterEnums.PROPAGATION_CONTEXT );
+                    writePropagationContext( context,
+                                             pc );
+                    pcMap.put( pc.getPropagationNumber(),
+                               pc );
+                }
             }
-            PropagationContext pc = leftTuple.getActivation().getPropagationContext();
-            if ( !pcMap.containsKey( pc.getPropagationNumber() ) ) {
-                writePropagationContext( context,
-                                         pc );
-                pcMap.put( pc.getPropagationNumber(),
-                           pc );
-            }
-            i++;
         }
 
         stream.writeInt( PersisterEnums.END );
@@ -280,6 +259,7 @@
             stream.writeBoolean( false );
         }
 
+        stream.writeLong( pc.getPropagationNumber() );
         stream.writeInt( pc.getFactHandleOrigin().getId() );
 
         stream.writeInt( pc.getActiveActivations() );
@@ -287,88 +267,4 @@
 
         stream.writeUTF( pc.getEntryPoint().getEntryPointId() );
     }
-
-    //    public void writeParentActivations(Activation[] activations) throws IOException {
-    //        //        // we do these first as we know the parent Activation is null
-    //        //        // first create placeholders for rules
-    //        //        
-    //        //        for ( int i = 0, length = activations.length; i < length; i++ ){                
-    //        //            AgendaItem item = ( AgendaItem ) activations[i];
-    //        //            // this is a parent activation that has had it's resources released, so write first
-    //        //            if ( item.getPropagationContext().getActivationOrigin() == null ) {
-    //        //                writeActivation( item );
-    //        //            }
-    //        //            PlaceholderEntry placeHolder = this.placeholders.assignPlaceholder( item.getRule(), RulePersisterKey.getInstace() );               
-    //        //            RulePersisterKey.getInstace().writeExternal( item.getRule(), placeHolder, this.stream );
-    //        //            
-    //        //            // writeout Activation on PropagationContext
-    //        //            item = ( AgendaItem ) item.getPropagationContext().getActivationOrigin();
-    //        //            Rule rule = item.getPropagationContext().getRuleOrigin();
-    //        //        }           
-    //    }
-    //
-    ////    public void writeActivations(InternalWorkingMemory wm) throws IOException {
-    ////        //        BinaryHeapQueueAgendaGroup[] groups = ( BinaryHeapQueueAgendaGroup[] ) wm.getAgenda().getAgendaGroups();
-    ////        //        for ( int i = 0, iLength = groups.length; i < iLength; i++ ) {
-    ////        //            BinaryHeapQueueAgendaGroup group = groups[i];
-    ////        //            this.stream.writeInt( group.size() );
-    ////        //            this.stream.writeChars( group.getName() );      
-    ////        //            
-    ////        //            writeActivations( groups[i].getActivations() );
-    ////        //        }
-    ////    }
-    //
-    //    public void writeActivation(Activation[] activations) throws IOException {
-    //        //        // first create placeholders for rules, need to count rules first
-    //        //        int count =  0;
-    //        //        RulePersisterKey ruleKey = RulePersisterKey.getInstace() ;
-    //        //        for ( int i = 0, length = activations.length; i < length; i++ ){                
-    //        //            AgendaItem item = ( AgendaItem ) activations[i];    
-    //        //            
-    //        //            Rule rule = item.getRule();
-    //        //            if ( this.placeholders.lookupPlaceholder(  rule, ruleKey) == null ) {
-    //        //                this.placeholders.assignPlaceholder( rule, ruleKey );
-    //        //                count++;
-    //        //            }
-    //        //            
-    //        //            Rule rule = item.getPropagationContext().getRuleOrigin()
-    //        //            
-    //        //            // writeout Activation on PropagationContext
-    //        //            item = ( AgendaItem ) item.getPropagationContext().getActivationOrigin();
-    //        //            Rule rule = item.getPropagationContext().getRuleOrigin();
-    //        //        }   
-    //        //        
-    //        //        // write our activations
-    //        //        for ( int j = 0, jLength = group.size(); j < jLength; j++ ){                
-    //        //            AgendaItem item = ( AgendaItem ) activations[i];                
-    //        //            writeTuple( ( ReteTuple ) item.getTuple() );
-    //        //            this.stream.writeInt( this.placeholders.assignPlaceholder( item.getRule(), RulePersisterKey.getInstace() ).id );
-    //        //            this.stream.write(  item.getSalience()  );
-    //        //        }          
-    //    }
-    //
-    //    public void writeTuple(LeftTuple tuple) throws IOException {
-    //        //        tuple.writeExternal( this.stream );
-    //        //        LeftTuple leftParent = tuple;
-    //        //        LeftTuple child = tuple.getBetaChildren();
-    //        //        RightTuple rightParent = child.getRightParent();
-    //
-    //        //        int size = 0;        
-    //        //        LeftTuple entry = tuple;
-    //        //        while ( entry != null ) {
-    //        //            size++;
-    //        //            entry = entry.getParent();
-    //        //        }
-    //        //        
-    //        //        this.stream.writeInt( size );
-    //        //        while ( entry != null ) {
-    //        //            this.stream.writeLong( entry.getLastHandle().getId() );
-    //        //            entry = entry.getParent();
-    //        //        }        
-    //    }
-
-    //    public OutputPersister(WorkingMemory workingMemory) {
-    //        BinaryHeapQueueAgendaGroup[] groups = ( BinaryHeapQueueAgendaGroup[] ) workingMemory.getAgenda().getAgendaGroups();
-    //        
-    //    }
 }




More information about the jboss-svn-commits mailing list