users@jersey.java.net

[Jersey] Problems with AsyncResponse in GF 4

From: Jan Algermissen <jan.algermissen_at_nordsc.com>
Date: Sat, 20 Oct 2012 10:45:20 +0200

Hi,

I am trying out Jersey 2 in Glassfish 4 (b58) and experience some problems.

The first of the methods below works as expected, the second invokes an
EJB's asynchronous getSlow() method and crashes right after the 'Enter async2' log.

Am I doing anything wrong or could that be a bug?


        @GET
        @Path("async1")
        @Asynchronous
        public void getAsync1(@Suspended AsyncResponse ar) {
                LOG.info("Enter async1");
                ar.resume("Async1 - OK");
                LOG.info("Exit async1");
        }
        
        @GET
        @Path("async2")
        public void getAsync2(@Suspended AsyncResponse ar) {
                LOG.info("Enter async2");
                test.getSlow(ar);
                LOG.info("Exit async2");
        }

---------------------------------------------

@Stateless
public class Test {
        private static Logger LOG = Logger.getLogger(Test.class.getName());
        @Asynchronous
        @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) // Tried with and without the 'new tx'
        public void getSlow(AsyncResponse ar) {
                LOG.info("Enter");
                ar.resume("Async2 - OK");
                LOG.info("Exit");
        }
}


Jan