4 Replies Latest reply on Apr 12, 2007 2:16 PM by peterj

    Pooling pojos

    peterj

      I appears that when using a POJO endpoint that the POJO is instantiated each time a web method is called. I looked around for a way to define a pool for the POJO, but could not find one. I would have thought that POJO endpoints would be pooled automatically much the same way servlets and EJBs are pooled. Is there as way to pool POJO endpoints, or should I look into some other mechanism?

        • 1. Re: Pooling pojos
          jason.greene

          Currently the only way you get pooling is with EJB3. The POJO model currently allocates an instance per request. This should be improved to reuse the same instance across multiple requests like the servlet container.

          While we could add pooling to the POJO model, it would only be relevant for endpoints that implement SingleThreadModel, since otherwise they are supposed to be written to handle concurrent requests.

          -Jason

          • 2. Re: Pooling pojos
            peterj

            I guess I really didn't mean pooling, but rather what is done with servlets, with only one being instantiated. Of course, you would also want to provide for init() and destroy() methods, just like servlets have, though probably identified via annotation.

            • 3. Re: Pooling pojos
              thomas.diesler

              This has been a long outstanding feature request.

              http://jira.jboss.org/jira/browse/JBWS-1603

              BTW, this is a nice little task for a community contribution.

              • 4. Re: Pooling pojos
                peterj

                Hmm, I would have to research how this is done in Tomcat (or now, JBoss Web Server) for servlets. And even provide some kind of init() and destroy() capability. Sounds like a challenge. If no-one else picks it up soon I just might work on this (I am a little swamped for the next week or so).