LeftTupleSink sink,
InternalWorkingMemory wm,
LeftTupleSets srcLeftTuples,
LeftTupleSets trgLeftTuples,
LeftTupleSets stagedLeftTuples) {
TimerService timerService = wm.getTimerService();
LeftTupleList leftTuples = tm.getInsertOrUpdateLeftTuples();
synchronized ( leftTuples ) {
LeftTupleList deletes = tm.getDeleteLeftTuples();
if ( !deletes.isEmpty() ) {
for ( LeftTuple leftTuple = deletes.getFirst(); leftTuple != null; ) {
LeftTuple next = (LeftTuple) leftTuple.getNext();
srcLeftTuples.addDelete( leftTuple );
if ( log.isTraceEnabled() ) {
log.trace( "Timer Add Postponed Delete {}", leftTuple );
}
leftTuple.clear();
leftTuple = next;
}
deletes.clear();
}
for ( LeftTuple leftTuple = srcLeftTuples.getDeleteFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
DefaultJobHandle jobHandle = (DefaultJobHandle) leftTuple.getObject();
if ( jobHandle != null ) {
// jobHandle can be null, if the time fired straight away, and never ended up scheduling a job
timerService.removeJob( jobHandle );
}
org.drools.core.spi.PropagationContext pctx = leftTuple.getPropagationContext();
pctx = RuleTerminalNode.findMostRecentPropagationContext( leftTuple, pctx );