+

Search Tips   |   Advanced Search

Develop client code that calls EJB asynchronous methods

We can use the sample code within this topic to develop client code that calls EJB asynchronous methods.

This task assumes that the following interface and bean implementation classes exist:

public interface AcmeRemoteInterface {
   void fireAndForgetMethod ();
   Future<Integer> methodWithResults() throws AcmeException1, AcmeException2;
}
@Stateless
@Remote(AcmeRemoteInterface.class)
@Asynchronous
public class AcmeAsyncBean {
   public void fireAndForgetMethod () {
      // do non-critical work    }

   public Integer methodWithResults() {
      Integer result;
      // do work, and then return results
      return result;
   }
}


Subtopics


Related concepts

  • EJB 3.1 asynchronous methods
  • EJB container work manager for asynchronous methods
  • Bean implementation programming model for EJB asynchronous methods


    Related tasks

  • Configure EJB 3.1 session bean methods to be asynchronous