[jboss-user] [JBoss Web Services] - How to implement long polling/server push with JBoss

Alexander Bätz do-not-reply at jboss.com
Thu Oct 21 12:07:22 EDT 2010

laures [http://community.jboss.org/people/laures] created the discussion

"How to implement long polling/server push with JBoss"

To view the discussion, visit: http://community.jboss.org/message/567706#567706


i want to use http server push / long polling / whatever its called right now, in my next webservice.

one way (a very bad, non scaling way) to do that is like this:


public class MyWebService {
    public String longPoll() {
         short ct = 0;
         while(someCondition == false && ct < 60) {
             sleep(1000);  // 1 sec
         if (someCondition)
             return "got value";
             return "";

As i said, this dowsn't scale, but should demonstrate what i want to do. I've been looking for an alternative way and found two interesting things:

* i can create an asyncronous response with servlets:  http://docs.jboss.org/resteasy/docs/1.0.2.GA/userguide/html/Asynchronous_HTTP_Request_Processing.html http://docs.jboss.org/resteasy/docs/1.0.2.GA/userguide/html/Asynchronous_HTTP_Request_Processing.html but i would like to use stateless session beans for my webservice (its so nice and simple....)
* Somebody pointed me at the APR Connector for jboss and mentioned it could do what i want. unfortuantely i couldn't find any examples for apr, so i don't know if thats correct (and if it is, how it would be done)

I hope you can point me in the right direction.

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101021/29955f55/attachment.html 

More information about the jboss-user mailing list