Hello,

I was looking at Jira OpenEJB-976 [1], the bean pool leak issue when a
RuntimeException is thrown during txPolicy.commit(). (See *StatelessContainer
# invoke()* method)
Currently there are a lot of places where we do *discardInstance *and
*poolInstance.
*It will be a nice idea to refactor this a bit to make the post-Invoke pool
management at a single place - The ideal place being the *finally *block in
the container's *invoke() *method, just before
*ThreadContext.exit(oldCallContext).
*

For this to happen, we would have to add a state to callContext
(ThreadContext), something like - "boolean discardInstance". This boolean
could be set to false whenever an exception occurs during the call flow. At
the end of the call, depending on this boolen we take a decision to add the
instance back to pool or to discard it. If people are okay, I am ready to
submit a patch.

Thanks,
Bharath



[1] http://issues.apache.org/jira/browse/OPENEJB-976

Reply via email to