1Z0-895 · Question #41
A bean developer wants to write a stateless session bean class that implements the following remote business interface: @Remote Public interface Foo { Void bar () throws Exception; Which bean class…
The correct answer is B. @AsynchronousFuture <void> bar () { . . .}. with EJB 3.1, you can use a simple session EJB with the @Asynchronous annotation on the method which must be called asynchronously. @Remote(HelloEjbAsynchronousRemote.class) public class HelloEjbAsynchronous implements HelloEjbAsynchronousRemote { @Asynchronous public…
Question
Options
- A@Asynchronous public void bar () throws Exception { . . . }
- B@AsynchronousFuture <void> bar () { . . .}
- Cvoid bar () throws Exception { . . . }
- Dpublic void bar () { . . . }
How the community answered
(25 responses)- A16% (4)
- B76% (19)
- C4% (1)
- D4% (1)
Explanation
with EJB 3.1, you can use a simple session EJB with the @Asynchronous annotation on the method which must be called asynchronously. @Remote(HelloEjbAsynchronousRemote.class) public class HelloEjbAsynchronous implements HelloEjbAsynchronousRemote { @Asynchronous public Future<String> ejbAsynchronousSayHello(String name){ If your method has a return value, your method has to return an AsyncResult object which is an implementation of Future.
Topics
Community Discussion
No community discussion yet for this question.