[jboss-jira] [JBoss JIRA] (DROOLS-580) Make lifecycle methods for KieSession available on KieContainer
Antoine Toulme (JIRA)
issues at jboss.org
Tue Aug 26 18:06:59 EDT 2014
Antoine Toulme created DROOLS-580:
-------------------------------------
Summary: Make lifecycle methods for KieSession available on KieContainer
Key: DROOLS-580
URL: https://issues.jboss.org/browse/DROOLS-580
Project: Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Affects Versions: 6.1.0.Final
Reporter: Antoine Toulme
Assignee: Mark Proctor
There are a few nice methods on KieContainerImpl that should be exposed on KieContainer, relating to getting existing KieSession objects that are cached in the KieContainer.
We had a short discussion about this on IRC on 8/26.
tmio: hi, I am looking at KieContainerImpl and the method getKieSession(String). It looks like a method I’d like to use in my application to retrieve and reuse consistently a session. Is there a reason why this method is not available on the interface KieContainer? Is it a bad idea to use this method?
[1:56pm] tmio: on top of that this method lazily creates the session - really cool
[1:58pm] tmio: conan: any feedback or advice?
[2:01pm] karstensrage left the chat room. (Ping timeout: 240 seconds)
[2:02pm] psingaram joined the chat room.
[2:07pm] mattd left the chat room. (Ping timeout: 255 seconds)
[2:07pm] karstensrage joined the chat room.
[2:11pm] sbryzak left the chat room. (Ping timeout: 260 seconds)
[2:31pm] conan: tmio I suspect it's not exposed
[2:31pm] conan: as it would then involve having to do caching
[2:31pm] tmio: conan: yes it’s not exposed
[2:32pm] tmio: not sure what you mean by caching? You mean the hashmap there on the KieContainerImpl?:
[2:32pm] tmio: you don’t want this to be exposed?
[2:32pm] conan: actually it looks like all get() does
[2:32pm] conan: is create a new one anyway
[2:32pm] tmio: Would you like me to do the caching myself instead?
[2:32pm] tmio: (doing the caching myself will bring complexity in my app)
[2:32pm] conan: hm no it does cache
[2:32pm] conan: tbh I don't know why we have that there
[2:32pm] conan: etirelli ^
[2:33pm] tmio: ok
[2:33pm] conan: originally we were avoiding keeping references to sessions
[2:33pm] conan: as then you have to deal with life cycles, gc, etc
[2:33pm] tmio: conan: that’s fine, yes indeed
[2:33pm] tmio: I mean, I could keep the session around myself and manage its lifecycle
[2:33pm] tmio: or maybe use CDI
[2:33pm] conan: some how that sneaked in
[2:33pm] conan: not sure why it's used
[2:34pm] Gazzonyx left the chat room. (Ping timeout: 260 seconds)
[2:34pm] tmio: Is it a CDI by product?
[2:34pm] conan: no
[2:35pm] conan: mario did it
[2:35pm] conan: not sure why
[2:35pm] conan: you'll need to ask him tomrrow
[2:35pm] tmio: what’s his nick?
[2:36pm] conan: mfusco
[2:36pm] conan: mf|away right now
[2:37pm] etirelli: reading
[2:38pm] tmio: conan: thx
[2:41pm] hguerrer left the chat room. (Ping timeout: 245 seconds)
[2:47pm] tmio: etirelli: should I wait for Mario or do you know what is happening here?
[2:49pm] etirelli: sorry, mom
[2:54pm] etirelli: tmio: ok, in the beginning we did not had lifecycle management for it, so it was not exposed... looking at the code I believe Mario implemented the lifecycle management
[2:54pm] etirelli: but did not expose the method
[2:55pm] etirelli: tmio: my suggestion: please open a JIRA to request the method be moved to the public API... we can do it for 6.2 in a few weeks... meanwhile, you can downcast to InternalKieBase and use it
[2:57pm] tmio: etirelli: so it’s safe to rely on this?
[2:59pm] etirelli: tmio: yes, when we moved to version 6, we made all methods internal and left just a minimal API as public... we wanted to avoid over polluted public API... unfortunately in the process, we left some methods private that could be public
[2:59pm] tmio: etirelli: ok got it. Will open jira now.
[3:00pm] tmio: etirelli: out of curiosity, will you make this part of KieContainer interface or will you create a new interface for lifecycle?
[3:01pm] etirelli: tmio: KieContainer.. the lifecycle is managed behind the scenes... when you call dispose() on the stateful session, it eventually removes it from the cache
[3:01pm] psingaram left the chat room. (Quit: Leaving)
[3:02pm] tmio: etirelli: last one - do you want this as bug or feature request?
[3:02pm] etirelli: feature request or task
[3:04pm] etirelli: tmio: BTW, be aware that there can only be one named session per container... if you call newKieSession() it overrides the previous one...
[3:04pm] tmio: etirelli: I found that out quickly
[3:04pm] tmio: etirelli: but then I was unable to retrieve the current one instead of getting a new one, so I started looking in the code
[3:04pm] tmio: there was definitely something going on
[3:04pm] psiroky left the chat room. (Quit: Leaving.)
[3:05pm] etirelli: conan: this is something that actually is problematic... but not sure we can fix... if the user calls newKieSession() without disposing the previous one, it will leak...
[3:05pm] etirelli: but not much we can do
[3:06pm] etirelli: the user has to call dispose() when he is done with a stateful session
[3:06pm] tmio: etirelli: if you start by providing methods to retrieve current sessions, we can start doing the right things.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
More information about the jboss-jira
mailing list