Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.399 :

Posted: Mon Apr 25, 2011 3:13 pm
by ETS User
methodX doesnt define to throw Exception:


12.3.1Exceptions
Business method interceptor methods may throw runtime exceptions or application exceptions that are allowed in the throws clause of the business method.

AroundInvoke methods are allowed to catch and suppress exceptions and recover by calling proceed(). AroundInvoke methods are allowed to throw runtime exceptions or any checked exceptions that the business method allows within its throws clause.


does it mean, the Interceptor can declarate to throw an Exception but it may not really throw it????

if so, why is that??

Re: About Question enthuware.oce-ejbd.v6.2.399 :

Posted: Mon Apr 25, 2011 8:13 pm
by admin
Hello,
The question is not about exceptions and none of the options or problem statement refer to exceptions. Even so, as per Interceptors specification 1.1 , Around-invoke methods have the following signature:

Object <METHOD>(InvocationContext) throws Exception

So overall, I think the question and the given answer are correct.

HTH!

Re: About Question enthuware.oce-ejbd.v6.2.399 :

Posted: Sun Mar 02, 2014 8:28 am
by IndoKnight
Okay, I agree the output 1 2 is correct. I have an interesting scenario where during the passivate state, the bean instance can be destroyed because of @StatefulTimeout is expired(without calling @PostDestroy). So, the second line of code doesn't return a new instance of stateful session bean instance? In that case, the answer should be Either 1 1 or 1 2?