更新时间:2023-12-03 15:55:52
也许***说(有状态的)KieSession和StatelessKieSessions都为基于类AbstractRuntime的类提供API(接口)。
Perhaps it would be better to say that both (stateful) KieSession and StatelessKieSessions provide APIs (interfaces) to classes based on class AbstractRuntime.
StatelessKieSession提供了一个接口,用于通过单个 execute
方法调用来执行一组命令,这些命令表示为一组对象。如果要将命令发送到远程会话,则很有用(但如果在应用程序中运行会话,则不需要)。同样,这样的会话将不会对工作内存中所做的更改做出反应,因此尽管它可能比有状态会话执行第一轮也是唯一一轮,但它的作用是有限的。
A StatelessKieSession provides an interface for executing a set of commands via a single execute
method call, commands being represented as a set of objects. This is useful if you want to send commands to a remote session (but not if you run the session within your application). Also, such a session will not react to changes done within Working Memory, so its usefulness is limited, although it might perform the first and only round more efficient than a stateful session.
执行
调用意味着 dispose
调用,这是对会话对象的最后告别:将所有资源释放到
An execute
call implies a dispose
call, which is the final goodbye to the session object: release all resources into garbage collection.
总结(在Drools文档中有完整描述)
To summarize (what is described in full in the Drools documentation)
不要担心好处 (如果您打算使用简单的应用程序界面:只需使用有状态会话即可。
Don't worry about "benefits" if you are planning for a simple application interface: just use a stateful session.