Search in sources :

Example 1 with ObjectSinkPropagator

use of org.drools.core.reteoo.ObjectSinkPropagator in project drools by kiegroup.

the class KnowledgeBaseImpl method disableMultithreadEvaluation.

private void disableMultithreadEvaluation(String warningMessage) {
    config.enforceSingleThreadEvaluation();
    logger.warn(warningMessage);
    for (EntryPointNode entryPointNode : rete.getEntryPointNodes().values()) {
        entryPointNode.setPartitionsEnabled(false);
        for (ObjectTypeNode otn : entryPointNode.getObjectTypeNodes().values()) {
            ObjectSinkPropagator sink = otn.getObjectSinkPropagator();
            if (sink instanceof CompositePartitionAwareObjectSinkAdapter) {
                otn.setObjectSinkPropagator(((CompositePartitionAwareObjectSinkAdapter) sink).asNonPartitionedSinkPropagator(config.getAlphaNodeHashingThreshold()));
            }
        }
    }
}
Also used : EntryPointNode(org.drools.core.reteoo.EntryPointNode) CompositePartitionAwareObjectSinkAdapter(org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter) ObjectSinkPropagator(org.drools.core.reteoo.ObjectSinkPropagator) ObjectTypeNode(org.drools.core.reteoo.ObjectTypeNode)

Example 2 with ObjectSinkPropagator

use of org.drools.core.reteoo.ObjectSinkPropagator in project drools by kiegroup.

the class NodesPartitioningTest method checkPartitionedSinks.

private void checkPartitionedSinks(ObjectTypeNode otn) {
    if (InitialFact.class.isAssignableFrom(((ClassObjectType) otn.getObjectType()).getClassType())) {
        return;
    }
    ObjectSinkPropagator sinkPropagator = otn.getObjectSinkPropagator();
    ObjectSinkPropagator[] propagators = sinkPropagator instanceof CompositePartitionAwareObjectSinkAdapter ? ((CompositePartitionAwareObjectSinkAdapter) sinkPropagator).getPartitionedPropagators() : new ObjectSinkPropagator[] { sinkPropagator };
    for (int i = 0; i < propagators.length; i++) {
        for (ObjectSink sink : propagators[i].getSinks()) {
            assertEquals(sink + " on " + sink.getPartitionId() + " is expcted to be on propagator " + i, i, sink.getPartitionId().getId() % propagators.length);
        }
    }
}
Also used : CompositePartitionAwareObjectSinkAdapter(org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter) ObjectSinkPropagator(org.drools.core.reteoo.ObjectSinkPropagator) ObjectSink(org.drools.core.reteoo.ObjectSink)

Aggregations

CompositePartitionAwareObjectSinkAdapter (org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter)2 ObjectSinkPropagator (org.drools.core.reteoo.ObjectSinkPropagator)2 EntryPointNode (org.drools.core.reteoo.EntryPointNode)1 ObjectSink (org.drools.core.reteoo.ObjectSink)1 ObjectTypeNode (org.drools.core.reteoo.ObjectTypeNode)1