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

Moderator: admin

Post Reply
ETS User

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

Post 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??

admin
Site Admin
Posts: 10061
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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!
If you like our products and services, please help us by posting your review here.

IndoKnight
Posts: 9
Joined: Thu Feb 27, 2014 11:47 am
Contact:

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

Post 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?

Post Reply

Who is online

Users browsing this forum: No registered users and 94 guests