if ( activation != null ) {
// release resources so that they can be GC'ed
activation.getPropagationContext().releaseResources();
}
final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
PropagationContext.DELETION,
rule,
(activation == null) ? null : activation.getTuple(),
handle,
this.wm.agenda.getActiveActivations(),
this.wm.agenda.getDormantActivations(),
this.entryPoint );
this.entryPointNode.retractObject( handle,
propagationContext,
typeConf,
this.wm );
if ( typeConf.isTMSEnabled() ) {
TruthMaintenanceSystem tms = getTruthMaintenanceSystem();
// TMS.removeLogicalDependency also cleans up Handles from the EqualityKey
// This can happen on the logical retraction of the last FH, where it's cleaned up in the TMS and also in the main network.
// However when the user retracts the FH to a logical set of insertions, then we need to clean up the TMS here.
// Update the equality key, which maintains a list of stated FactHandles
final EqualityKey key = handle.getEqualityKey();
// Its justified so attempt to remove any logical dependencies for the handle
if ( key.getStatus() == EqualityKey.JUSTIFIED ) {
TruthMaintenanceSystemHelper.removeLogicalDependencies( handle, propagationContext );
}
key.removeFactHandle( handle );
handle.setEqualityKey( null );
// If the equality key is now empty, then remove it
if ( key.isEmpty() ) {
tms.remove( key );
}
}
propagationContext.evaluateActionQueue( this.wm );
this.wm.workingMemoryEventSupport.fireObjectRetracted( propagationContext,
handle,
object,