The life cycle of the command service is under user control, so you can decide
yourself when to create / dispose a command service. A possible use case would
be to create the service once and let it handle all requests and only dispose
if you want to take it down. You are apparently creating one session per
process instance, and disposing it after the process instance has been
completed, which is also possible if that is what you want. So the question on
when to dispose a session is more about how long you would like to reuse the
session. Note that creating a new session from an existing rulebase is
light-weight, so you shouldn't be too afraid from creating multiple session and
disposing once in a while.
Kris
----- Original Message -----
From: Michal Bali
To: Rules Users List
Sent: Tuesday, December 02, 2008 10:24 PM
Subject: Re: [rules-users] Proper termination of a CommandService
Thank you Kris ! That is perfect.
I was a bit worried If I was asking wrong questions, since I wasn't getting
any answers.
I have a follow up question though :)
I have an asynchronous ruleflow (by asynchronous I mean ruleflow that has
some asynchronous nodes like a human task). Would it be OK to register a
afterRuleFlowCompleted RuleFlowEventListener and dispose the session (that
contains an instance of this asynchronous ruleflow) there? What is the
recommended way to dispose this session? I guess same questions applies to a
CommandService (where is the best place to call commandService.dispose()
method?).
Best Regards,
Michal
On Tue, Dec 2, 2008 at 4:31 PM, Kris Verlaenen <[EMAIL PROTECTED]> wrote:
Michal,
I'll add a dispose method to the SingleSessionCommandService. Don't think
using a command for this would be a good idea as it would leave the session in
a disposed state so future commands would fail.
Regarding your earlier question, SingleSessionCommandService now also has
constructors that allow you to pass in a PlaceholderResolverStrategyFactory.
Kris
----- Original Message -----
From: Michal Bali
To: Rules Users List
Sent: Tuesday, December 02, 2008 1:24 AM
Subject: [rules-users] Proper termination of a CommandService
Hello,
Let's say I have some implementation of a CommandService (for example
StatefulSessionCommandService). After I finish working with this
CommandService, I want to correctly 'destroy' this object. Since it contains a
stateful rule session, I believe this session needs to be disposed. What is the
right way to do it?
I was thinking about implementing a DisposeCommand that will simply call
session.dispose() in its execute method. Is this a valid solution?
Best Regards,
Michal
--------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users
------------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users