From 19cda5e3ec6869feea55ccc07cce21301c42146e Mon Sep 17 00:00:00 2001 From: mariofusco Date: Wed, 23 Aug 2023 16:12:29 +0200 Subject: [PATCH] [DROOLS-7537] remove no longer needed activation count in event fact handle --- .../core/common/DefaultEventHandle.java | 35 ---------------- .../core/impl/ActivationsManagerImpl.java | 33 ++------------- .../impl/WorkingMemoryReteExpireAction.java | 20 +++------ .../core/phreak/PhreakRuleTerminalNode.java | 1 - .../org/drools/core/reteoo/AbstractTuple.java | 30 ++++---------- .../org/drools/core/reteoo/LeftTuple.java | 38 ++++++++--------- .../drools/core/reteoo/RightTupleImpl.java | 8 ++-- .../reteoo/RuleTerminalNodeLeftTuple.java | 31 +++++++------- .../java/org/drools/core/reteoo/Tuple.java | 4 -- .../kiesession/agenda/DefaultAgenda.java | 41 +++---------------- .../protobuf/ProtobufOutputMarshaller.java | 1 - .../protobuf/FactHandleMarshallingTest.java | 3 -- .../protobuf/OldOutputMarshallerMethods.java | 13 +++--- 13 files changed, 69 insertions(+), 189 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/common/DefaultEventHandle.java b/drools-core/src/main/java/org/drools/core/common/DefaultEventHandle.java index 87700c4da0d..19855a24161 100644 --- a/drools-core/src/main/java/org/drools/core/common/DefaultEventHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/DefaultEventHandle.java @@ -34,7 +34,6 @@ public class DefaultEventHandle extends DefaultFactHandle implements EventHandle private long duration; private boolean expired; private boolean pendingRemoveFromStore; - private long activationsCount; private int otnCount; private DefaultEventHandle linkedFactHandle; @@ -190,38 +189,6 @@ public void setPendingRemoveFromStore(boolean pendingRemove) { } } - public long getActivationsCount() { - if ( linkedFactHandle != null ) { - return linkedFactHandle.getActivationsCount(); - } else { - return activationsCount; - } - } - - public void setActivationsCount(long activationsCount) { - if ( linkedFactHandle != null ) { - linkedFactHandle.setActivationsCount( activationsCount ); - } else { - this.activationsCount = activationsCount; - } - } - - public void increaseActivationsCount() { - if ( linkedFactHandle != null ) { - linkedFactHandle.increaseActivationsCount(); - } else { - this.activationsCount++; - } - } - - public void decreaseActivationsCount() { - if ( linkedFactHandle != null ) { - linkedFactHandle.decreaseActivationsCount(); - } else { - this.activationsCount--; - } - } - public void increaseOtnCount() { otnCount++; } @@ -246,7 +213,6 @@ public DefaultEventHandle clone() { getStartTimestamp(), getDuration(), getEntryPointId() ); - clone.setActivationsCount( getActivationsCount() ); clone.setOtnCount( getOtnCount() ); clone.setExpired( isExpired() ); clone.setEqualityKey( getEqualityKey() ); @@ -264,7 +230,6 @@ private DefaultEventHandle cloneWithoutTuples() { getStartTimestamp(), getDuration(), getEntryPointId() ); - clone.setActivationsCount( getActivationsCount() ); clone.setOtnCount( getOtnCount() ); clone.setExpired( isExpired() ); clone.setEqualityKey( getEqualityKey() ); diff --git a/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java b/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java index f86738e1a16..173c7c2092c 100644 --- a/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java +++ b/drools-core/src/main/java/org/drools/core/impl/ActivationsManagerImpl.java @@ -18,32 +18,12 @@ import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.common.ActivationGroupImpl; -import org.drools.core.common.ActivationGroupNode; -import org.drools.core.common.ActivationsFilter; -import org.drools.core.common.ActivationsManager; -import org.drools.core.common.AgendaGroupsManager; -import org.drools.core.common.InternalActivationGroup; -import org.drools.core.common.InternalAgendaGroup; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.InternalWorkingMemoryEntryPoint; -import org.drools.core.common.PropagationContext; -import org.drools.core.common.ReteEvaluator; +import org.drools.core.common.*; import org.drools.core.concurrent.GroupEvaluator; import org.drools.core.concurrent.SequentialGroupEvaluator; import org.drools.core.event.AgendaEventSupport; -import org.drools.core.phreak.ExecutableEntry; -import org.drools.core.phreak.PropagationEntry; -import org.drools.core.phreak.PropagationList; -import org.drools.core.phreak.RuleAgendaItem; -import org.drools.core.phreak.RuleExecutor; -import org.drools.core.phreak.SynchronizedPropagationList; -import org.drools.core.reteoo.AgendaComponentFactory; -import org.drools.core.reteoo.ObjectTypeNode; -import org.drools.core.reteoo.PathMemory; -import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; -import org.drools.core.reteoo.TerminalNode; -import org.drools.core.reteoo.Tuple; +import org.drools.core.phreak.*; +import org.drools.core.reteoo.*; import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.rule.consequence.KnowledgeHelper; import org.drools.util.StringUtils; @@ -51,11 +31,7 @@ import org.kie.api.event.rule.MatchCancelledCause; import org.kie.api.runtime.rule.AgendaFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; public class ActivationsManagerImpl implements ActivationsManager { @@ -189,7 +165,6 @@ public void cancelActivation(InternalMatch internalMatch) { if (internalMatch.getActivationGroupNode() != null ) { internalMatch.getActivationGroupNode().getActivationGroup().removeActivation(internalMatch); } - ((Tuple) internalMatch).decreaseActivationCountForEvents(); getAgendaEventSupport().fireActivationCancelled(internalMatch, reteEvaluator, MatchCancelledCause.WME_MODIFY); } diff --git a/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java b/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java index 6b9b27ef3f7..d529599ca90 100644 --- a/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java +++ b/drools-core/src/main/java/org/drools/core/impl/WorkingMemoryReteExpireAction.java @@ -15,12 +15,7 @@ package org.drools.core.impl; -import org.drools.core.common.DefaultEventHandle; -import org.drools.core.common.DefaultFactHandle; -import org.drools.core.common.InternalWorkingMemoryEntryPoint; -import org.drools.core.common.PropagationContext; -import org.drools.core.common.ReteEvaluator; -import org.drools.core.common.WorkingMemoryAction; +import org.drools.core.common.*; import org.drools.core.marshalling.MarshallerReaderContext; import org.drools.core.phreak.PropagationEntry; import org.drools.core.reteoo.ObjectTypeNode; @@ -88,19 +83,14 @@ public void internalExecute(ReteEvaluator reteEvaluator) { ObjectTypeNode.expireRightTuple(rt); } ); - expireFactHandle( reteEvaluator, factHandle ); + expireFactHandle( factHandle ); } - private static void expireFactHandle( ReteEvaluator reteEvaluator, DefaultEventHandle factHandle) { + private static void expireFactHandle( DefaultEventHandle factHandle) { factHandle.decreaseOtnCount(); if (factHandle.getOtnCount() <= 0) { factHandle.setExpired( true ); - if (factHandle.getActivationsCount() == 0) { - String epId = factHandle.getEntryPointName(); - ( (InternalWorkingMemoryEntryPoint) reteEvaluator.getEntryPoint( epId ) ).removeFromObjectStore( factHandle ); - } else { - factHandle.setPendingRemoveFromStore( true ); - } + factHandle.setPendingRemoveFromStore( true ); } } @@ -156,7 +146,7 @@ public void internalExecute(ReteEvaluator reteEvaluator ) { }); if (isMainPartition()) { - expireFactHandle( reteEvaluator, factHandle ); + expireFactHandle( factHandle ); } } diff --git a/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java b/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java index 2ae181fb55e..50645ffd6a1 100644 --- a/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java +++ b/drools-core/src/main/java/org/drools/core/phreak/PhreakRuleTerminalNode.java @@ -126,7 +126,6 @@ public static void doLeftTupleInsert(TerminalNode rtnNode, RuleExecutor executor } executor.addLeftTuple( leftTuple ); - leftTuple.increaseActivationCountForEvents(); // increased here, decreased in Agenda's cancelActivation and fireActivation activationsManager.addItemToActivationGroup( rtnLeftTuple ); if ( !rtnNode.isFireDirect() && executor.isDeclarativeAgendaEnabled() ) { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java index b040e54afb8..b1abe3d0aac 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/AbstractTuple.java @@ -37,7 +37,7 @@ public abstract class AbstractTuple implements Tuple { private Tuple previous; private AbstractTuple next; - protected Sink sink; + private Sink sink; protected Tuple handlePrevious; protected Tuple handleNext; @@ -131,26 +131,6 @@ public FactHandle get(Declaration declaration) { return get(declaration.getTupleIndex()); } - @Override - public void increaseActivationCountForEvents() { - for ( Tuple entry = skipEmptyHandles(); entry != null; entry = entry.getParent() ) { - if(entry.getFactHandle().isEvent()) { - // can be null for eval, not and exists that have no right input - ((DefaultEventHandle)entry.getFactHandle()).increaseActivationsCount(); - } - } - } - - @Override - public void decreaseActivationCountForEvents() { - for ( Tuple entry = skipEmptyHandles(); entry != null; entry = entry.getParent() ) { - if(entry.getFactHandle().isEvent()) { - // can be null for eval, not and exists that have no right input - ((DefaultEventHandle)entry.getFactHandle()).decreaseActivationsCount(); - } - } - } - @Override public Tuple getTuple(int index) { Tuple entry = this; @@ -200,4 +180,12 @@ public boolean isExpired() { public void setExpired() { this.expired = true; } + + protected Sink getSink() { + return sink; + } + + protected void setSink(Sink sink) { + this.sink = sink; + } } diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java index f350923901a..480a5b53aa2 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftTuple.java @@ -16,16 +16,16 @@ package org.drools.core.reteoo; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - import org.drools.core.common.InternalFactHandle; import org.drools.core.common.PropagationContext; import org.drools.core.util.index.TupleList; import org.kie.api.runtime.rule.FactHandle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + /** * A parent class for all specific LeftTuple specializations * @@ -67,7 +67,7 @@ public LeftTuple(InternalFactHandle factHandle, Sink sink, boolean leftTupleMemoryEnabled) { setFactHandle( factHandle ); - this.sink = sink; + setSink(sink); if ( leftTupleMemoryEnabled ) { factHandle.addTupleInPosition( this ); } @@ -80,7 +80,7 @@ public LeftTuple(InternalFactHandle factHandle, this.index = leftTuple.getIndex() + 1; this.parent = leftTuple.getNextParentWithHandle(); this.leftParent = leftTuple; - this.sink = sink; + setSink(sink); } public LeftTuple(LeftTuple leftTuple, @@ -102,7 +102,7 @@ public LeftTuple(LeftTuple leftTuple, leftTuple.setLastChild( this ); } - this.sink = sink; + setSink(sink); } public LeftTuple(LeftTuple leftTuple, @@ -133,7 +133,7 @@ public LeftTuple(LeftTuple leftTuple, rightTuple.setFirstChild( this ); } rightTuple.setLastChild( this ); - this.sink = sink; + setSink(sink); } public LeftTuple(LeftTuple leftTuple, @@ -205,7 +205,7 @@ public LeftTuple(LeftTuple leftTuple, } } - this.sink = sink; + setSink(sink); } public LeftTuple getNextParentWithHandle() { @@ -344,14 +344,14 @@ public int getIndex() { @Override public LeftTupleSink getTupleSink() { - return (LeftTupleSink)sink; + return (LeftTupleSink)getSink(); } /* Had to add the set method because sink adapters must override * the tuple sink set when the tuple was created. */ public void setLeftTupleSink( LeftTupleSink sink ) { - this.sink = sink; + setSink(sink); } public LeftTuple getLeftParent() { @@ -407,7 +407,7 @@ public FactHandle get(int index) { public FactHandle[] toFactHandles() { // always use the count of the node that created join (not the sink target) - FactHandle[] handles = new FactHandle[((LeftTupleSinkNode)sink).getLeftTupleSource().getObjectCount()]; + FactHandle[] handles = new FactHandle[((LeftTupleSinkNode)getSink()).getLeftTupleSource().getObjectCount()]; LeftTuple entry = (LeftTuple) skipEmptyHandles(); for(int i = handles.length-1; i >= 0; i--) { handles[i] = entry.getFactHandle(); @@ -418,7 +418,7 @@ public FactHandle[] toFactHandles() { public Object[] toObjects(boolean reverse) { // always use the count of the node that created join (not the sink target) - Object[] objs = new Object[((LeftTupleSinkNode)sink).getLeftTupleSource().getObjectCount()]; + Object[] objs = new Object[((LeftTupleSinkNode)getSink()).getLeftTupleSource().getObjectCount()]; LeftTuple entry = (LeftTuple) skipEmptyHandles(); if (!reverse) { @@ -601,8 +601,8 @@ protected String toExternalString() { } builder.append( Arrays.toString( ids ) ) .append( " sink=" ) - .append( this.sink.getClass().getSimpleName() ) - .append( "(" ).append( sink.getId() ).append( ")" ); + .append( this.getSink().getClass().getSimpleName() ) + .append( "(" ).append( getSink().getId() ).append( ")" ); return builder.toString(); } @@ -619,7 +619,7 @@ public void initPeer(LeftTuple original, LeftTupleSink sink) { setFactHandle( original.getFactHandle() ); setPropagationContext( original.getPropagationContext() ); - this.sink = sink; + setSink(sink); } @Override @@ -629,12 +629,12 @@ public Object getObject(int index) { @Override public ObjectTypeNode.Id getInputOtnId() { - return sink != null ? getTupleSink().getLeftInputOtnId() : null; + return getSink() != null ? getTupleSink().getLeftInputOtnId() : null; } @Override public LeftTupleSource getTupleSource() { - return sink != null ? getTupleSink().getLeftTupleSource() : null; + return getSink() != null ? getTupleSink().getLeftTupleSource() : null; } public short getStagedTypeForQueries() { diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java b/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java index 61b4eb7f2c2..a4e1321fd0d 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RightTupleImpl.java @@ -46,14 +46,14 @@ public RightTupleImpl(InternalFactHandle handle) { public RightTupleImpl(InternalFactHandle handle, RightTupleSink sink) { this( handle ); - this.sink = sink; + setSink(sink); // add to end of RightTuples on handle handle.addLastRightTuple( this ); } public RightTupleSink getTupleSink() { - return (RightTupleSink) sink; + return (RightTupleSink) getSink(); } public void reAdd() { @@ -71,7 +71,7 @@ public void unlinkFromRightParent() { this.memory = null; this.firstChild = null; this.lastChild = null; - this.sink = null; + setSink(null); } public void unlinkFromLeftParent() { @@ -249,7 +249,7 @@ public Tuple getSubTuple( int elements ) { @Override public ObjectTypeNode.Id getInputOtnId() { - return sink != null ? getTupleSink().getRightInputOtnId() : null; + return getSink() != null ? getTupleSink().getRightInputOtnId() : null; } @Override diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java index 5c1c822d74f..6008e01ed42 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNodeLeftTuple.java @@ -16,24 +16,19 @@ package org.drools.core.reteoo; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -import org.drools.core.common.ActivationGroupNode; -import org.drools.core.common.ActivationNode; -import org.drools.core.common.ActivationsManager; -import org.drools.core.common.InternalAgendaGroup; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.PropagationContext; import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.core.phreak.RuleAgendaItem; import org.drools.base.rule.Declaration; import org.drools.base.rule.consequence.Consequence; +import org.drools.core.common.*; +import org.drools.core.phreak.RuleAgendaItem; import org.drools.core.rule.consequence.InternalMatch; import org.kie.api.runtime.rule.FactHandle; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + public class RuleTerminalNodeLeftTuple extends LeftTuple implements InternalMatch { private static final long serialVersionUID = 540l; /** @@ -59,6 +54,8 @@ public class RuleTerminalNodeLeftTuple extends LeftTuple implements InternalMatc private Runnable callback; + private RuleImpl rule; + public RuleTerminalNodeLeftTuple() { // constructor needed for serialisation } @@ -133,18 +130,24 @@ public void update(final int salience, this.matched = true; } + @Override + protected void setSink(Sink sink) { + super.setSink(sink); + this.rule = getTerminalNode().getRule(); + } + /** * Retrieve the rule. * * @return The rule. */ public RuleImpl getRule() { - return getTerminalNode().getRule(); + return this.rule; } public Consequence getConsequence() { String consequenceName = ((RuleTerminalNode) getTerminalNode()).getConsequenceName(); - return consequenceName.equals(RuleImpl.DEFAULT_CONSEQUENCE_NAME) ? getTerminalNode().getRule().getConsequence() : getTerminalNode().getRule().getNamedConsequence(consequenceName); + return consequenceName.equals(RuleImpl.DEFAULT_CONSEQUENCE_NAME) ? getRule().getConsequence() : getRule().getNamedConsequence(consequenceName); } /** diff --git a/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java b/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java index 4fa9faa050c..471434396c8 100644 --- a/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java +++ b/drools-core/src/main/java/org/drools/core/reteoo/Tuple.java @@ -103,10 +103,6 @@ default boolean isDeleted() { void setMemory( TupleList memory ); - void increaseActivationCountForEvents(); - - void decreaseActivationCountForEvents(); - Tuple getRootTuple(); Tuple skipEmptyHandles(); diff --git a/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java b/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java index f0f22302a74..486fc3b7998 100644 --- a/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java +++ b/drools-kiesession/src/main/java/org/drools/kiesession/agenda/DefaultAgenda.java @@ -19,40 +19,14 @@ import org.drools.base.definitions.rule.impl.QueryImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.core.RuleBaseConfiguration; -import org.drools.core.common.ActivationGroupImpl; -import org.drools.core.common.ActivationGroupNode; -import org.drools.core.common.ActivationsFilter; -import org.drools.core.common.AgendaGroupsManager; -import org.drools.core.common.EventSupport; -import org.drools.core.common.InternalActivationGroup; -import org.drools.core.common.InternalAgenda; -import org.drools.core.common.InternalAgendaGroup; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.common.InternalRuleFlowGroup; -import org.drools.core.common.InternalWorkingMemory; -import org.drools.core.common.InternalWorkingMemoryEntryPoint; -import org.drools.core.common.PropagationContext; -import org.drools.core.common.ReteEvaluator; -import org.drools.core.common.RuleFlowGroup; -import org.drools.core.concurrent.ParallelGroupEvaluator; +import org.drools.core.common.*; import org.drools.core.concurrent.GroupEvaluator; +import org.drools.core.concurrent.ParallelGroupEvaluator; import org.drools.core.concurrent.SequentialGroupEvaluator; import org.drools.core.event.AgendaEventSupport; import org.drools.core.impl.InternalRuleBase; -import org.drools.core.phreak.ExecutableEntry; -import org.drools.core.phreak.PropagationEntry; -import org.drools.core.phreak.PropagationList; -import org.drools.core.phreak.RuleAgendaItem; -import org.drools.core.phreak.RuleExecutor; -import org.drools.core.phreak.SynchronizedBypassPropagationList; -import org.drools.core.phreak.SynchronizedPropagationList; -import org.drools.core.phreak.ThreadUnsafePropagationList; -import org.drools.core.reteoo.AgendaComponentFactory; -import org.drools.core.reteoo.ObjectTypeNode; -import org.drools.core.reteoo.PathMemory; -import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; -import org.drools.core.reteoo.TerminalNode; -import org.drools.core.reteoo.Tuple; +import org.drools.core.phreak.*; +import org.drools.core.reteoo.*; import org.drools.core.rule.consequence.ConsequenceExceptionHandler; import org.drools.core.rule.consequence.InternalMatch; import org.drools.core.rule.consequence.KnowledgeHelper; @@ -66,11 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; /** @@ -314,7 +284,6 @@ public void cancelActivation(final InternalMatch internalMatch) { if (internalMatch.getActivationGroupNode() != null ) { internalMatch.getActivationGroupNode().getActivationGroup().removeActivation(internalMatch); } - (( Tuple ) internalMatch).decreaseActivationCountForEvents(); workingMemory.getAgendaEventSupport().fireActivationCancelled(internalMatch, workingMemory, diff --git a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/ProtobufOutputMarshaller.java b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/ProtobufOutputMarshaller.java index 80ce7b5b3d1..f8ef5f73e4a 100644 --- a/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/ProtobufOutputMarshaller.java +++ b/drools-serialization-protobuf/src/main/java/org/drools/serialization/protobuf/ProtobufOutputMarshaller.java @@ -562,7 +562,6 @@ private static ProtobufMessages.FactHandle writeFactHandle( MarshallerWriteConte _handle.setTimestamp( efh.getStartTimestamp() ); _handle.setDuration( efh.getDuration() ); _handle.setIsExpired( efh.isExpired() ); - _handle.setActivationsCount( efh.getActivationsCount() ); _handle.setOtnCount( efh.getOtnCount() ); } diff --git a/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/FactHandleMarshallingTest.java b/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/FactHandleMarshallingTest.java index c974823d85e..d28618bcc85 100644 --- a/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/FactHandleMarshallingTest.java +++ b/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/FactHandleMarshallingTest.java @@ -143,12 +143,10 @@ private static InternalFactHandle readFactHandle( MarshallerReaderContext contex long startTimeStamp = 0; long duration = 0; boolean expired = false; - long activationsCount = 0; if (type == 2) { startTimeStamp = context.readLong(); duration = context.readLong(); expired = context.readBoolean(); - activationsCount = context.readLong(); } int strategyIndex = context.readInt(); @@ -212,7 +210,6 @@ else if (strategyIndex == -2) { handle = new DefaultEventHandle(id, object, recency, startTimeStamp, duration, (WorkingMemoryEntryPoint) entryPoint ); ( (DefaultEventHandle) handle ).setExpired(expired); - ( (DefaultEventHandle) handle ).setActivationsCount(activationsCount); break; } default: { diff --git a/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/OldOutputMarshallerMethods.java b/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/OldOutputMarshallerMethods.java index 65cbdcdc768..90552a34ebb 100644 --- a/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/OldOutputMarshallerMethods.java +++ b/drools-serialization-protobuf/src/test/java/org/drools/serialization/protobuf/OldOutputMarshallerMethods.java @@ -14,12 +14,6 @@ package org.drools.serialization.protobuf; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; - import org.drools.core.common.DefaultEventHandle; import org.drools.core.common.InternalFactHandle; import org.drools.core.marshalling.MarshallerWriteContext; @@ -27,6 +21,12 @@ import org.kie.api.marshalling.ObjectMarshallingStrategy; import org.kie.api.marshalling.ObjectMarshallingStrategyStore; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; + public class OldOutputMarshallerMethods { // Changed with JBRULES-3257 @@ -80,7 +80,6 @@ public static void writeFactHandle_v1(MarshallerWriteContext context, stream.writeLong( efh.getStartTimestamp() ); stream.writeLong( efh.getDuration() ); stream.writeBoolean( efh.isExpired() ); - stream.writeLong( efh.getActivationsCount() ); } //context.out.println( "Object : int:" + handle.getId() + " long:" + handle.getRecency() );