use of org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter 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(), config.getAlphaNodeRangeIndexThreshold()));
}
}
}
}
use of org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter in project drools by kiegroup.
the class ObjectTypeNodeParser method traversePropagator.
private void traversePropagator(ObjectSinkPropagator propagator, NetworkHandler handler) {
if (propagator instanceof SingleObjectSinkAdapter) {
// we know there is only a single child sink for this propagator
ObjectSink sink = propagator.getSinks()[0];
traverseSink(sink, handler);
} else if (propagator instanceof CompositeObjectSinkAdapter) {
CompositeObjectSinkAdapter composite = (CompositeObjectSinkAdapter) propagator;
if (traverseHashedAlphaNodes) {
traverseSinkList(composite.getRangeIndexableSinks(), handler);
traverseSinkList(composite.getHashableSinks(), handler);
traverseSinkList(composite.getOthers(), handler);
traverseRangeIndexedAlphaNodes(composite.getRangeIndexMap(), handler);
traverseHashedAlphaNodes(composite.getHashedSinkMap(), handler);
} else {
traverseSinkList(composite.getSinks(), handler);
}
} else if (propagator instanceof CompositePartitionAwareObjectSinkAdapter) {
CompositePartitionAwareObjectSinkAdapter composite = (CompositePartitionAwareObjectSinkAdapter) propagator;
traverseSinkList(composite.getSinks(), handler);
}
}
use of org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter 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);
}
}
}
use of org.drools.core.reteoo.CompositePartitionAwareObjectSinkAdapter 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);
}
}
}
Aggregations