nerdexam
Oracle

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…

Session Beans

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 () { . . . }

How the community answered

(25 responses)
  • A
    16% (4)
  • B
    76% (19)
  • C
    4% (1)
  • D
    4% (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

#asynchronous methods#Future return type#remote business interface#@Asynchronous

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice