Page 1 of 1
Re: About Question enthuware.oce-ejbd.v6.2.408 :
Posted: Sat Oct 13, 2012 6:04 pm
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.
Re: About Question enthuware.oce-ejbd.v6.2.408 :
Posted: Sat Oct 13, 2012 6:30 pm
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.
Re: About Question enthuware.oce-ejbd.v6.2.408 :
Posted: Sat Feb 08, 2014 9:33 pm
by vinkjrwl
Can you please help with some reference documentation to understand this behavior better?
Thanks,
vinay
Re: About Question enthuware.oce-ejbd.v6.2.408 :
Posted: Sat Feb 08, 2014 10:02 pm
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.
Re: About Question enthuware.oce-ejbd.v6.2.408 :
Posted: Wed Mar 19, 2014 7:45 am
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?
Re: About Question enthuware.oce-ejbd.v6.2.408 :
Posted: Wed Mar 19, 2014 8:25 am
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.