<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Molindo Techblog &#187; Comet</title>
	<atom:link href="http://techblog.molindo.at/category/comet/feed" rel="self" type="application/rss+xml" />
	<link>http://techblog.molindo.at</link>
	<description>Molindo Techblog - formerly known as talk-on-tech.blogspot.com</description>
	<lastBuildDate>Fri, 05 Feb 2010 16:06:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>wicketstuff-push, bayeux and the memory leak</title>
		<link>http://techblog.molindo.at/2007/11/wicketstuff-push-bayeux-and-the-memory-leak.html</link>
		<comments>http://techblog.molindo.at/2007/11/wicketstuff-push-bayeux-and-the-memory-leak.html#comments</comments>
		<pubDate>Thu, 15 Nov 2007 08:46:00 +0000</pubDate>
		<dc:creator>Michael Sparer</dc:creator>
				<category><![CDATA[Comet]]></category>
		<category><![CDATA[Wicket]]></category>

		<guid isPermaLink="false">http://tech.molindo.at/2007/11/wicketstuff-push-bayeux-and-the-memory-leak.html</guid>
		<description><![CDATA[I&#8217;ve been fiddling around with reverse-ajax (or comet or pushlets) these days/weeks. You know, that stuff where the webserver keeps an open connection to the client and pushes new events to the client with just the transportation-delay &#8211; but no client interference. As described in my recent posts, I decided to use Apache Wicket for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been fiddling around with reverse-ajax (or comet or pushlets) these days/weeks. You know, that stuff where the webserver keeps an open connection to the client and pushes new events to the client with just the transportation-delay &#8211; but no client interference. As described in my recent posts, I decided to use <a href="http://wicket.apache.org/">Apache Wicket</a> for my webapp, so I looked around if there&#8217;s something in the wicketstuff project that fits my needs. And yes, there is the <a href="http://sourceforge.net/projects/wicket-stuff/">wicketstuff-push</a> project that offers different implementations of server pushes. <a href="http://xhab.blogspot.com/">Xavier Hanin</a>, one of the men behind <a href="http://ant.apache.org/ivy/">Ivy</a>, and <a href="http://www.demay-fr.net/blog/">Vincent Demay</a> did great effort there to implement a timerbased PushImplementation and also a <a href="http://www.cometd.com/">Cometd-based</a> implementation of a event subscribe/publish mechanism. The latter uses an implementation of the <a href="http://svn.xantus.org/shortbus/trunk/bayeux/bayeux.html">Bayeux-spec</a> and the <a href="http://www.dojotoolkit.org/">Dojo-library</a> together with <a href="http://wicketstuff.org/confluence/display/STUFFWIKI/WicketStuff+Dojo">wicketstuff-dojo</a> to subscribe to channels and to process the pushes on client side.</p>
<p>Yesterday I took the time to have a closer look on how the Java implementation of the Bayeux protocol works and found out that each new client that subscribes to a channel gets stored in the Bayeux&#8217;s client-HashMap &#8230; and stays there. So apparently it is up to the user to remove the clients from there. Otherwise the HashMap would grow towards an OutOfMemoryError, which needed some 400.000 clients on my machine.<br />So how to get them out? Well it ain&#8217;t just that easy to say &#8220;on session unbinding I simply remove the client with the corresponding session id&#8221; as the client id the Bayeux protocol uses isn&#8217;t the http-session id. The client id also changes more frequently, a simple reload of the page is enough to have a new client id. So for my application, I subclassed CometdServlet (over which all request and thus all subscriptions are processed) and made a http-session &#8211; bayeux-client-session mapping. This means that I always know which session has which client id, and if the client-id differs, it simply gets removed from the Bayeux-map.</p>
<p>Problem solved</p>
<p>P.S.: Bayeux does the same with channels, so be careful with the amount of channels in your webapp<br />P.P.S.: Wicket&#8217;s first release candidate for version 1.3 is out *thumbs-up*</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2007/11/wicketstuff-push-bayeux-and-the-memory-leak.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
