【发布时间】:2016-04-18 17:33:07
【问题描述】:
我们正在开发一个监控应用程序,在该应用程序中我们跟踪一组应用程序中任务的处理。 我们有一组符合我们需求的 drools 规则,但我们有一些性能问题(我们可能很容易在会话中拥有多达 50k 个对象)。 我们正在寻找最佳协议
这个问题是关于 bloolean 标志的使用。
我们正在努力删除大部分 org.drools.core.rule.constraint.MvelConstraint: Exception jitting: ... 警告。
我们经常对布尔标志发出这样的警告。
例如在:
rule "PropagateDeprecation"
when
$parent:BaseChainStep( $parent.Deprecated )
$child:BaseChainStep( $parent.Id == $child.Parent, !$child.Deprecated )
then
modify($child){
setDeprecated(true)
}
end
我们对 $parent.Deprecated 和 !$child.Deprecated 都发出警告。
我们想了解为什么在布尔标志上会有这样的警告。
我们还想知道警告对组合条件的影响。 例如在:
rule "App1_TriggerExpected"
when $chainStep:App1ChainStep(
HasChain
, HasParent
, !$chainStep.Deprecated
, Status in ("error", "closed")
, Places != null
, Analysis != null)
then
..
end
如果我们在第一个条件HasChain 上有警告,如何解决when 子句?
是否也评估其他条件(对所有 App1ChainStep 对象进行迭代)或仍然使用某些“索引”来提供帮助?
如果有问题,我们使用标志作为布尔值(而不是布尔值)来确保默认值为 false。
编辑:
问题可能与扩展类有关。在我们的用例中,我们有类似的东西:
declare BaseChainStep
parent : GUID
deprecated : boolean
end
declare App1ChainStep extends BaseChainStep
// specific App1 fields
end
BaseChainStep 字段可以在规则中使用 App1ChainStep 对象或 BaseChainStep 对象进行操作。
rule "deprecateApp1"
when $app1:App1ChainStep( BusinessLogicCondition )
then
modify($app1) {
setDeprecated(true)
}
end
然后使用“PropagateDeprecation”规则将弃用标志传播到 App1 子项。
导致警告的布尔标志在 BaseChainStep 类中声明。
【问题讨论】:
标签: drools