nerdexam
Oracle

1Z0-895 · Question #41

1Z0-895 Question #41: Real Exam Question with Answer & Explanation

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 Future<Stri

Question

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 method is valid?

Options

  • A@Asynchronous public void bar () throws Exception { . . . }
  • B@AsynchronousFuture <void> bar () { . . .}
  • Cvoid bar () throws Exception { . . . }
  • Dpublic void bar () { . . . }

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.

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice