use of org.drools.core.reteoo.EntryPointNode in project drools by kiegroup.
the class SegmentUtilities method getQueryOtn.
private static ObjectTypeNode getQueryOtn(LeftTupleSource lts) {
while (!(lts instanceof LeftInputAdapterNode)) {
lts = lts.getLeftTupleSource();
}
LeftInputAdapterNode liaNode = (LeftInputAdapterNode) lts;
ObjectSource os = liaNode.getObjectSource();
while (!(os instanceof EntryPointNode)) {
os = os.getParentObjectSource();
}
return ((EntryPointNode) os).getQueryNode();
}
use of org.drools.core.reteoo.EntryPointNode in project drools by kiegroup.
the class KnowledgeBaseMonitoring method startInternalMBeans.
public void startInternalMBeans() {
for (EntryPointNode epn : kbase.getRete().getEntryPointNodes().values()) {
for (ObjectTypeNode otn : epn.getObjectTypeNodes().values()) {
ObjectTypeNodeMonitor otnm = new ObjectTypeNodeMonitor(otn);
try {
final StandardMBean adapter = new StandardMBean(otnm, ObjectTypeNodeMonitorMBean.class);
ObjectName name = DroolsManagementAgent.createObjectName(this.name.toString() + ",group=EntryPoints,EntryPoint=" + otnm.getNameSufix() + ",ObjectType=" + ((ClassObjectType) otn.getObjectType()).getClassName());
DroolsManagementAgent.getInstance().registerMBean(kbase, adapter, name);
} catch (NotCompliantMBeanException e) {
logger.error("Unable to register ObjectTypeNodeMonitor mbean for OTN " + otn.getObjectType() + " into the platform MBean Server", e);
}
}
}
final KieBaseConfigurationMonitor kbcm = new KieBaseConfigurationMonitor(kbase.getConfiguration());
try {
final StandardMBean adapter = new StandardMBean(kbcm, KieBaseConfigurationMonitorMBean.class);
ObjectName name = DroolsManagementAgent.createObjectName(this.name.toString() + ",group=Configuration");
DroolsManagementAgent.getInstance().registerMBean(kbase, adapter, name);
} catch (NotCompliantMBeanException e) {
logger.error("Unable to register KBaseConfigurationMonitor mbean into the platform MBean Server", e);
}
}
use of org.drools.core.reteoo.EntryPointNode 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()));
}
}
}
}
use of org.drools.core.reteoo.EntryPointNode in project drools by kiegroup.
the class KnowledgeBaseImpl method setupRete.
protected void setupRete() {
this.rete = new Rete(this);
this.reteooBuilder = new ReteooBuilder(this);
NodeFactory nodeFactory = kieComponentFactory.getNodeFactoryService();
// always add the default entry point
EntryPointNode epn = nodeFactory.buildEntryPointNode(this.reteooBuilder.getIdGenerator().getNextId(), RuleBasePartitionId.MAIN_PARTITION, this.getConfiguration().isMultithreadEvaluation(), this.rete, EntryPointId.DEFAULT);
epn.attach();
BuildContext context = new BuildContext(this);
context.setCurrentEntryPoint(epn.getEntryPoint());
context.setTupleMemoryEnabled(true);
context.setObjectTypeNodeMemoryEnabled(true);
context.setPartitionId(RuleBasePartitionId.MAIN_PARTITION);
ObjectTypeNode otn = nodeFactory.buildObjectTypeNode(this.reteooBuilder.getIdGenerator().getNextId(), epn, ClassObjectType.InitialFact_ObjectType, context);
otn.attach(context);
}
use of org.drools.core.reteoo.EntryPointNode in project drools by kiegroup.
the class IncrementalCompilationTest method testRemoveRuleWithRia.
@Test
public void testRemoveRuleWithRia() throws Exception {
// DROOLS-954
String drl1 = "import " + List.class.getCanonicalName() + "\n" + "rule R when\n" + " $list : List()\n" + " exists Integer( this == 1 ) from $list\n" + " exists Integer( this == 2 ) from $list\n" + "then \n" + "end\n";
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId1 = ks.newReleaseId("org.kie", "test-upgrade", "1.1.1");
KieModule km = createAndDeployJar(ks, releaseId1, drl1);
KieContainer kc = ks.newKieContainer(km.getReleaseId());
KieSession ksession = kc.newKieSession();
ReleaseId releaseId2 = ks.newReleaseId("org.kie", "test-upgrade", "1.1.2");
km = createAndDeployJar(ks, releaseId2);
kc.updateToVersion(releaseId2);
Rete rete = ((InternalKnowledgeBase) (InternalKnowledgeBase) ksession.getKieBase()).getRete();
EntryPointNode entryPointNode = rete.getEntryPointNodes().values().iterator().next();
for (ObjectTypeNode otns : entryPointNode.getObjectTypeNodes().values()) {
assertEquals(0, otns.getObjectSinkPropagator().getSinks().length);
}
}
Aggregations