private void addToCreatedHandlesMap(final Map<Object, RightTuple> matches, final RightTuple rightTuple) { if ( rightTuple.getFactHandle().isValid() ) { Object object = rightTuple.getFactHandle().getObject(); // keeping a list of matches RightTuple existingMatch = matches.get( object ); if ( existingMatch != null ) { // this is for the obscene case where two or more objects returned by "from" // have the same hash code and evaluate equals() to true, so we need to preserve // all of them to avoid leaks rightTuple.setNext( existingMatch ); } matches.put( object, rightTuple ); } }
if ( handle instanceof InternalFactHandle ) { final InternalFactHandle handleImpl = (InternalFactHandle) handle; if ( ! handleImpl.isValid() ) {
public static DisconnectedFactHandle newFrom( FactHandle handle ) { if( handle instanceof DisconnectedFactHandle ) { return (DisconnectedFactHandle) handle; } else { InternalFactHandle ifh = (InternalFactHandle) handle; return new DisconnectedFactHandle(ifh.getId(), ifh.getIdentityHashCode(), ifh.getObjectHashCode(), ifh.getRecency(), ifh.getEntryPoint() != null ? ifh.getEntryPoint().getEntryPointId() : null, null, ifh.isValid(), ifh.isTraitOrTraitable() ); } }
public void execute(InternalWorkingMemory workingMemory) { if ( this.factHandle.isValid() ) { EventFactHandle eventHandle = (EventFactHandle) factHandle; if ( eventHandle.hasPendingActions() ) { workingMemory.queueWorkingMemoryAction( this ); return; } // if the fact is still in the working memory (since it may have been previously retracted already final PropagationContext context = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.EXPIRATION, null, null, this.factHandle ); eventHandle.setExpired( true ); this.node.retractObject( factHandle, context, workingMemory ); context.evaluateActionQueue( workingMemory ); // if no activations for this expired event if ( eventHandle.getActivationsCount() == 0 ) { // remove it from the object store and clean up resources eventHandle.getEntryPoint().retract( factHandle ); } context.evaluateActionQueue( workingMemory ); } }
if ( ! handle.isValid() ) {
if ( ! handle.isValid() || object == null || (handle.isEvent() && ((EventFactHandle) handle).isExpired()) ) {