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

Moderator: admin

Post Reply
Jofen
Posts: 9
Joined: Mon Oct 08, 2012 10:09 am
Contact:

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

Post by Jofen »

In the explaination,
"Also remember that if the asynchronous method has return type void, any exception thrown by the bean method code never reaches the caller. The client may still get EJBException because of other issues such a bean or server not available."

I would say even if the asynchronous method has return type Futere<T>, and throws any application exceptions, the client still would not get these exceptions until called Future.get().

Am I correct?

Thanks.

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

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

Post by admin »

Jofen wrote:In the explaination,
"Also remember that if the asynchronous method has return type void, any exception thrown by the bean method code never reaches the caller. The client may still get EJBException because of other issues such a bean or server not available."

I would say even if the asynchronous method has return type Futere<T>, and throws any application exceptions, the client still would not get these exceptions until called Future.get().

Am I correct?

Thanks.
Yes, the difference is that in case of void return type, there is no possibility of doing Future.get() either and for this reason asynchronous methods with void return type are not allowed to throw any application exceptions.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

vinkjrwl
Posts: 7
Joined: Sat Feb 08, 2014 8:30 pm
Contact:

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

Post by vinkjrwl »

Can you please help with some reference documentation to understand this behavior better?

Thanks,
vinay

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

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

Post by admin »

You may check out Section 4.5.2 - Method Requirements
The client return type of an asynchronous method is either void or java.util.concurrent.Future<V>, where V is the result value type.
An asynchronous method with return type void must not declare any application exceptions.An asynchronous method with return type Future<V> is permitted to declare application exceptions.
If you like our products and services, please help us by posting your review here.

andreiribas
Posts: 5
Joined: Wed Jul 18, 2012 9:02 am
Contact:

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

Post by andreiribas »

Hi,

About this question, if the client is accessing a remote session bean, shouldn't it get a RemoteException?

I know that void asynchronous methods cannot throw checked exceptions like RemoteException, so it could only throw System exceptions.

But will the system exception be converted in a remote exception by the container, being rethrown to the client?

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

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

Post by admin »

No, there is no way for the client to get the exception because for the client, the method call returns immediately. If the method implementation throws an exception, the client will not be aware of it.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 66 guests