1 Reply Latest reply on Aug 8, 2012 6:35 PM by kwatsen

    EJB asynchronous method


      I'm using JBoss 7.1.1 final. I have a stateful EJB with an asynchronous method. From a jsp I call a synchronous method of the previous EJB and this method call the asynchronous one of the same EJB via proxy.


      public class ExcursionDAOWithPrefetch implements IExcursionDAOWithPrefetch {
      @Resource SessionContext ctx;
      @EJB(lookup=...) IExcursionDAO excursionDAO;


      public Excursion findExcursionById(int id, boolean loadCoordinates) {
      // Retrieve from cache
      Excursion excursion = cache.getExcursionById(id);
      if(excursion == null) {
      // Retrieve from database
      = excursionDAO.findExcursionById(id, loadCoordinates);
      .info("excursion not in cache");
      else {
      .info("excursion in cache");

      return excursion;

      public void loadCache(Excursion excursion) {     
      if(excursion != null) {
      List<Excursion> closeExcursions = excursionDAO.findCloseExcursions(excursion, 10);
      if(closeExcursions != null) {
      for(Excursion exc : closeExcursions) {


      EDIT: if I make ExcursionWithDAOPrefetch stateless, the asynchronous method loadCache() works asynchronously; when ExcursionWithDAOPrefetch is stateful, the loadCache() method works synchronously.


      loadCache() method is executed asynchronously but the jsp awaits its end even though it calls findExcursionById() method (and not loadCache()).

      Can someone help me?


      Message was edited by: maverik87