users@ejb-spec.java.net

[ejb-spec users] [jsr345-experts] enabling bean-level retainIfException?

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 13 Dec 2012 14:21:33 -0800

Experts,

I was looking at comments for http://java.net/jira/browse/EJB_SPEC-24
and one of the issues listed is that a SFSB is destroyed by the
container if a business method throws a system exception (see section
"4.6.3Dealing with Exceptions" in the latest version of the spec). I
have seen many questions from the users that are surprised by one of
the NoSuchXXXExceptions. It can also be an issue if a SFSB can be used
as a websocket endpoint (I'm discussing with the websockets spec lead if
it's possible).

We can easily solve this problem by adding a global 'retainIfException'
flag as an attribute on a @Stateful annotation (and a corresponding DD).
If added, the default will be false for backward compatibility, and the
@Remove(retainIfException) will override the bean level setting, if any.

Please vote yes/no on the following 3 items:

1) we should add the bean-level retainIfException flag to SFSB

2) if added, the flag should apply to the business methods only (I think
so - only PrePassivate might be considered, but it would make everything
too complicated, and we've already added passivationCapable=false to
avoid passivation altogether)

3) if you agree with 2), should the flag be called
'retainIfBusinessMethodException' to avoid confusion?

thanks,
-marina