Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
the problem with the approach is that a behavior is tired to a component that is tied to a page. any thread accessing the page needs to block because you dont want two or more theads working on the page.i think you need to take a bit of a different approach have a threadsafe queue of push events you want to be processed in the session/application and some way to publish them.have the push behavior write out a tag for a hidden iframe that would then initiate the push request thread have a processing strategy that handles this push request w/out touching pages and pushes _javascript_ form the sessions's queuethat way you have the decoupling that requires no blocking because your push thread doesnt access any objects that need to be synced save the session which can be accessed sync but you need to be careful whenever something happens - that something publishes a push event to the queue and the push thread outputs it to the hidden iframe where the _javascript_ is processed.-Igor On 8/26/06, Lorin Metzger <[EMAIL PROTECTED]> wrote: Lorin Metzger wrote: Eelco Hillenius wrote: The problem that I had was that it seemed like all otherrequests for that session were also blocked even ones that had nothing to dowith that behavior. You would have to make sure the request for a push behavior is handledby it's own IRequestTarget, which then would return null at thegetLock method. That would prevent the request being synchronized on the whole session. This also means you have to take care about thereentrant behavior of that push behavior. Hi, I created a separate IRequestTarget, that returned NULL for getLock(RequestCycle), to handle a new push behavior. I've verified that the un-synchronized doProcessEventsAndRespond(processor); is called in RequestCycle.java line 884 Wicket 1.2.1. by calling Thread.dumpStack(). Unfortunately all subsequent requests are still being blocked when I block the thread that handles my behavior. I spun off a separate thread in my application that dumps the stack of all active threads, as far as I can tell all subsequent requests are being blocked in Session.getPage(...). line 404. This is the relevant code in Session.java: Thread t = (Thread)usedPages.get(id); while (t != null && t != Thread.currentThread()) { try { wait(1000); } catch (InterruptedException ex) { throw new WicketRuntimeException(ex); } t = (Thread)usedPages.get(id); } I'm guessing that the Thread returned by usedPages.get(id) is actually the initial Thread that I blocked for my PushBehavior. So t will never == Thread.currentThread() or null until I release that Thread? Does the fact that the Thread used to handle my Behavior (appears to be) is in usedPages indicate that I have done something horribly wrong? Thanks, -Lorin -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
Lorin Metzger wrote: Eelco Hillenius wrote: The problem that I had was that it seemed like all other requests for that session were also blocked even ones that had nothing to do with that behavior. You would have to make sure the request for a push behavior is handled by it's own IRequestTarget, which then would return null at the getLock method. That would prevent the request being synchronized on the whole session. This also means you have to take care about the reentrant behavior of that push behavior. Hi, I created a separate IRequestTarget, that returned NULL for getLock(RequestCycle), to handle a new push behavior. I've verified that the un-synchronized doProcessEventsAndRespond(processor); is called in RequestCycle.java line 884 Wicket 1.2.1. by calling Thread.dumpStack(). Unfortunately all subsequent requests are still being blocked when I block the thread that handles my behavior. I spun off a separate thread in my application that dumps the stack of all active threads, as far as I can tell all subsequent requests are being blocked in Session.getPage(...). line 404. This is the relevant code in Session.java: Thread t = (Thread)usedPages.get(id); while (t != null && t != Thread.currentThread()) { try { wait(1000); } catch (InterruptedException ex) { throw new WicketRuntimeException(ex); } t = (Thread)usedPages.get(id); } I'm guessing that the Thread returned by usedPages.get(id) is actually the initial Thread that I blocked for my PushBehavior. So t will never == Thread.currentThread() or null until I release that Thread? Does the fact that the Thread used to handle my Behavior (appears to be) is in usedPages indicate that I have done something horribly wrong? Thanks, -Lorin - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
Eelco Hillenius wrote: The problem that I had was that it seemed like all other requests for that session were also blocked even ones that had nothing to do with that behavior. You would have to make sure the request for a push behavior is handled by it's own IRequestTarget, which then would return null at the getLock method. That would prevent the request being synchronized on the whole session. This also means you have to take care about the reentrant behavior of that push behavior. Thanks Eelco, that would explain my problems. I'll keep you updated on how I make out. -Lorin - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
> I like the idea of the AjaxPushBehavior mentioned in the issue tracker > posting. At one point I tried extending AbstractDefaultAjaxBehavior, and > adding an addOnLoadModifier() which asynchrously called back on page load > and then I blocked that thread, with the intention of waking up that thread > and calling AjaxRequestTarget.addComponent when some action took place on > the server. The problem that I had was that it seemed like all other > requests for that session were also blocked even ones that had nothing to do > with that behavior. You would have to make sure the request for a push behavior is handled by it's own IRequestTarget, which then would return null at the getLock method. That would prevent the request being synchronized on the whole session. This also means you have to take care about the reentrant behavior of that push behavior. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
Eelco Hillenius wrote: On 8/25/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: i might be totally missing something - but dont you need a special servlet container that maintains open socket separate from threads by using nio? like jetty 6? and then once you have that you need to use that servlet container's special api to do this? Yeah, I think so too. Isn't that why our issue (http://sourceforge.net/tracker/index.php?func=detail&aid=1294920&group_id=119783&atid=684978, Lorin if you are interested in it, feel free to open that issue again) is specifically for Jetty? Right, you do need a Servlet containers specific API to do this and achieve any kind of performance for just the reason that Igor mentioned. So you would need to specifically use Jetty's API. Jetty Continuations differ from other solutions however, because if a Servlet container does not support Continuations, it will just fallback to threadful waiting, i.e. (100 users 100 threads), but won't actually fail unlike, Tomcat's CometServlet, and BEA's AbstractAsyncServlet. Please note http://blogs.webtide.com/gregw/2006/07/25/1153845234453.html I apologize, last night when I was searching I did not come across posting on the issue tracker. For me the servlet container specific things are less of an issue, maybe its because of my lack of familiarity with wicket, but let me try to rephrase my question this way. I don't care about performance (lets pretend), and I'm willing to waste one thread for every blocked request. Do you have any suggestion about the best way I could asynchrously call the server through wicket, have that request be blocked, and then based upon some action on the server have that thread wake up, and send updated data back to the server. I like the idea of the AjaxPushBehavior mentioned in the issue tracker posting. At one point I tried extending AbstractDefaultAjaxBehavior, and adding an addOnLoadModifier() which asynchrously called back on page load and then I blocked that thread, with the intention of waking up that thread and calling AjaxRequestTarget.addComponent when some action took place on the server. The problem that I had was that it seemed like all other requests for that session were also blocked even ones that had nothing to do with that behavior. I'm willing to open the issue back up and work on it, but considering my failure in the above mentioned paragraph I'm not exactly sure what the right approach is for the wicket aspects to asynchronously call back to the server, block that requests, and then send updates via that blocked request. Am I conceptually missing something about here? with the current architecture if you have a hundred clients doing comet you will have a hundred threads - not so good. Yeah. What do you think Lorin? Is there something we might have missed from e.g. DWR? An alternative for your use case that would work today is AJAX polling. Comet style afaik is an optimization of this polling anyway. Right polling would work, and COMET is just an optimization, but it could be useful for other things :) Thanks for the feedback, -Lorin Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
On 25.8.2006, at 19.43, Eelco Hillenius wrote: > >> with the current architecture if you have a hundred clients doing >> comet you >> will have a hundred threads - not so good. > > Yeah. What do you think Lorin? Is there something we might have missed > from e.g. DWR? An alternative for your use case that would work today > is AJAX polling. Comet style afaik is an optimization of this polling > anyway. Yeah, it's an optimization, and for testing/small amounts of users servlet based approach is a good start. I have done some comet stuff with servlets and Apache MINA based http server as an alternative (jetty6 was not available when I did that). It's a good idea to do drivers for different transports anyway. Janne - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
On 8/25/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > i might be totally missing something - but dont you need a special servlet > container that maintains open socket separate from threads by using nio? > like jetty 6? and then once you have that you need to use that servlet > container's special api to do this? Yeah, I think so too. Isn't that why our issue (http://sourceforge.net/tracker/index.php?func=detail&aid=1294920&group_id=119783&atid=684978, Lorin if you are interested in it, feel free to open that issue again) is specifically for Jetty? > with the current architecture if you have a hundred clients doing comet you > will have a hundred threads - not so good. Yeah. What do you think Lorin? Is there something we might have missed from e.g. DWR? An alternative for your use case that would work today is AJAX polling. Comet style afaik is an optimization of this polling anyway. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
i might be totally missing something - but dont you need a special servlet container that maintains open socket separate from threads by using nio? like jetty 6? and then once you have that you need to use that servlet container's special api to do this? with the current architecture if you have a hundred clients doing comet you will have a hundred threads - not so good.-IgorOn 8/25/06, Lorin Metzger <[EMAIL PROTECTED]> wrote: Eelco Hillenius wrote: Hi,COMET is not implemented as a core feature at this time.Do you have a specific use case where you would like to use it for?That might be a good start to investigate the options. One use case would be, a application with a small group of users. The users have a page where they can add/remove data (Spring/Hibernate backend), and also see the existing entries in a table on the same page. When one user adds/removes data I would like to be able to push updates out to update the table of existing entries for all the other users. That being said I would like to build something as generic as possible. I realize the data/_javascript_ that server pushes out will have to be custom for each specific use case, but it would be nice to have an API somewhat like DWR, that allows you to get all the sessions for a particular page, and the push out updates. (i.e.) Collection sessions = WebContextFactory.get().getScriptSessionsByPage("/index.html");DwrUtil util = new DwrUtil(sessions);util.setValue("message", "Hello, World!"); I've experimented with (and had limited success) placing a ServletFilter in front of the wicket servlet, and pulling off request that had certain attributes, and blocking them, until new data was available (Very similiar to the Jetty 6.0 Continuation chat application example). At this point I'm really trying to get a sense of what the best way is to create a generic API similar to above, that I can later apply to specific solutions. Is using a ServletFilter the right approach? Can you think of another way that provides better cohesion with wicket? Thanks, -Lorin EelcoOn 8/24/06, Lorin Metzger <[EMAIL PROTECTED]> wrote: Hi,I was searching the mailing lists and noticed a few comments aboutReverse Ajax and COMET. Mainly jokes about who would ask about it first:) . Has anybody made any serious attempts to add DWR like reverse-ajax support to wicket?If not does anybody have any suggestions on what the best/*right* waywould be to add this type of feature to wicket's framework?Thanks for any advice you can give. -Lorin-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
Eelco Hillenius wrote: Hi, COMET is not implemented as a core feature at this time. Do you have a specific use case where you would like to use it for? That might be a good start to investigate the options. One use case would be, a application with a small group of users. The users have a page where they can add/remove data (Spring/Hibernate backend), and also see the existing entries in a table on the same page. When one user adds/removes data I would like to be able to push updates out to update the table of existing entries for all the other users. That being said I would like to build something as generic as possible. I realize the data/_javascript_ that server pushes out will have to be custom for each specific use case, but it would be nice to have an API somewhat like DWR, that allows you to get all the sessions for a particular page, and the push out updates. (i.e.) Collection sessions = WebContextFactory.get().getScriptSessionsByPage("/index.html"); DwrUtil util = new DwrUtil(sessions); util.setValue("message", "Hello, World!"); I've experimented with (and had limited success) placing a ServletFilter in front of the wicket servlet, and pulling off request that had certain attributes, and blocking them, until new data was available (Very similiar to the Jetty 6.0 Continuation chat application example). At this point I'm really trying to get a sense of what the best way is to create a generic API similar to above, that I can later apply to specific solutions. Is using a ServletFilter the right approach? Can you think of another way that provides better cohesion with wicket? Thanks, -Lorin Eelco On 8/24/06, Lorin Metzger <[EMAIL PROTECTED]> wrote: Hi, I was searching the mailing lists and noticed a few comments about Reverse Ajax and COMET. Mainly jokes about who would ask about it first :) . Has anybody made any serious attempts to add DWR like reverse-ajax support to wicket? If not does anybody have any suggestions on what the best/*right* way would be to add this type of feature to wicket's framework? Thanks for any advice you can give. -Lorin - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Server Push (COMET / Reverse Ajax)
Hi, COMET is not implemented as a core feature at this time. I think there is a feature request open for such support with a specific implementation for Jetty. And maybe some users have created something COMET like. Do you have a specific use case where you would like to use it for? That might be a good start to investigate the options. Eelco On 8/24/06, Lorin Metzger <[EMAIL PROTECTED]> wrote: > Hi, > > > I was searching the mailing lists and noticed a few comments about > Reverse Ajax and COMET. Mainly jokes about who would ask about it first > :) . Has anybody made any serious attempts to add DWR like reverse-ajax > support to wicket? > > > If not does anybody have any suggestions on what the best/*right* way > would be to add this type of feature to wicket's framework? > > > > Thanks for any advice you can give. > > > > -Lorin > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user